diff options
author | Alexey Tourbin <at@altlinux.ru> | 2005-06-11 20:26:56 +0400 |
---|---|---|
committer | H.Merijn Brand <h.m.brand@xs4all.nl> | 2005-06-12 09:58:32 +0000 |
commit | 3341d187a8c660dcdef29c6ff668870f1d944ae1 (patch) | |
tree | eab98b7d5f4d38b83df21c37aff45bfdfcee94be /pod/perlipc.pod | |
parent | 595589fae4479595ffd0993d9a9d2e00eaaa1581 (diff) | |
download | perl-3341d187a8c660dcdef29c6ff668870f1d944ae1.tar.gz |
perlipc.pod: mkfifo()
Message-ID: <20050611122656.GC8181@solemn.turbinal.org>
p4raw-id: //depot/perl@24807
Diffstat (limited to 'pod/perlipc.pod')
-rw-r--r-- | pod/perlipc.pod | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pod/perlipc.pod b/pod/perlipc.pod index efae6875ef..671da85f75 100644 --- a/pod/perlipc.pod +++ b/pod/perlipc.pod @@ -246,7 +246,12 @@ mechanism for processes communicating on the same machine. It works just like a regular, connected anonymous pipes, except that the processes rendezvous using a filename and don't have to be related. -To create a named pipe, use the Unix command mknod(1) or on some +To create a named pipe, use the C<POSIX::mkfifo()> function. + + use POSIX qw(mkfifo); + mkfifo($path, 0700) or die "mkfifo $path failed: $!"; + +You can also use the Unix command mknod(1) or on some systems, mkfifo(1). These may not be in your normal path. # system return val is backwards, so && not || @@ -272,13 +277,13 @@ to find out whether anyone (or anything) has accidentally removed our fifo. chdir; # go home $FIFO = '.signature'; - $ENV{PATH} .= ":/etc:/usr/games"; while (1) { unless (-p $FIFO) { unlink $FIFO; - system('mknod', $FIFO, 'p') - && die "can't mknod $FIFO: $!"; + require POSIX; + POSIX::mkfifo($FIFO, 0700) + or die "can't mkfifo $FIFO: $!"; } # next line blocks until there's a reader |