All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Davi Arnaut <davi@haxent.com.br>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] signalfd: retrieve multiple signals with one read() call
Date: Sun, 20 May 2007 22:12:32 -0700	[thread overview]
Message-ID: <20070520221232.1c0aab31.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0705202146560.22011@alien.or.mcafeemobile.com>

On Sun, 20 May 2007 22:05:00 -0700 (PDT) Davide Libenzi <davidel@xmailserver.org> wrote:

> On Sun, 20 May 2007, Andrew Morton wrote:
> 
> > > I think it fits the rule "buffer must be big enough for at least one sigingo".
> > > We use the special return 0; as indicator that the process we were 
> > > monitoring signals, detached the sighand.
> > > 
> > 
> > hm.  Kernel violates proper read() semantics in many places.  Looks like we
> > just did it again.
> 
> I think we can have the check that "if size == 0 return 0". The above 
> cited return-0-on-detch would still apply for enough sized buffers. So:
> 
> 1) size == 0, return 0 (POSIX wants this)
> 
> 2) size < sizeof(signalfd_siginfo), return EINVAL
> 
> 3) size >= sizeof(signalfd_siginfo) && DETACH, return 0
> 
> The signalfd falls into what POSIX defined as "special file", and can 
> return a lower-than-size result.
> 

hm, well.  I'd suggest that we do what makes most sense, rather than
warping things to try to obey the letter of posix.

> 
> > Unless we just remove the __clear_user() altogether.  Who said that "Unused
> > memebers should be zero"?
> 
> Because it is a typically used value for still-unused/reserved members? 
> Better than random values I think ;)
> Members validity is driven by si_code & SI_MASK anyway.

Sure.  And it'd be a bit rude to return 128 from the read() but to only
have written to a few bytes of the user's memory.

otoh, only-writing-a-few-bytes will be usefully quicker than zapping the
whole 128b, particularly on small-cacheline CPUs.


      reply	other threads:[~2007-05-21  5:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-20  0:07 [PATCH] signalfd: retrieve multiple signals with one read() call Davi Arnaut
2007-05-20 19:17 ` Davide Libenzi
2007-05-21  4:02 ` Andrew Morton
2007-05-21  4:14   ` Davide Libenzi
2007-05-21  4:20     ` Davide Libenzi
2007-05-21  4:26     ` Andrew Morton
2007-05-21  5:05       ` Davide Libenzi
2007-05-21  5:12         ` Andrew Morton [this message]

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=20070520221232.1c0aab31.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davi@haxent.com.br \
    --cc=davidel@xmailserver.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.