lenny@icus.islp.ny.us (Lenny Tropiano) (09/26/88)
The "mknod(1M)" command can be used to create character and block devices, as well as, FIFO's or named pipes. mknod(1M) needs to be run as the super-user if you are creating anything but fifo's. Usage: mknod name c|b maj min -or- mknod name p Normally when you create a named pipe, the ls(1) command signifies this the same as it does with directories (d), character devices (c), and block devices (b) with "p". For some reason this doesn't work. For example the file /usr/spool/lp/FIFO is a named pipe, but the directory doesn't tell us. $ ls -l /usr/spool/lp/FIFO -rw------- 1 lp other 0 Sep 25 19:42 /usr/spool/lp/FIFO ^ Here should be a "p". Here's a short program to test for FIFO status: /* isfifo.c */ #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> main(argc,argv) int argc; char *argv[]; { struct stat statbuf; if (argc < 2) { printf("usage: %s file\n", argv[0]); exit(1); } if (stat(argv[1],&statbuf) < 0) { perror("stat()"); exit(1); } printf("%s", argv[1]); if (statbuf.st_mode & S_IFIFO) printf(" is "); else printf(" isn't "); printf("a fifo\n"); } $ isfifo isfifo.c isfifo.c isn't a fifo $ isfifo /usr/spool/lp/FIFO /usr/spool/lp/FIFO is a fifo Why can't ls(1) do this too? I've seen it work elsewhere. -Lenny --- Lenny Tropiano ICUS Software Systems w: +1 (516) 582-5525 lenny@icus.islp.ny.us Telex: 154232428 ICUS h: +1 (516) 968-8576 {talcott,boulder,hombre,pacbell,sbcs}!icus!lenny attmail!icus!lenny ICUS Software Systems -- PO Box 1; Islip Terrace, NY 11752
mark@jhereg.Jhereg.MN.ORG (Mark H. Colburn) (09/27/88)
The file(1) command will also tell you whether a file is a named pipe. For example: $ file /usr/spool/lp/FIFO /usr/spool/lp/FIFO: fifo I find it easier than using another program. (sorry, Lenny...)
dpb@tellab5.tellabs.CHI.IL.US (Darryl Baker) (09/27/88)
Well sports fans the reason ls on the 3B1 is not marking named pipes correctly is that it is the BSD version of ls. It must not have been modified to handle named pipes. The easiest way to check this is link /bin/ls and /bin/lf then type lf. It will act as if you typed "ls -F", a totally Berkeley trait. -- __ _ __ / ) // / ) / / / __. __ __ __ , // /--< __. /_ _ __ Darryl Baker /__/_(_/|_/ (_/ (_/ (_/_</_ /___/_(_/|_/ <_</_/ (_ dpb@tellabs.chi.il.us / dpb@liltyke.chi.il.us '
ditto@cbmvax.UUCP (Michael "Ford" Ditto) (09/27/88)
In article <1099@tellab5.tellabs.CHI.IL.US> dpb@tellab5.UUCP (Darryl Baker) writes: >Well sports fans the reason ls on the 3B1 is not marking named pipes correctly >is that it is the BSD version of ls. It must not have been modified to handle >named pipes. The easiest way to check this is link /bin/ls and /bin/lf then type >lf. It will act as if you typed "ls -F", a totally Berkeley trait. Those are "standard" features of ls from AT&T; they were taken out for System V for some reason. Darryl is correct, though in pointing out that it is a symptom of the problem... the Unix PC apparrently has the V7 ls. Perhaps I should fix the one last bug in my own ls program and post it; it's what I've always been using, so I never noticed the missing fifo support. -- -=] Ford [=- "The number of Unix installations (In Real Life: Mike Ditto) has grown to 10, with more expected." ford@kenobi.cts.com - The Unix Programmer's Manual, ...!sdcsvax!crash!elgar!ford 2nd Edition, June, 1972. ditto@cbmvax.commodore.com