What does the FD column specified in lsof mean?

I am using the following command to get a list of channels:

lsof | grep PIPE 

      

I want to know what the FD column values ​​mean (fifth http://i.imgur.com/KHczptf.png ). I think r

both w

mean to read and write , respectively, but what does the number that follows each of those characters mean?


I know FD stands for File Descriptor, I want to figure out what the values ​​shown in the column mean, such as 3r, 16w, 20r, etc.

+3


source to share


2 answers


Files are opened not only as streams. Some of them are listed in the manual 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.

      

+6


source


This is a file descriptor.

More about this:



The file descriptor (FD) is an abstract indicator for file access. This term is commonly used in POSIX operating systems.

In POSIX, a file descriptor is an integer, in particular of type C. There are three POSIX standard file descriptors, corresponding to the three standard streams that every process is supposed to have (with the possible exception of the daemon).

0


source







All Articles