How do I tell if STDIN is a PIPE?

Boyd Roberts boyd at prl.dec.com
Tue Jun 4 20:00:25 AEST 1991


In article <1991Jun3.175117.9882 at leland.Stanford.EDU>, dkeisen at leland.Stanford.EDU (Dave Eisen) writes:
> 
> Of course, it is (my brain slipped when I was typing and I wrote S_IFREG in
> place of S_IFMT). That still doesn't change the point of my posting ---
> on this machine (running ULTRIX 4.1), sb.stmode & S_IFMT is 0 for a pipe.
> 

Yep, that really sucks.  stat(2) on a pipe(2) returns with st_mode == 0.

But, stat(2) on a named pipe returns with st_mode == S_IFIFO | <mode>.
I just checked this out on my 3max (ULTRIX prl313 4.2 0 RISC).

Neat kernel work, guys...  real neat.


Boyd Roberts			boyd at prl.dec.com

``When the going gets wierd, the weird turn pro...''



More information about the Comp.unix.programmer mailing list