From: Davide Libenzi <davidel@xmailserver.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "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, 8 Mar 2007 11:21:18 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0703081113060.7515@alien.or.mcafeemobile.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0703080852170.10832@woody.linux-foundation.org>
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 it), but when you have
> > to transfer complex structures over it, it becomes hell. How do you
> > cleanly compat over a f_op->read callback for example?
>
> I agree that it gets a bit "interesting", and one option might be that the
> "read()" interface just gets the signal number and the minimal siginfo
> information, which is, after all, what 99% of all apps actually care
> about.
>
> But "siginfo_t" is really a *horrible* structure. Nobody sane should ever
> use siginfo_t, and the designer of that thing was so high on LSD that it's
> not even funny. Re-using fields in a union? Values that depend on other
> bits in the thing in random manners?
>
> In other words, I bet that we could just make it a *lot* better by making
> the read structure be:
>
> - 16 4-byte fields (fixed 64-byte packet), where each field is an
> uint32_t (we could even do it in network byte order if we care and if
> you want to just pipe the information from one machine to another, but
> that sounds a bit excessive ;)
>
> - Just put the fields people actually use at fixed offsets: si_signo,
> si_errno, si_pid, si_uid, si_band, si_fd.
>
> - that still leaves room for the other cases if anybody ever wants them
> (but I doubt it - things like si_addr are really only useful for
> synchronous signals that are actually done as *signals*, since you
> cannot defer a SIGBUS/SIGSEGV/SIGILL *anyway*).
>
> So I bet 99% of users actually just want si_signo, while some small subset
> might want the SIGCHLD info and some of the special cases (eg we migth
> want to add si_addr as a 64-bit thing just because the USB stack sends a
> SI_ASYNCIO thing for completed URB's, so a libusb might want it, but
> that's probably the only such user).
>
> And it would be *cleaner* than the mess that is siginfo_t..
>
> (I realize that siginfo_t is ugly because it built up over time, using the
> same buffer for many different things. I'm just saying that we can
> probably do better by *not* using it, and just laying things out in a
> cleaner manner to begin with, which also solves any compatibility issues)
I can do that, no problem. But isn't it better to recognize that this kind
of data just can't be shipped through a non compat-able function?
Like, for example, the current trend to say "just use u64 for a pointer,
it'll be fine". I remeber, a long time ago when the i386 architecture came
out, to say "Wow! 4GB is gonna last *forever*!", let's use u32 for
pointers. Well, forever is almost here in my watches. And all the
userspace code using APIs assuming to cleanly store a pointer in a u32
will have to be re-factored.
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?
- Davide
next prev parent reply other threads:[~2007-03-08 19:21 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-08 1:21 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 [this message]
2007-03-08 19:27 ` Linus Torvalds
2007-03-08 19:33 ` Davide Libenzi
2007-03-08 20:48 ` Marko Macek
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
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=Pine.LNX.4.64.0703081113060.7515@alien.or.mcafeemobile.com \
--to=davidel@xmailserver.org \
--cc=akpm@linux-foundation.org \
--cc=dmlloyd@flurg.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®