Reputation:
Say I have a named pipe:
mypipe="foobar"
mkfifo $mypipe
echo "foo" > $mypipe
if nobody is listening, I am pretty certain this echo call just hangs. Is there a way to determine if anyone is reading from the pipe before I make the echo call?
Upvotes: 1
Views: 499
Reputation: 189830
The fuser
utility tells you who holds an open handle, but in the general case, it requires root
privileges.
Quoting the manual page,
fuser
may only be able to gather partial information unless run with privileges. As a consequence, files opened by processes belonging to other users may not be listed and executables may be classified as mapped only.Installing
fuser
SUIDroot
will avoid problems associated with partial information, but may be undesirable for security and privacy reasons.
Upvotes: 1