mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael Kerrisk" <mtk-lists@jambit.de>
To: <akpm@osdl.org>
Cc: <linux-kernel@vger.kernel.org>, <mjp@pilcrow.madison.wi.us>
Subject: open(O_ASYNC) is (still) broken in 2.6.3
Date: Thu, 4 Mar 2004 14:53:25 +0100	[thread overview]
Message-ID: <001b01c401f0$10d77130$c100a8c0@wakatipu> (raw)

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


                 reply	other threads:[~2004-03-04 13:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001b01c401f0$10d77130$c100a8c0@wakatipu' \
    --to=mtk-lists@jambit.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjp@pilcrow.madison.wi.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®