首页 > 代码库 > APUE:高级进程间通信

APUE:高级进程间通信

这一章核心内容:使用 UNIX 域套接字传送文件描述符。

 

/* Create two new sockets, of type TYPE in domain DOMAIN and using
   protocol PROTOCOL, which are connected to each other, and put file
   descriptors for them in FDS[0] and FDS[1].  If PROTOCOL is zero,
   one will be chosen automatically.  Returns 0 on success, -1 for errors.  */
extern int socketpair (int __domain, int __type, int __protocol,
		       int __fds[2]) __THROW;

 

文件描述符的传送以来 cmsghdr 结构体。具体直接看书上源码。

APUE:高级进程间通信