APUE:高級進程間通訊

這一章核心內容:使用 UNIX 域套接字傳送文件描述符。dom

 

/* 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 結構體。具體直接看書上源碼。socket

相關文章
相關標籤/搜索