我在我的机器人中做了一个strace,我得到了以下一行
accept4(8<UNIX:[246]>, {sa_family=AF_UNIX}, [110->2], 0) = 9<UNIX:[2512219]>
我不明白{sa_family = AF_UNIX}是什么(它应该是一个sockaddr指针,但它在路径和内存地址方面指向哪里?)我想知道110和2的含义是什么,为什么110是指向2以及从此操作返回的确切内容。
(我真的很好奇这样创建的套接字的对等体,因为我找不到任何proc / PID / fd文件中的inode 2512219,所以我想知道读取/写入套接字的进程是否已经死了现在,如果我能得到他的名字。)谢谢!
来自man accept4:
int accept4(int sockfd,struct sockaddr * addr,socklen_t * addrlen,int flags);
accept4(8<UNIX:[246]>, {sa_family=AF_UNIX}, [110->2], 0) = 9<UNIX:[2512219]>
8
是sockfd
的价值。来自男人:the listening socket, sockfd
246
是8
文件描述符的inode编号.sa_family
指向的内存中的结构struct sockaddr
中的struct成员addr
具有AF_UNIX
的值[addr] It is filled in with the address of the peer socket, as known to the communications layer
。110
输入值addrlen
(存储在socklen_t
指针指向的内存中的addrlen
整数)。来自男人:the caller must initialize it [addrlen] to contain the size (in bytes) of the structure pointed to by addr;
2
的addrlen
值。来自男人:will contain the actual size of the peer address
。0
返回文件描述符。来自男人:flags
If flags is 0, then accept4() is the same as accept().
inode number of 9
th文件描述符