From: Amos Waterland <apw@us.ibm.com>
To: linux-kernel@vger.kernel.org
Subject: O_ASYNC question
Date: Tue, 25 Jun 2002 11:30:52 -0500 [thread overview]
Message-ID: <20020625113052.A7510@kvasir.austin.ibm.com> (raw)
The man page for fcntl() says:
If you set the O_ASYNC status flag on a file descriptor (either by
providing this flag with the open(2) call, or by using the F_SETFL
command of fcntl), a SIGIO signal is sent whenever input or output
becomes possible on that file descriptor.
On a 2.4.18 kernel, this test program waits forever in sigwaitinfo():
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
const int BYTES = 5000000;
int i, fd;
char buff[BYTES];
char name[] = "/tmp/aio8.XXXXXX";
sigset_t sigset;
siginfo_t siginfo;
if ((fd = open(name, O_CREAT|O_WRONLY|O_NONBLOCK|O_ASYNC, 0600)) < 0 ||
unlink(name)) {
perror("creating temp file"); exit(1);
}
for (i = 0; i < BYTES; i++) buff[i] = 'Z';
if (sigemptyset(&sigset) || sigaddset(&sigset, SIGIO) ||
sigprocmask(SIG_BLOCK, &sigset, NULL)) {
perror("setting up signal mask"); exit(2);
}
if (write(fd, buff, BYTES) < 0) {
perror("writing to temp file"); exit(3);
}
printf("recv sig: %i\n", sigwaitinfo(&sigset, &siginfo));
return 0;
}
Shouldn't SIGIO be raised when the write() completes? (Is O_ASYNC only
valid for sockets, maybe?) Thanks in advance.
Amos Waterland
next reply other threads:[~2002-06-25 16:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-25 16:30 Amos Waterland [this message]
2002-06-26 21:11 ` William Lee Irwin III
2002-06-26 21:37 ` Amos Waterland
2002-06-27 0:56 ` William Lee Irwin III
2002-06-27 12:15 ` Jamie Lokier
2006-11-10 22:57 Mikulas Patocka
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=20020625113052.A7510@kvasir.austin.ibm.com \
--to=apw@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/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®