S_ISCHR, S_ISFIFO, O_NONBLOCK, O_NOCTTY

Melissa O'Neill oneill@cs.sfu.ca
Thu Feb 4 16:33:00 GMT 1999


Zack Weinberg <zack@rabi.columbia.edu> writes:
> Either way, that's gonna hit the "not a file, pipe, or tty" case.  Can
> you do `cat | ./cpp' on a nextstep box to confirm this?

Running `cat | ./cpp' on my NEXTSTEP 3.3 machine appears to work. Similarly:

	nextstep3.3% echo 'FOO' | ./cpp -DFOO=BAR
	# 1 ""
	BAR

... seems right to me (obtained with GNU CPP version egcs-2.93.04 19990131).

On a tangent about fstat bugs and calling shutdown(), I wrote:
>> With socket fstat bugs in NEXTSTEP and Solaris it was easier just to
>> call shutdown and ignore any ENOTSOCK errors.

... to which Zack replied:
> Hmm...  That's not a bad way to detect a socket when you only care
> about reading, which describes cpplib pretty well.  My documentation
> is inconsistent - what does shutdown do when asked to disallow sends
> and sending is already shutdown?  I.e. if I do
>
> {
> int fd = socket(...)
> shutdown(fd, 1);
> shutdown(fd, 1);
> }
>
> will the second call succeed or fail, and if it fails, what will errno
> be?

On my NEXTSTEP machine, using AF_INET sockets, the second call succeeds
and appears to be harmlessly redundant.

Regards,

    Melissa.


More information about the Gcc-patches mailing list