Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 May 2011 15:28:02 +0400
From:      Pan Tsu <inyaoo@gmail.com>
To:        freebsd-questions@freebsd.org
Cc:        Stanislav Sedov <stas@FreeBSD.org>
Subject:   fuser(1): do FIFOs and sockets count as "named" files?
Message-ID:  <868vttd7lp.fsf@gmail.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?868vttd7lp.fsf>