From: Dan Kegel <dank@kegel.com>
To: Christopher Smith <x@xman.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Michael Elkins <me@toesinperil.com>, Zach Brown <zab@zabbo.net>
Subject: sigopen() vs. /dev/sigtimedwait
Date: Fri, 03 Aug 2001 18:32:52 -0700 [thread overview]
Message-ID: <3B6B50C4.D9FBF398@kegel.com> (raw)
So I've been thinking about the sigopen() system call I proposed.
(To recap: sigopen() would let you use read() instead of sigwaitinfo()
to retrieve lots of realtime signals at one go, AND would
protect your signal from being swiped by hostile code elsewhere
in the application, a la Sun's JDK.)
Upon further consideration, maybe I should model it after
/dev/epoll. That would get rid of nagging questions like
"but read() can't leave holes like sigtimedwait could",
and would be even higher performance than read()
(see graphs at http://www.xmailserver.org/linux-patches/nio-improve.html )
So I'm proposing the following user story:
// open a fd linked to signal mysignum
int fd = open("/dev/sigtimedwait", O_RDWR);
int sigs[1]; sigs[0] = mysignum;
write(fd, sigs, sizeof(sigs[0]));
// memory map a result buffer
struct siginfo_t *map = mmap(NULL, mapsize, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
for (;;) {
// grab recent siginfo_t's
struct devsiginfo dsi;
dsi.dsi_nsis = 1000;
dsi.dsi_sis = NULL; // NULL means "use map instead of buffer"
dsi.dsi_timeout = 1;
int nsis = ioctl(fd, DS_SIGTIMEDWAIT, &dvp);
// use 'em. Some might be completion notifications; some might be readiness notifications.
for (i=0; i<nsis; i++)
handle_siginfo(map+i);
}
Sure, the interface is crap, but it's fast, and at least it doesn't
add any syscalls (the sigopen() proposal required two new syscalls: sigopen()
and timedread()).
Comments?
BTW I'm halfway thru "Understanding the Linux Kernel" and it's
a very good read (modulo some strange lingo, e.g. "cycle" for "loop"
and "table" for "record" or "struct").
So since I only halfway understand the linux kernel, the above proposal
may be half baked.
- Dan
--
"I have seen the future, and it licks itself clean." -- Bucky Katt
next reply other threads:[~2001-08-04 1:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-04 1:32 Dan Kegel [this message]
2001-08-04 1:38 ` sigopen() vs. /dev/sigtimedwait Petru Paler
2001-08-04 2:10 ` Dan Kegel
2001-08-04 3:04 ` Could /dev/epoll deliver aio completion notifications? (was: Re: sigopen() vs. /dev/sigtimedwait) Dan Kegel
2001-08-04 5:18 ` Zach Brown
2001-08-04 6:27 ` Dan Kegel
2001-08-23 21:17 ` Could /dev/epoll deliver aio completion notifications? (was: Davide Libenzi
-- strict thread matches above, loose matches on Subject: below --
2001-08-07 14:20 sigopen() vs. /dev/sigtimedwait Erich Nahum
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=3B6B50C4.D9FBF398@kegel.com \
--to=dank@kegel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=me@toesinperil.com \
--cc=x@xman.org \
--cc=zab@zabbo.net \
/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