[Thread Prev][Thread Next][Thread Index]

Re: SIGIO on socket disconnect



Hello!

> Recently I have run across a problem with Linux 2.2 kernels concerning the
> generation of SIGIO signals when the far end of a socket disconnects.

Yes :( It calls sk->state_change, which does not generate signal.

BTW I have no idea why it could work in 2.0. It does exactly
the same thing.

In any case, try the patch enclosed.

Alexey

--- ../orig/linux/net/unix/af_unix.c	Mon Mar 22 21:11:06 1999
+++ linux/net/unix/af_unix.c	Fri May  7 20:32:22 1999
@@ -322,7 +322,7 @@
 	{
 		if (sk->type==SOCK_STREAM && unix_our_peer(sk, skpair))
 		{
-			skpair->state_change(skpair);
+			skpair->data_ready(skpair,0);
 			skpair->shutdown=SHUTDOWN_MASK;	/* No more writes*/
 		}
 		unix_unlock(skpair); /* It may now die */
@@ -1409,7 +1415,10 @@
 			if (mode&SEND_SHUTDOWN)
 				peer_mode |= RCV_SHUTDOWN;
 			other->shutdown |= peer_mode;
-			other->state_change(other);
+			if (peer_mode&RCV_SHUTDOWN)
+				other->data_ready(other,0);
+			else
+				other->state_change(other);
 		}
 	}
 	return 0;

-
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/