The patch that Pete provided fixed earlier versions of the kernel
so that the perl test script t/lib/io/unix.t would pass, as
unpatched kernels don't block in accept as documented
I'm hoping it get's into the official 2.3.32 release.
David Dyck
On Mon, 13 Dec 1999, David Dyck wrote:
> Subject: Pete's patch fixes accept() for me,
was Re: accept() doesn't block as it should in 2.3.x kernels
>
> Thanks Pete, the patch you sent fixed accept() for
> me, so now perl passes lib/io_unix test as well
> as my test program now blocks accept as I expect
>
> David
>
> On Sun, 12 Dec 1999, Pete Wyckoff wrote:
>
> > Date: Sun, 12 Dec 1999 13:45:42 -0800
> > From: Pete Wyckoff <wyckoff@ca.sandia.gov>
> > To: David Dyck <dcd@tc.fluke.com>
> > Cc: linux-kernel@vger.rutgers.edu, kuznet@ms2.inr.ac.ru
> > Subject: Re: accept() doesn't block as it should in 2.3.x kernels
> >
> > dcd@tc.fluke.com said:
> > >
> > > The following demo code should block on the call to accept
> > > but it doesn't in 2.3.x, (where x is 24,27,28,30,31, and 32pre2)
> > >
> > > 2.2.5, 2.2.13, and 2.2.14pre9 block as expected in accept()
> > >
> > > I'm getting
> > > ENOTCONN "Transport endpoint is not connected"
> >
> > Looks like the changes to 2.3.15 did not take the accept() case into
> > account.
> > -- Pete
> >
--- linux/net/core/datagram.c.orig Sun Dec 12 13:30:40 1999
+++ linux/net/core/datagram.c Sun Dec 12 13:31:50 1999
@@ -20,6 +20,7 @@
* Alan Cox : Datagram iovec handling
* Darryl Miles : Fixed non-blocking SOCK_STREAM.
* Alan Cox : POSIXisms
+ * Pete Wyckoff : Unconnected accept() fix.
*
*/
@@ -82,7 +83,7 @@
/* Sequenced packets can come disconnected. If so we report the problem */
error = -ENOTCONN;
- if(connection_based(sk) && sk->state!=TCP_ESTABLISHED)
+ if(connection_based(sk) && !(sk->state==TCP_ESTABLISHED || sk->state==TCP_LISTEN))
goto out;
/* handle signals */
>
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/