Messages in this thread |  | | Date | Thu, 17 May 2001 23:57:45 +0100 (BST) | From | Chris Evans <> | Subject | Kernel bug with UNIX sockets not detecting other end gone? |
| |
Hi,
I wonder if the following is a bug? It certainly differs from FreeBSD 4.2 behaviour, which gives the behaviour I would expect.
The following program blocks indefinitely on Linux (2.2, 2.4 not tested). Since the other end is clearly gone, I would expect some sort of error condition. Indeed, FreeBSD gives ECONNRESET.
#include <sys/types.h> #include <sys/socket.h> #include <stdio.h> #include <unistd.h>
int main(int argc, const char* argv[]) { int the_sockets[2]; int retval; char the_char; int opt = 1;
retval = socketpair(PF_UNIX, SOCK_DGRAM, 0, the_sockets); if (retval != 0) { perror("socketpair"); exit(1); } close(the_sockets[0]); /* Linux (2.2) blocks here; FreeBSD does not */ retval = read(the_sockets[1], &the_char, sizeof(the_char)); }
Cheers Chris
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |