unp #8 (reading notes) (I/O)

/* timeout */
#include <unistd.h>
unsigned int alarm(unsigned int seconds);
/* select */
/* SO_RECVTIMEO  SO_SENDTIMEO */

#include <sys/uio.h>
ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset);
ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset);

struct iovec {
  void  *iov_base;    /* Starting address */
  size_t iov_len;     /* Number of bytes to transfer */
};


#include <sys/socket.h>
struct cmsghdr *CMSG_FIRSTHDR(struct msghdr *msgh);
struct cmsghdr *CMSG_NXTHDR(struct msghdr *msgh, struct cmsghdr *cmsg);
size_t CMSG_ALIGN(size_t length);
size_t CMSG_SPACE(size_t length);
size_t CMSG_LEN(size_t length);
unsigned char *CMSG_DATA(struct cmsghdr *cmsg);

struct cmsghdr {
  socklen_t cmsg_len;   /* data byte count, including header */
  int       cmsg_level; /* originating protocol */
  int       cmsg_type;  /* protocol-specific type */
  /* followed by unsigned char cmsg_data[]; */
};
posted @ 2013-07-30 20:29  srk  阅读(147)  评论(0编辑  收藏  举报