其他分享
首页 > 其他分享> > filesystems – / proc / net / unix的内容是什么意思?

filesystems – / proc / net / unix的内容是什么意思?

作者:互联网

在我的Android设备上有一个名为/ proc / net / unix的文件,其中content不符合任何standard linux发行版(显示unix域套接字).前几行:

Num       RefCount Protocol Flags    Type St Inode Path
00000000: 00000002 00000000 00000000 0002 01 5287581 /data/misc/wifi/sockets/wpa_ctrl_789-3189
00000000: 00000003 00000000 00000000 0001 03    6402 /dev/socket/qmux_radio/qmux_client_socket    297
00000000: 00000002 00000000 00010000 0001 01    7180 /dev/.secure_storage/ssd_socket
00000000: 00000002 00000000 00010000 0001 01    6424 /dev/socket/cnd
00000000: 00000002 00000000 00010000 0001 01    6400 @QMulticlient
...

(1)这些不同的栏代表什么?

编辑:好的我找到了this

Here ‘Num’ is the kernel table slot number, ‘RefCount’ is the number of users of the socket, ‘Protocol’ is currently always 0, ‘Flags’ represent the internal kernel flags holding the status of the socket. Currently, type is always ‘1’ (Unix domain data-gram sockets are not yet supported in the kernel). ‘St’ is the internal state of the socket and Path is the bound path (if any) of the socket.

但是,这不是最新的,因为我们有一种类型而不是澄清“内部状态”的含义.

(2)同样在路径的末尾,有时会有一个没有自己的列名的附加数字.那是什么?

另外,我可以在内核源代码中找到创建它的位置吗?

编辑:2016-04-27(已解决)

感谢下面的回答,我已经通过lsof | grep qmux确认,qmux_client_sockets项的最后一列中的数字是使用它的进程的PID.

解决方法:

生成此文件的代码位于net/unix/af_unix.c in the kernel source的unix_seq_show()函数中.查看include/net/af_unix.h也很有用,可以查看正在使用的数据结构.

套接字路径始终是输出中的最后一列,Android kernel source在这方面与stock kernel匹配.因此,除非我弄错了,看起来像列的数字实际上并不是一个单独的列.

只要总路径长度小于108个字节,您几乎可以将UNIX域套接字命名为所需的任何名称.因此,您无法对这些路径的外观做出任何假设.选择这些名称的用户空间代码可能使用制表符后跟一个数字,甚至将名称填充到带有空格的特定长度.要测试我的理论,您可以尝试查看/ dev / socket / qmux_radio /中的套接字文件.

标签:android,filesystems,proc,unix-sockets
来源: https://codeday.me/bug/20190810/1634692.html