【问题标题】:lsof: what does number inside bracket of socket representlsof:socket括号内的数字代表什么
【发布时间】:2015-06-21 15:00:24
【问题描述】:

当我为套接字运行 lsof 命令时,在名称列中,一些数字出现在括号中,如下所示。什么意思?

 command    pid        user      fd                 Name
 process    8197       root      29                 socket:[3050474]

【问题讨论】:

    标签: linux lsof


    【解决方案1】:

    TL;DR:与该套接字关联的唯一编号


    Unix 的定义规则之一是“Everything is a file”。因为套接字也由非常特殊的文件系统表示,通常称为 sockfs

    传统文件系统上的文件具有 inode-numbers -- 允许识别它们的唯一编号:

    $ ls -li /bin/bash 
    7864369 -rwxr-xr-x 1 root root 656584 Oct 15  2014 /bin/bash
    ^^^^^^^
    inode-number
    

    同样适用于 sockfs,所有套接字也有 inode-numbers

    对于没有实际文件命名架构的特殊文件系统,所有文件都具有fsname:[inode-number] 形式的通用名称(另请参阅:linux+v3.19.1/fs/dcache.c#L2945

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多