pipe flushing

Karl Heuer karl at haddock.UUCP
Fri Jan 9 18:38:22 AEST 1987


In article <404 at hadron.UUCP> jsdy at hadron.UUCP (Joseph S. D. Yao) writes:
>>  exit(0);	/* this is for lint */
>... System 5 lint requires that these exit()s be return()s;
>    I was unaware that any lint required exit()s.

(Perhaps he means exit(0) is better than falling off the end?)  Btw, SysV lint
doesn't require return; it just wants you to assert /*NOTREACHED*/.

>>  fcntl(pipe1[0],F_SETFL,fcntl(pipe1[0],F_GETFL,0)|O_NDELAY);
>... (*sigh*)  Yes, this works for pipes, even though the docs
>    say it only works for tty's.  But (just because of the way
>    it's defined) I'd rather have a real int than 0 as the arg.
>    (man 2 fcntl)  Also, O_NDELAY is for open() or ioctl();
>    FNDELAY is for fcntl().

On SysV, O_NDELAY (defined in <fcntl.h>) is appropriate for either open() or
fcntl(); I don't know if there is an ioctl() that uses it.  FNDELAY is only
used in the kernel.  In what sense is 0 not a "real int"?

>>  signal(18,stop);	/* trap program's death */
>... Do you perchance mean SIGCHLD?  Which is  n o t  18!

The most portable name is SIGCLD, which *is* 18 on SysV, and a synonym for
SIGCHLD (which is 20) on BSD.  (And nonexistent on older unixes.)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list