linux 由lsof列出的FD列的管道是什么意思?

pu82cl6c  于 2022-11-02  发布在  Linux
关注(0)|答案(3)|浏览(216)

我使用以下命令来获取管道列表:

lsof | grep PIPE

我想知道FD列的值(第5个http://i.imgur.com/KHczptf.png)的含义,我认为rw分别表示readwrite,但是这些字符后面的数字是什么意思?
我知道FD是指文件描述符,我想弄清楚的是列中显示的值的含义,如3r、16w、20r等。

vh0rcniy

vh0rcniy1#

文件不仅仅是作为流打开的,其中一些在lsof的手册中列出:

FD    is the File Descriptor number of the file or:

           cwd  current working directory;
           Lnn  library references (AIX);
           err  FD information error (see NAME column);
           jld  jail directory (FreeBSD);
           ltx  shared library text (code and data);
           Mxx  hex memory-mapped type number xx.
           m86  DOS Merge mapped file;
           mem  memory-mapped file;
           mmap memory-mapped device;
           pd   parent directory;
           rtd  root directory;
           tr   kernel trace file (OpenBSD);
           txt  program text (code and data);
           v86  VP/ix mapped file;

      FD  is  followed  by one of these characters, describing the
      mode under which the file is open:

           r for read access;
           w for write access;
           u for read and write access;
           space if mode unknown and no lock
            character follows;
           '-' if mode unknown and lock
            character follows.

      The mode character is followed by one of these lock  charac-
      ters, describing the type of lock applied to the file:

           N for a Solaris NFS lock of unknown type;
           r for read lock on part of the file;
           R for a read lock on the entire file;
           w for a write lock on part of the file;
           W for a write lock on the entire file;
           u for a read and write lock of any length;
           U for a lock of unknown type;
           x  for an SCO OpenServer Xenix lock on part  of the
      file;
           X for an SCO OpenServer Xenix lock on  the   entire
      file;
           space if there is no lock.

      See  the  LOCKS  section  for  more  information on the lock
      information character.

      The FD column contents constitutes a single field for  pars-
      ing in post-processing scripts.
cig3rfwq

cig3rfwq2#

即 * 文件描述符 *。
更多信息:

在POSIX中,文件描述符是一个整数,特别是C类型的int。有三个标准的POSIX文件描述符,对应于三个标准流,这大概是每个进程(也许保存守护进程)都应该拥有的。

3zwtqj6y

3zwtqj6y3#

文件描述符是在计算机操作系统中唯一标识打开文件的数字。它描述数据资源以及如何访问该资源。此字段的最大限制在内核中指定,可以更改以防止阻塞(在达到文件描述符限制的情况下)。

相关问题