Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-30 Thread Denis Vlasenko
On Thursday 08 March 2007 18:28, Linus Torvalds wrote: > The sad part is that there really is no reason why the BSD crowd couldn't > have done recvmsg() as an "extended read with per-system call flags", > which would have made things like O_NONBLOCK etc unnecessary, because you > could do it

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-30 Thread Denis Vlasenko
On Thursday 08 March 2007 18:28, Linus Torvalds wrote: The sad part is that there really is no reason why the BSD crowd couldn't have done recvmsg() as an extended read with per-system call flags, which would have made things like O_NONBLOCK etc unnecessary, because you could do it just

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-09 Thread Davide Libenzi
On Thu, 8 Mar 2007, David M. Lloyd wrote: > On Wed, 2007-03-07 at 17:21 -0800, Davide Libenzi wrote: > > int signalfd_dequeue(int fd, siginfo_t *info, long timeo); > > > > The "fd" parameter must ba a signalfd file descriptor. The "info" parameter > > is a pointer to the siginfo that will

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-09 Thread Kent Overstreet
On 3/8/07, Linus Torvalds <[EMAIL PROTECTED]> wrote: Which is why you introduced a new system call, but that leads to all the problems with the file descriptor no longer being *usable*. Think scripts. It's easy to do reads in perl scripts, and parse the output. In contrast, making perl use a

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-09 Thread Kent Overstreet
On 3/8/07, Linus Torvalds [EMAIL PROTECTED] wrote: Which is why you introduced a new system call, but that leads to all the problems with the file descriptor no longer being *usable*. Think scripts. It's easy to do reads in perl scripts, and parse the output. In contrast, making perl use a new

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-09 Thread Davide Libenzi
On Thu, 8 Mar 2007, David M. Lloyd wrote: On Wed, 2007-03-07 at 17:21 -0800, Davide Libenzi wrote: int signalfd_dequeue(int fd, siginfo_t *info, long timeo); The fd parameter must ba a signalfd file descriptor. The info parameter is a pointer to the siginfo that will receive the

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Fri, 9 Mar 2007, Oleg Nesterov wrote: > Ugh. Still can't understand, probably I missed something or misread this > patch. > > If we shift signalfd_notify() from > specific_send_sig_info/__group_send_sig_info > to send_signal(), we have the same "list_empty()" fastpath if no signalfds are >

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Oleg Nesterov
On 03/08, Davide Libenzi wrote: > > On Fri, 9 Mar 2007, Oleg Nesterov wrote: > > > > Logic is, if it's not an RT signal, queue only one, otherwise multiple. > > > The bit on the ->pending mask is clealer only when the queue slot becomes > > > empty. > > > > Yes, I see what the code does, but I

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Linus Torvalds
On Thu, 8 Mar 2007, Jeremy Fitzhardinge wrote: > > The difficulty is that there are 4 different formats of signal structure > you could get: (traditional|siginfo) x (32bit|64bit). See my suggestion of a fixed-format (and much cleaned up) pseudo-siginfo thing earlier in this thread, and also

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Jeremy Fitzhardinge
Linus Torvalds wrote: > So I think you should get rid of signalfd_dequeue(), and just replace it > with a "read()" function. > The difficulty is that there are 4 different formats of signal structure you could get: (traditional|siginfo) x (32bit|64bit). What happens if you're a 32 bit

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Fri, 9 Mar 2007, Oleg Nesterov wrote: > > Logic is, if it's not an RT signal, queue only one, otherwise multiple. > > The bit on the ->pending mask is clealer only when the queue slot becomes > > empty. > > Yes, I see what the code does, but I don't undestand why. For example, > SIGCHLD was

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, Linus Torvalds wrote: > > > On Fri, 9 Mar 2007, Oleg Nesterov wrote: > > > > Also. A malicious user can eat all memory, > > signalfd_deliver()->kmem_cache_alloc() > > doesn't check any limits. > > This, btw, is one reason I *really* think signalfd() should just use the >

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Linus Torvalds
On Fri, 9 Mar 2007, Oleg Nesterov wrote: > > Also. A malicious user can eat all memory, > signalfd_deliver()->kmem_cache_alloc() > doesn't check any limits. This, btw, is one reason I *really* think signalfd() should just use the same old signal queue, and not try to make its own. Signal

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Oleg Nesterov
On 03/08, Davide Libenzi wrote: > > On Thu, 8 Mar 2007, Oleg Nesterov wrote: > > > Davide Libenzi wrote: > > > > > > +int signalfd_deliver(struct sighand_struct *sighand, int sig, struct > > > siginfo *info) > > > +{ > > > + int nsig = 0; > > > + struct list_head *pos; > > > + struct

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Marko Macek
Linus Torvalds wrote: On Thu, 8 Mar 2007, Davide Libenzi wrote: So, to cut it short, I can do the pseudo-siginfo read(2), but I don't like it too much (little, actually). The siginfo, as bad as it is, is a standard used in many POSIX APIs (hence even in kernel), and IMO if we want to send

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, Oleg Nesterov wrote: > Davide Libenzi wrote: > > > > +int signalfd_deliver(struct sighand_struct *sighand, int sig, struct > > siginfo *info) > > +{ > > + int nsig = 0; > > + struct list_head *pos; > > + struct signalfd_ctx *ctx; > > + struct signalfd_sq *sq; > > + >

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Marko Macek
Linus Torvalds wrote: On Thu, 8 Mar 2007, Davide Libenzi wrote: So, to cut it short, I can do the pseudo-siginfo read(2), but I don't like it too much (little, actually). The siginfo, as bad as it is, is a standard used in many POSIX APIs (hence even in kernel), and IMO if we want to send

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Michael K. Edwards
On 3/8/07, Linus Torvalds <[EMAIL PROTECTED]> wrote: So anybody who would "go with the Berkeley crowd" really shows a lot of bad taste, I'm afraid. The Berkeley crowd really messed up here, and it's so long ago that I don't think there is any point in us trying to fix it any more. Well, they

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Oleg Nesterov
Davide Libenzi wrote: > > +int signalfd_deliver(struct sighand_struct *sighand, int sig, struct siginfo > *info) > +{ > + int nsig = 0; > + struct list_head *pos; > + struct signalfd_ctx *ctx; > + struct signalfd_sq *sq; > + > + list_for_each(pos, >sfdlist) { > +

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, Avi Kivity wrote: > Davide Libenzi wrote: > > So, to cut it short, I can do the pseudo-siginfo read(2), but I don't like > > it too much (little, actually). The siginfo, as bad as it is, is a standard > > used in many POSIX APIs (hence even in kernel), and IMO if we want to

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Avi Kivity
Davide Libenzi wrote: So, to cut it short, I can do the pseudo-siginfo read(2), but I don't like it too much (little, actually). The siginfo, as bad as it is, is a standard used in many POSIX APIs (hence even in kernel), and IMO if we want to send that back, a struct siginfo should be.

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, Linus Torvalds wrote: > > > On Thu, 8 Mar 2007, Davide Libenzi wrote: > > > > So, to cut it short, I can do the pseudo-siginfo read(2), but I don't > > like it too much (little, actually). The siginfo, as bad as it is, is a > > standard used in many POSIX APIs (hence even

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Linus Torvalds
On Thu, 8 Mar 2007, Davide Libenzi wrote: > > So, to cut it short, I can do the pseudo-siginfo read(2), but I don't > like it too much (little, actually). The siginfo, as bad as it is, is a > standard used in many POSIX APIs (hence even in kernel), and IMO if we > want to send that back, a

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, Linus Torvalds wrote: > > > On Thu, 8 Mar 2007, Davide Libenzi wrote: > > > > The reason for the special function, was not to provide a non-blocking > > behaviour with zero timeout (that just a side effect), but to read the > > siginfo. I was all about using read(2) (and

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Linus Torvalds
On Thu, 8 Mar 2007, Michael K. Edwards wrote: > > Make it a netlink socket and fetch your structures using recvmsg(). > siginfo_t belongs in ancillary data. Gaah. That interface is horrible. > The UNIX philosophy is "everything's a file". The Berkeley philosophy > is "everything's a socket,

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Linus Torvalds
On Thu, 8 Mar 2007, Davide Libenzi wrote: > > The reason for the special function, was not to provide a non-blocking > behaviour with zero timeout (that just a side effect), but to read the > siginfo. I was all about using read(2) (and v1 used it), but when you have > to transfer complex

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Michael K. Edwards
On 3/8/07, Davide Libenzi wrote: The reason for the special function, was not to provide a non-blocking behaviour with zero timeout (that just a side effect), but to read the siginfo. I was all about using read(2) (and v1 used it), but when you have to transfer complex structures over it, it

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, Linus Torvalds wrote: > You missed David's worry, I think. > > Not only is POLLIN potentially an edge event (depending on the interface > you use to fetch it), but even as a level-triggered one you generally want > to read as much as possible per POLLIN event, and go back

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Linus Torvalds
On Thu, 8 Mar 2007, Davide Libenzi wrote: > > This patch, if you get a POLLIN, you have a signal to read for sure (well, > unless you another thread/task reads it before you - but that's just > somthing you have to take care). There is not explicit check for > O_NONBLOCK now, but a zero

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, David M. Lloyd wrote: > On Wed, 2007-03-07 at 17:21 -0800, Davide Libenzi wrote: > > int signalfd_dequeue(int fd, siginfo_t *info, long timeo); > > > > The "fd" parameter must ba a signalfd file descriptor. The "info" parameter > > is a pointer to the siginfo that will

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread David M. Lloyd
On Wed, 2007-03-07 at 17:21 -0800, Davide Libenzi wrote: > int signalfd_dequeue(int fd, siginfo_t *info, long timeo); > > The "fd" parameter must ba a signalfd file descriptor. The "info" parameter > is a pointer to the siginfo that will receive the dequeued signal, and > "timeo" is a timeout in

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, David M. Lloyd wrote: On Wed, 2007-03-07 at 17:21 -0800, Davide Libenzi wrote: int signalfd_dequeue(int fd, siginfo_t *info, long timeo); The fd parameter must ba a signalfd file descriptor. The info parameter is a pointer to the siginfo that will receive the

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Linus Torvalds
On Thu, 8 Mar 2007, Davide Libenzi wrote: This patch, if you get a POLLIN, you have a signal to read for sure (well, unless you another thread/task reads it before you - but that's just somthing you have to take care). There is not explicit check for O_NONBLOCK now, but a zero timeout

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, Linus Torvalds wrote: You missed David's worry, I think. Not only is POLLIN potentially an edge event (depending on the interface you use to fetch it), but even as a level-triggered one you generally want to read as much as possible per POLLIN event, and go back to the

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Michael K. Edwards
On 3/8/07, Davide Libenzi davidel@xmailserver.org wrote: The reason for the special function, was not to provide a non-blocking behaviour with zero timeout (that just a side effect), but to read the siginfo. I was all about using read(2) (and v1 used it), but when you have to transfer complex

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Linus Torvalds
On Thu, 8 Mar 2007, Davide Libenzi wrote: The reason for the special function, was not to provide a non-blocking behaviour with zero timeout (that just a side effect), but to read the siginfo. I was all about using read(2) (and v1 used it), but when you have to transfer complex

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Linus Torvalds
On Thu, 8 Mar 2007, Michael K. Edwards wrote: Make it a netlink socket and fetch your structures using recvmsg(). siginfo_t belongs in ancillary data. Gaah. That interface is horrible. The UNIX philosophy is everything's a file. The Berkeley philosophy is everything's a socket, except

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, Linus Torvalds wrote: On Thu, 8 Mar 2007, Davide Libenzi wrote: The reason for the special function, was not to provide a non-blocking behaviour with zero timeout (that just a side effect), but to read the siginfo. I was all about using read(2) (and v1 used

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Linus Torvalds
On Thu, 8 Mar 2007, Davide Libenzi wrote: So, to cut it short, I can do the pseudo-siginfo read(2), but I don't like it too much (little, actually). The siginfo, as bad as it is, is a standard used in many POSIX APIs (hence even in kernel), and IMO if we want to send that back, a struct

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, Linus Torvalds wrote: On Thu, 8 Mar 2007, Davide Libenzi wrote: So, to cut it short, I can do the pseudo-siginfo read(2), but I don't like it too much (little, actually). The siginfo, as bad as it is, is a standard used in many POSIX APIs (hence even in kernel),

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Avi Kivity
Davide Libenzi wrote: So, to cut it short, I can do the pseudo-siginfo read(2), but I don't like it too much (little, actually). The siginfo, as bad as it is, is a standard used in many POSIX APIs (hence even in kernel), and IMO if we want to send that back, a struct siginfo should be.

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, Avi Kivity wrote: Davide Libenzi wrote: So, to cut it short, I can do the pseudo-siginfo read(2), but I don't like it too much (little, actually). The siginfo, as bad as it is, is a standard used in many POSIX APIs (hence even in kernel), and IMO if we want to send

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Oleg Nesterov
Davide Libenzi wrote: +int signalfd_deliver(struct sighand_struct *sighand, int sig, struct siginfo *info) +{ + int nsig = 0; + struct list_head *pos; + struct signalfd_ctx *ctx; + struct signalfd_sq *sq; + + list_for_each(pos, sighand-sfdlist) { + ctx =

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Michael K. Edwards
On 3/8/07, Linus Torvalds [EMAIL PROTECTED] wrote: So anybody who would go with the Berkeley crowd really shows a lot of bad taste, I'm afraid. The Berkeley crowd really messed up here, and it's so long ago that I don't think there is any point in us trying to fix it any more. Well, they did

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Marko Macek
Linus Torvalds wrote: On Thu, 8 Mar 2007, Davide Libenzi wrote: So, to cut it short, I can do the pseudo-siginfo read(2), but I don't like it too much (little, actually). The siginfo, as bad as it is, is a standard used in many POSIX APIs (hence even in kernel), and IMO if we want to send

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, Oleg Nesterov wrote: Davide Libenzi wrote: +int signalfd_deliver(struct sighand_struct *sighand, int sig, struct siginfo *info) +{ + int nsig = 0; + struct list_head *pos; + struct signalfd_ctx *ctx; + struct signalfd_sq *sq; + +

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Marko Macek
Linus Torvalds wrote: On Thu, 8 Mar 2007, Davide Libenzi wrote: So, to cut it short, I can do the pseudo-siginfo read(2), but I don't like it too much (little, actually). The siginfo, as bad as it is, is a standard used in many POSIX APIs (hence even in kernel), and IMO if we want to send

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Oleg Nesterov
On 03/08, Davide Libenzi wrote: On Thu, 8 Mar 2007, Oleg Nesterov wrote: Davide Libenzi wrote: +int signalfd_deliver(struct sighand_struct *sighand, int sig, struct siginfo *info) +{ + int nsig = 0; + struct list_head *pos; + struct signalfd_ctx *ctx; + struct

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Linus Torvalds
On Fri, 9 Mar 2007, Oleg Nesterov wrote: Also. A malicious user can eat all memory, signalfd_deliver()-kmem_cache_alloc() doesn't check any limits. This, btw, is one reason I *really* think signalfd() should just use the same old signal queue, and not try to make its own. Signal

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Thu, 8 Mar 2007, Linus Torvalds wrote: On Fri, 9 Mar 2007, Oleg Nesterov wrote: Also. A malicious user can eat all memory, signalfd_deliver()-kmem_cache_alloc() doesn't check any limits. This, btw, is one reason I *really* think signalfd() should just use the same old

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Fri, 9 Mar 2007, Oleg Nesterov wrote: Logic is, if it's not an RT signal, queue only one, otherwise multiple. The bit on the -pending mask is clealer only when the queue slot becomes empty. Yes, I see what the code does, but I don't undestand why. For example, SIGCHLD was

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Jeremy Fitzhardinge
Linus Torvalds wrote: So I think you should get rid of signalfd_dequeue(), and just replace it with a read() function. The difficulty is that there are 4 different formats of signal structure you could get: (traditional|siginfo) x (32bit|64bit). What happens if you're a 32 bit process,

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Linus Torvalds
On Thu, 8 Mar 2007, Jeremy Fitzhardinge wrote: The difficulty is that there are 4 different formats of signal structure you could get: (traditional|siginfo) x (32bit|64bit). See my suggestion of a fixed-format (and much cleaned up) pseudo-siginfo thing earlier in this thread, and also

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Oleg Nesterov
On 03/08, Davide Libenzi wrote: On Fri, 9 Mar 2007, Oleg Nesterov wrote: Logic is, if it's not an RT signal, queue only one, otherwise multiple. The bit on the -pending mask is clealer only when the queue slot becomes empty. Yes, I see what the code does, but I don't undestand

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread Davide Libenzi
On Fri, 9 Mar 2007, Oleg Nesterov wrote: Ugh. Still can't understand, probably I missed something or misread this patch. If we shift signalfd_notify() from specific_send_sig_info/__group_send_sig_info to send_signal(), we have the same list_empty() fastpath if no signalfds are attached

Re: [patch 2/5] signalfd v2 - signalfd core ...

2007-03-08 Thread David M. Lloyd
On Wed, 2007-03-07 at 17:21 -0800, Davide Libenzi wrote: int signalfd_dequeue(int fd, siginfo_t *info, long timeo); The fd parameter must ba a signalfd file descriptor. The info parameter is a pointer to the siginfo that will receive the dequeued signal, and timeo is a timeout in