From: Marko Macek <Marko.Macek@gmx.net>
To: linux-kernel@vger.kernel.org
Cc: Davide Libenzi <davidel@xmailserver.org>,
"David M. Lloyd" <dmlloyd@flurg.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [patch 2/5] signalfd v2 - signalfd core ...
Date: Thu, 08 Mar 2007 21:48:24 +0100 [thread overview]
Message-ID: <45F07698.1010502@gmx.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0703081123210.10832@woody.linux-foundation.org>
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 that back, a struct siginfo should be.
>> No?
>
> I think it's perfectly fine if you make it "struct siginfo" (even though I
> think it's a singularly ugly struct). It's just that then you'd have to
> make your read() know whether it's a compat-read or not, which you really
> can't.
>
> 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 system call is quite
> challenging.
Probably, but someone will have to add the 'signalfd' system call anyway.
> And *that* is why "everything is a stream of bytes" is so important. You
> don't know where the file descriptor has been, or who uses it. Special
> system calls for special file descriptors are just *wrong*.
>
> After all, that's why we'd have a signalfd() in the first place: exactly
> so that you do *not* have to use special system calls, but can just pass
> it on to any event waiting mechanism like select, poll, epoll. The same is
> just *even*more*true* when it comes to reading the data!
The problem with read() returning arbitrary unstructured data is that
there is hard to do versioning/extensibility, since the userspace can't
specify the requested/expected format. The only way it could be done is
by the (nbytes) parameter to read() which is not very nice (and useless
for scripts).
This is the same problem that makes sysfs/procfs fragile unless the
file format is very well specified for extensibility (and it's easy to
f-it up, since there seems to be little consistency there... using
the XML horror would actually be an improvement). Breaking sysfs/procfs
might be acceptable once every few years, but signal handling will be
part of every application event loop and there is no room for breaking
anything.
(although, one could to the versioning the ugly way by creating the new
'signalfd' syscall instead).
I'd say: make read() return the signal number (probably as 4-byte int,
in network byte order), but for everything else, use the system call.
Mark
P.S. I'm currently worried if the fact that FUTEX_FD is being deprecated
is a problem :)
next prev parent reply other threads:[~2007-03-08 21:25 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-08 1:21 [patch 2/5] signalfd v2 - signalfd core Davide Libenzi
2007-03-08 14:31 ` David M. Lloyd
2007-03-08 15:45 ` Davide Libenzi
2007-03-08 16:22 ` Linus Torvalds
2007-03-08 16:29 ` Davide Libenzi
2007-03-08 16:40 ` Michael K. Edwards
2007-03-08 17:28 ` Linus Torvalds
2007-03-08 20:53 ` Michael K. Edwards
2007-03-30 23:24 ` Denis Vlasenko
2007-03-08 17:15 ` Linus Torvalds
2007-03-08 19:21 ` Davide Libenzi
2007-03-08 19:27 ` Linus Torvalds
2007-03-08 19:33 ` Davide Libenzi
2007-03-08 20:48 ` Marko Macek [this message]
2007-03-08 21:03 ` Marko Macek
2007-03-09 20:22 ` Kent Overstreet
2007-03-08 19:34 ` Avi Kivity
2007-03-08 19:40 ` Davide Libenzi
2007-03-08 23:57 ` Jeremy Fitzhardinge
2007-03-09 0:10 ` Linus Torvalds
2007-03-09 21:33 ` Davide Libenzi
-- strict thread matches above, loose matches on Subject: below --
2007-03-08 20:43 Oleg Nesterov
2007-03-08 21:12 ` Davide Libenzi
2007-03-08 21:56 ` Oleg Nesterov
2007-03-08 22:11 ` Linus Torvalds
2007-03-08 22:59 ` Davide Libenzi
2007-03-08 23:05 ` Davide Libenzi
2007-03-09 0:14 ` Oleg Nesterov
2007-03-09 1:16 ` Davide Libenzi
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=45F07698.1010502@gmx.net \
--to=marko.macek@gmx.net \
--cc=akpm@linux-foundation.org \
--cc=davidel@xmailserver.org \
--cc=dmlloyd@flurg.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