public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Kernel bug with UNIX sockets not detecting other end gone?
@ 2001-05-17 22:57 Chris Evans
  2001-05-17 22:59 ` Alan Cox
  2001-05-18 17:24 ` Kurt Roeckx
  0 siblings, 2 replies; 8+ messages in thread
From: Chris Evans @ 2001-05-17 22:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: davem


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-05-18 20:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-17 22:57 Kernel bug with UNIX sockets not detecting other end gone? Chris Evans
2001-05-17 22:59 ` Alan Cox
2001-05-17 23:51   ` Chris Evans
2001-05-18  0:32     ` David Schwartz
2001-05-18  8:32       ` Olaf Titz
2001-05-18 17:24 ` Kurt Roeckx
2001-05-18 20:02   ` Alan Cox
2001-05-18 20:52     ` Kurt Roeckx

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox