Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rutgers!ames!ucbcad!ucbvax!decvax!ima!haddock!karl
From: karl@haddock.UUCP (Karl Heuer)
Newsgroups: comp.lang.c
Subject: Re: pipe flushing
Message-ID: <294@haddock.UUCP>
Date: Fri, 9-Jan-87 03:38:22 EST
Article-I.D.: haddock.294
Posted: Fri Jan  9 03:38:22 1987
Date-Received: Fri, 9-Jan-87 21:38:10 EST
References: <523@bath63.bath.ac.uk> <721@dg_rtp.UUCP> <658@bath63.ux63.bath.ac.uk> <404@hadron.UUCP>
Reply-To: karl@haddock.ISC.COM.UUCP (Karl Heuer)
Organization: Interactive Systems, Boston
Lines: 26

In article <404@hadron.UUCP> jsdy@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 ) 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@haddock.isc.com), The Walking Lint