fuser(1): do FIFOs and sockets count as "named" files?

Pan Tsu inyaoo at gmail.com
Thu May 26 11:28:20 UTC 2011


fuser(1) man page mentions the tool is supposed to list processes that
have specified named file(s) open. As there are several types of files
(according to stat(2)) it's not clear which are supported, e.g.

  $ (mkfifo foo.fifo; cat <>foo.fifo) & nc -lU foo.socket &
  $ fuser foo.*
  foo.fifo:
  foo.socket:

  $ procstat -af | awk 'NR == 1 || /foo/'
    PID COMM               FD T V FLAGS    REF  OFFSET PRO NAME
   6672 cat                 0 f - rw------   2       0 -   /home/luser/foo.fifo
  11493 nc                  3 s - rw------   2       0 UDS foo.socket

  $ fstat | awk 'NR == 1 || $2 ~ /cat/ && $4 ~ 0 || $2 ~ /nc/ && $4 ~ 3'
  USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W
  luser     nc         11493    3* local stream fffffe00a980d690
  luser     cat         6672    0 /home/luser   5982 prw-r--r--       0 rw

fuser(1) on BusyBox/Linux does show open FIFOs, not sure about sockets.

--
FreeBSD 9.0-CURRENT r222247M amd64


More information about the freebsd-questions mailing list