mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* open(O_ASYNC) is (still) broken in 2.6.3
@ 2004-03-04 13:53 Michael Kerrisk
  0 siblings, 0 replies; only message in thread
From: Michael Kerrisk @ 2004-03-04 13:53 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, mjp

Hello Andrew,

>From http://www.ussg.iu.edu/hypermail/linux/kernel/0111.1/1401.html and
http://www.ussg.iu.edu/hypermail/linux/kernel/0111.1/1636.html , I see that
this topic has been visited at least once before, but this behavior appears
still to be present in Linux 2.6.3.

The O_ASYNC flag has no affect (in terms of signal generation) when
specified in a call to open().  For example, if we make the following set of
calls:

    fd = open("/dev/tty2", O_RDONLY | O_ASYNC);
    fcntl(fd, F_SETOWN, getpid());

Then the call:

    flags = fcntl(fd, F_GETFL);

tells us that O_ASYNC is in 'flags', but no signal is delivered when input
becomes available on the terminal.  (We see the same behaviour if opening a
FIFO on 2.6.3.).  On the other hand, the following does result in the
generation of SIGIO signals when input is available:

    fd = open("/dev/tty2", O_RDONLY);
    flags = fcntl(fd, F_GETFL);
    fcntl(fd, F_SETFL, flags | O_ASYNC);
    fcntl(fd, F_SETOWN, getpid());

Furthermore, the following sequence also results in generation of SIGIO when
input is available, but only after the final fcntl() call:

    fd = open("/dev/tty2", O_RDONLY) | O_ASYNC;
    fcntl(fd, F_SETOWN, getpid());
    fcntl(fd, F_SETFL, 0);
    fcntl(fd, F_SETFL, O_ASYNC);

I assume the patch referred to at the second URL above fixes this problem,
but I haven't tested it.  The question is, why is this still broken?

Cheers,

Michael


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-03-04 13:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-04 13:53 open(O_ASYNC) is (still) broken in 2.6.3 Michael Kerrisk

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

all inboxes | Powered by JetHome®