[Gllug] Named pipes
Richard Jones
rich at annexia.org
Tue Dec 11 12:06:19 UTC 2007
On Tue, Dec 11, 2007 at 11:32:54AM +0000, Toby Waterford wrote:
> I've worked out how to use unnamed pipes and I finding them very
> useful. I may be being dim, but named pipes completely confuse me -
> are they useful? Does anyone have any advice on getting to grips with
> them?
They're not really very useful. Very occasionally you might have,
say, a shell script where you want to use a named pipe to communicate
between two unrelated processes (unnamed pipes can only be created
where two processes are related to each other through fork(2)). A
rather contrived example might be:
mknod syslog-pipe p
logger < syslog-pipe &
[and in another shell script ...]
echo "Log message" >> syslog-pipe
Actually that example doesn't work too well because the 'logger'
process exits after the first log message is sent.
When talking to system daemons, a common method is to communicate over
a Unix domain socket which is similar to a named pipe but uses BSD
socket calls. See the unix(7) man page and the output of:
netstat -a | grep ^unix
Rich.
--
Richard Jones
Red Hat
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list