Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-11 Thread Linus Torvalds
On Sat, 10 Mar 2007, Nicholas Miell wrote: > > > > UNIX has pid's for "process" handles, and "file descriptors" for just > > about everything else. > > And I imagine that somebody will come up with way of getting a fd for a > process sooner or later. Well, /proc// is about as close as you

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-11 Thread Linus Torvalds
On Sat, 10 Mar 2007, Nicholas Miell wrote: UNIX has pid's for process handles, and file descriptors for just about everything else. And I imagine that somebody will come up with way of getting a fd for a process sooner or later. Well, /proc/pid/ is about as close as you get. And

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Sat, 2007-03-10 at 21:31 -0800, Linus Torvalds wrote: > > On Sat, 10 Mar 2007, Nicholas Miell wrote: > > > > Ah, I see. You're just interested in fds as a generic handle concept, > > and not a more Plan 9 type thing. > > Indeed. It's a "handle". > > UNIX has pid's for "process" handles, and

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Davide Libenzi
On Sat, 10 Mar 2007, Linus Torvalds wrote: > > Actually, the only place where I can find the itimerspec usefull, is > > indeed with TFD_TIMER_SEQ. In cases where you want you clock starting at a > > given time (it_value) *and* with the given frequency (it_interval). > > .. and this is where

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Linus Torvalds
On Sat, 10 Mar 2007, Davide Libenzi wrote: > On Sat, 10 Mar 2007, Linus Torvalds wrote: > > > (That said, using "struct itimerspec" might be a good idea. That would > > also obviate the need for TFD_TIMER_SEQ, since an itimerspec automatically > > has both "base" and "incremental" parts). >

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Linus Torvalds
On Sat, 10 Mar 2007, Nicholas Miell wrote: > > Ah, I see. You're just interested in fds as a generic handle concept, > and not a more Plan 9 type thing. Indeed. It's a "handle". UNIX has pid's for "process" handles, and "file descriptors" for just about everything else. > If that's the

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Davide Libenzi
On Sat, 10 Mar 2007, Linus Torvalds wrote: > (That said, using "struct itimerspec" might be a good idea. That would > also obviate the need for TFD_TIMER_SEQ, since an itimerspec automatically > has both "base" and "incremental" parts). But TFD_TIMER_SEQ is a simple auto-rearm case of

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Sat, 2007-03-10 at 17:57 -0800, Davide Libenzi wrote: > On Sat, 10 Mar 2007, Nicholas Miell wrote: > > > If that's the goal, somebody should start thinking about reducing the > > contents of struct file to the bare minimum (i.e. not much more than a > > file_operations pointer). > > That's

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Davide Libenzi
On Sat, 10 Mar 2007, Nicholas Miell wrote: > If that's the goal, somebody should start thinking about reducing the > contents of struct file to the bare minimum (i.e. not much more than a > file_operations pointer). That's already pretty smal, and the single inode (and maybe dentry) will make

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Sat, 2007-03-10 at 16:35 -0800, Linus Torvalds wrote: > > On Sat, 10 Mar 2007, Nicholas Miell wrote: > > > > > > I'd actually much rather do POSIX timers the other way around: associate > > > a > > > generic notification mechanism with the file descriptor, and then > > > implement

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Linus Torvalds
On Sat, 10 Mar 2007, Nicholas Miell wrote: > > > > I'd actually much rather do POSIX timers the other way around: associate a > > generic notification mechanism with the file descriptor, and then > > implement posix_timer_create() on top of timerfd. Now THAT sounds like a > > clean unix-like

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Sat, 2007-03-10 at 14:42 -0800, Linus Torvalds wrote: > > On Sat, 10 Mar 2007, Nicholas Miell wrote: > > > > Care to elaborate on why they're a horrible crock? > > It's a *classic* case of an interface that tries to do everything under > the sun. > > Here's a clue: look at any system call

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Linus Torvalds
On Sat, 10 Mar 2007, Nicholas Miell wrote: > > Care to elaborate on why they're a horrible crock? It's a *classic* case of an interface that tries to do everything under the sun. Here's a clue: look at any system call that takes a union as part of its arguments. Count them. I think we have

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Davide Libenzi
On Sat, 10 Mar 2007, Nicholas Miell wrote: > I never complained about one timer per fd (although, now that you > mention it, that would get a bit excessive if you have thousands of > outstanding timers). Right, of course. > > The real-time and monotonic selection can be added. > > IOW, the

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Sat, 2007-03-10 at 13:44 -0800, Linus Torvalds wrote: > > On Sat, 10 Mar 2007, Nicholas Miell wrote: > > > > That's what the sigevent structure is for -- to describe how events > > should be signaled to userspace, whether by signal delivery, thread > > creation, or queuing to event completion

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Linus Torvalds
On Sat, 10 Mar 2007, Nicholas Miell wrote: > > That's what the sigevent structure is for -- to describe how events > should be signaled to userspace, whether by signal delivery, thread > creation, or queuing to event completion ports. If if you think > extending it would be bad, I can show you

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Sat, 2007-03-10 at 12:41 -0800, Davide Libenzi wrote: > On Sat, 10 Mar 2007, Nicholas Miell wrote: > > > Try reading the timer_create man page. > > > > In short, you're limited to a single clock, so you can't set timers > > based on wall-clock time (subject to NTP correction), monotomic time

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Davide Libenzi
On Sat, 10 Mar 2007, Nicholas Miell wrote: > Try reading the timer_create man page. > > In short, you're limited to a single clock, so you can't set timers > based on wall-clock time (subject to NTP correction), monotomic time > (not subject to NTP, will not ever go backwards or skip ticks), the

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Fri, 2007-03-09 at 23:36 -0800, Davide Libenzi wrote: > On Fri, 9 Mar 2007, Nicholas Miell wrote: > > > On Fri, 2007-03-09 at 22:53 -0800, Davide Libenzi wrote: > > > On Fri, 9 Mar 2007, Nicholas Miell wrote: > > > > > > > > So extend the existing POSIX timer API to deliver expiry events via

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Fri, 2007-03-09 at 23:36 -0800, Davide Libenzi wrote: On Fri, 9 Mar 2007, Nicholas Miell wrote: On Fri, 2007-03-09 at 22:53 -0800, Davide Libenzi wrote: On Fri, 9 Mar 2007, Nicholas Miell wrote: So extend the existing POSIX timer API to deliver expiry events via a fd.

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Davide Libenzi
On Sat, 10 Mar 2007, Nicholas Miell wrote: Try reading the timer_create man page. In short, you're limited to a single clock, so you can't set timers based on wall-clock time (subject to NTP correction), monotomic time (not subject to NTP, will not ever go backwards or skip ticks), the

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Sat, 2007-03-10 at 12:41 -0800, Davide Libenzi wrote: On Sat, 10 Mar 2007, Nicholas Miell wrote: Try reading the timer_create man page. In short, you're limited to a single clock, so you can't set timers based on wall-clock time (subject to NTP correction), monotomic time (not

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Linus Torvalds
On Sat, 10 Mar 2007, Nicholas Miell wrote: That's what the sigevent structure is for -- to describe how events should be signaled to userspace, whether by signal delivery, thread creation, or queuing to event completion ports. If if you think extending it would be bad, I can show you the

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Sat, 2007-03-10 at 13:44 -0800, Linus Torvalds wrote: On Sat, 10 Mar 2007, Nicholas Miell wrote: That's what the sigevent structure is for -- to describe how events should be signaled to userspace, whether by signal delivery, thread creation, or queuing to event completion ports. If

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Davide Libenzi
On Sat, 10 Mar 2007, Nicholas Miell wrote: I never complained about one timer per fd (although, now that you mention it, that would get a bit excessive if you have thousands of outstanding timers). Right, of course. The real-time and monotonic selection can be added. IOW, the timerfd

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Linus Torvalds
On Sat, 10 Mar 2007, Nicholas Miell wrote: Care to elaborate on why they're a horrible crock? It's a *classic* case of an interface that tries to do everything under the sun. Here's a clue: look at any system call that takes a union as part of its arguments. Count them. I think we have

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Sat, 2007-03-10 at 14:42 -0800, Linus Torvalds wrote: On Sat, 10 Mar 2007, Nicholas Miell wrote: Care to elaborate on why they're a horrible crock? It's a *classic* case of an interface that tries to do everything under the sun. Here's a clue: look at any system call that takes

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Linus Torvalds
On Sat, 10 Mar 2007, Nicholas Miell wrote: I'd actually much rather do POSIX timers the other way around: associate a generic notification mechanism with the file descriptor, and then implement posix_timer_create() on top of timerfd. Now THAT sounds like a clean unix-like interface

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Sat, 2007-03-10 at 16:35 -0800, Linus Torvalds wrote: On Sat, 10 Mar 2007, Nicholas Miell wrote: I'd actually much rather do POSIX timers the other way around: associate a generic notification mechanism with the file descriptor, and then implement posix_timer_create() on

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Davide Libenzi
On Sat, 10 Mar 2007, Nicholas Miell wrote: If that's the goal, somebody should start thinking about reducing the contents of struct file to the bare minimum (i.e. not much more than a file_operations pointer). That's already pretty smal, and the single inode (and maybe dentry) will make it

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Sat, 2007-03-10 at 17:57 -0800, Davide Libenzi wrote: On Sat, 10 Mar 2007, Nicholas Miell wrote: If that's the goal, somebody should start thinking about reducing the contents of struct file to the bare minimum (i.e. not much more than a file_operations pointer). That's already

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Davide Libenzi
On Sat, 10 Mar 2007, Linus Torvalds wrote: (That said, using struct itimerspec might be a good idea. That would also obviate the need for TFD_TIMER_SEQ, since an itimerspec automatically has both base and incremental parts). But TFD_TIMER_SEQ is a simple auto-rearm case of TFD_TIMER_REL. So

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Linus Torvalds
On Sat, 10 Mar 2007, Nicholas Miell wrote: Ah, I see. You're just interested in fds as a generic handle concept, and not a more Plan 9 type thing. Indeed. It's a handle. UNIX has pid's for process handles, and file descriptors for just about everything else. If that's the goal, somebody

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Linus Torvalds
On Sat, 10 Mar 2007, Davide Libenzi wrote: On Sat, 10 Mar 2007, Linus Torvalds wrote: (That said, using struct itimerspec might be a good idea. That would also obviate the need for TFD_TIMER_SEQ, since an itimerspec automatically has both base and incremental parts). But

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Davide Libenzi
On Sat, 10 Mar 2007, Linus Torvalds wrote: Actually, the only place where I can find the itimerspec usefull, is indeed with TFD_TIMER_SEQ. In cases where you want you clock starting at a given time (it_value) *and* with the given frequency (it_interval). .. and this is where itimerspec

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-10 Thread Nicholas Miell
On Sat, 2007-03-10 at 21:31 -0800, Linus Torvalds wrote: On Sat, 10 Mar 2007, Nicholas Miell wrote: Ah, I see. You're just interested in fds as a generic handle concept, and not a more Plan 9 type thing. Indeed. It's a handle. UNIX has pid's for process handles, and file

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Davide Libenzi
On Fri, 9 Mar 2007, Nicholas Miell wrote: > On Fri, 2007-03-09 at 22:53 -0800, Davide Libenzi wrote: > > On Fri, 9 Mar 2007, Nicholas Miell wrote: > > > > > > So extend the existing POSIX timer API to deliver expiry events via a > > > fd. > > > > It'll be out of standard as timerfd is, w/out

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Nicholas Miell
On Fri, 2007-03-09 at 22:53 -0800, Davide Libenzi wrote: > On Fri, 9 Mar 2007, Nicholas Miell wrote: > > > On Fri, 2007-03-09 at 22:38 -0800, Davide Libenzi wrote: > > > On Fri, 9 Mar 2007, Nicholas Miell wrote: > > > > > > > Why did you ignore the existing POSIX timer API? > > > > > > The

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Davide Libenzi
On Fri, 9 Mar 2007, Nicholas Miell wrote: > On Fri, 2007-03-09 at 22:38 -0800, Davide Libenzi wrote: > > On Fri, 9 Mar 2007, Nicholas Miell wrote: > > > > > Why did you ignore the existing POSIX timer API? > > > > The existing POSIX API is a standard and a very good one. Too bad it does > >

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Nicholas Miell
On Fri, 2007-03-09 at 22:38 -0800, Davide Libenzi wrote: > On Fri, 9 Mar 2007, Nicholas Miell wrote: > > > Why did you ignore the existing POSIX timer API? > > The existing POSIX API is a standard and a very good one. Too bad it does > not deliver to files. The timerfd code is, as you can

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Davide Libenzi
On Fri, 9 Mar 2007, Nicholas Miell wrote: > Why did you ignore the existing POSIX timer API? The existing POSIX API is a standard and a very good one. Too bad it does not deliver to files. The timerfd code is, as you can probably read from the code, a really thin wrapper around the existing

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Nicholas Miell
On Fri, 2007-03-09 at 15:41 -0800, Davide Libenzi wrote: > This patch introduces a new system call for timers events delivered > though file descriptors. This allows timer event to be used with > standard POSIX poll(2), select(2) and read(2). As a consequence of > supporting the Linux f_op->poll

[patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Davide Libenzi
This patch introduces a new system call for timers events delivered though file descriptors. This allows timer event to be used with standard POSIX poll(2), select(2) and read(2). As a consequence of supporting the Linux f_op->poll subsystem, they can be used with epoll(2) too. The system call is

[patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Davide Libenzi
This patch introduces a new system call for timers events delivered though file descriptors. This allows timer event to be used with standard POSIX poll(2), select(2) and read(2). As a consequence of supporting the Linux f_op-poll subsystem, they can be used with epoll(2) too. The system call is

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Nicholas Miell
On Fri, 2007-03-09 at 15:41 -0800, Davide Libenzi wrote: This patch introduces a new system call for timers events delivered though file descriptors. This allows timer event to be used with standard POSIX poll(2), select(2) and read(2). As a consequence of supporting the Linux f_op-poll

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Davide Libenzi
On Fri, 9 Mar 2007, Nicholas Miell wrote: Why did you ignore the existing POSIX timer API? The existing POSIX API is a standard and a very good one. Too bad it does not deliver to files. The timerfd code is, as you can probably read from the code, a really thin wrapper around the existing

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Nicholas Miell
On Fri, 2007-03-09 at 22:38 -0800, Davide Libenzi wrote: On Fri, 9 Mar 2007, Nicholas Miell wrote: Why did you ignore the existing POSIX timer API? The existing POSIX API is a standard and a very good one. Too bad it does not deliver to files. The timerfd code is, as you can probably

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Davide Libenzi
On Fri, 9 Mar 2007, Nicholas Miell wrote: On Fri, 2007-03-09 at 22:38 -0800, Davide Libenzi wrote: On Fri, 9 Mar 2007, Nicholas Miell wrote: Why did you ignore the existing POSIX timer API? The existing POSIX API is a standard and a very good one. Too bad it does not deliver to

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Nicholas Miell
On Fri, 2007-03-09 at 22:53 -0800, Davide Libenzi wrote: On Fri, 9 Mar 2007, Nicholas Miell wrote: On Fri, 2007-03-09 at 22:38 -0800, Davide Libenzi wrote: On Fri, 9 Mar 2007, Nicholas Miell wrote: Why did you ignore the existing POSIX timer API? The existing POSIX API is a

Re: [patch 6/9] signalfd/timerfd v1 - timerfd core ...

2007-03-09 Thread Davide Libenzi
On Fri, 9 Mar 2007, Nicholas Miell wrote: On Fri, 2007-03-09 at 22:53 -0800, Davide Libenzi wrote: On Fri, 9 Mar 2007, Nicholas Miell wrote: So extend the existing POSIX timer API to deliver expiry events via a fd. It'll be out of standard as timerfd is, w/out code savings. Look