public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* sigopen() vs. /dev/sigtimedwait
@ 2001-08-04  1:32 Dan Kegel
  2001-08-04  1:38 ` Petru Paler
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Kegel @ 2001-08-04  1:32 UTC (permalink / raw)
  To: Christopher Smith, linux-kernel@vger.kernel.org
  Cc: Michael Elkins, Zach Brown

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

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

end of thread, other threads:[~2001-08-23 21:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-04  1:32 sigopen() vs. /dev/sigtimedwait Dan Kegel
2001-08-04  1:38 ` 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

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