UNIX环境高级编程 高级进程间通讯

 

 

相关函数列表

//下面函数用来创建一对无命名的,相互连接的UNIX域套接字
#include <sys/socket.h>
int socketpair(int domain, int type, int protocol, int sockfd[2]);

//sockaddr_un结构体如下
struct sockaddr_un {
    sa_family_t  sun_family;
    char             sun_path[108];
};


//定义三个宏用于访问控制数据,计算cmsg_len所使用的值
#include <sys/socket.h>
unsigned char *CMSG_DATA(struct cmsghdr *cp);
struct cmsghdr *CMSG_FIRSTHDR(struct msghdr *mp);
struct cmsghdr *CMSG_NXTHDR(struct msghdr *mp, struct cmsghdr *cp)

//cmsghdr结构体
struct cmsghdr {
    sockelen_t   cmsg_len;
    int                cmsg_level;
    int                cmsg_type;
};

 

你可能感兴趣的:(unix)