Messages in this thread | | | Date | Fri, 24 Apr 1998 12:36:47 -0600 (MDT) | Subject | possible bug in shutdown(2) system call? | From | Tkil <> |
| |
I'm forwarding this for Tom Christiansen, who posted the following on the perl5-porter's list:
| From: Tom Christiansen <tchrist@jhereg.perl.com> | Subject: Linux has a broken shutdown syscall! | To: The Perl Porters Mailing List <perl5-porters@perl.org> | Date: Fri, 24 Apr 1998 06:37:38 -0600 | | Normally, one can exchange | | pipe(READER, WRITER) | | for | | socketpair(READER, WRITER, AF_UNIX, SOCK_STREAM, PF_UNIX); | shutdown(READER, 1); # no more writing for reader | shutdown(WRITER, 0); # no more reading for writer | | But guess what -- that doesn't work without fiddling! | | 1) The call to PF_UNIX must be PF_UNSPEC (or 0) on SunOS and BSD, | even though it claims otherwise. There's some talk of PF_LOCAL, | but that's not even documented outside BSD. Linux will accept | either PF_UNIX or PF_UNSPEC there. | | 2) On Linux, shutdown is broken! You have to give it the opposite | argument! You must perversely do this: | shutdown(READER, 0); | shutdown(WRITER, 1); | | Here's a suite that demonstrates this. Notice 1a and 1c, 2a and 2c. | If you're on Linux, you'll have shutdown tell the reader not to | read and the writer not to write. Very bizarre. On SunOS and BSD, | you do the sane thing. | | Anybody have any clues about this? | | --tom
The full text of this article should be retrievable from:
http://www.rosat.mpe-garching.mpg.de/mailing-lists/perl-porters/1998-04/msg01409.html
Does anyone have more information to offer on this topic? It sounds like Linux is not doing what the man page for shutdown(2) claims it's doing:
| SHUTDOWN(2) Linux Programmer's Manual SHUTDOWN(2) | | NAME | shutdown - shut down part of a full-duplex connection [...] | | DESCRIPTION | The shutdown call causes all or part of a full-duplex con- | nection on the socket associated with s to be shut down. | If how is 0, further receives will be disallowed. If how | is 1, further sends will be disallowed. If how is 2, fur- | ther sends and receives will be disallowed. [...] | | CONFORMING TO | 4.4BSD (the shutdown function call first appeared in | 4.2BSD). [...] | | BSD Man Page 24 July 1993 1
If this belongs to the glibc people, please tell me, and I'll try to forward it to them. (Better yet, forward it for me -- I don't know their address.)
I tried searching the archives for references to this, but didn't find anything obvious. If I'm missing something, please be reasonably gentle with your enlightenment. :)
Thanks, Tkil -- Tkil * <URL: http://www.scrye.com/~tkil> * hopelessly hopeless romantic. "So amplify this little one | She hears as much as she can see She's a volume freak | And what she sees, she can't believe." -- Catherine Wheel, _Happy Days_, "Judy Staring At The Sun"
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |