All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bill Davidsen <davidsen@tmr.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] waitid system call
Date: Tue, 31 Aug 2004 11:53:12 -0400	[thread overview]
Message-ID: <ch26fb$8ps$1@gatekeeper.tmr.com> (raw)
In-Reply-To: <20040830234057.2bdec761.akpm@osdl.org>

Andrew Morton wrote:
> Jakub Jelinek <jakub@redhat.com> wrote:
> 
>>On Mon, Aug 30, 2004 at 11:04:46PM -0700, Roland McGrath wrote:
>> > +			/*
>> > +			 * For a WNOHANG return, clear out all the fields
>> > +			 * we would set so the user can easily tell the
>> > +			 * difference.
>> > +			 */
>> > +			if (!retval)
>> > +				retval = put_user(0, &infop->si_signo);
>> > +			if (!retval)
>> > +				retval = put_user(0, &infop->si_errno);
>> > +			if (!retval)
>> > +				retval = put_user(0, &infop->si_code);
>> > +			if (!retval)
>> > +				retval = put_user(0, &infop->si_pid);
>> > +			if (!retval)
>> > +				retval = put_user(0, &infop->si_uid);
>> > +			if (!retval)
>> > +				retval = put_user(0, &infop->si_status);
>>
>> Is it really necessary to check the exit code after each put_user?
>> 	if (!retval && access_ok(VERIFY_WRITE, infop, sizeof(*infop)))) {
>> 		retval = __put_user(0, &infop->si_signo);
>> 		retval |= __put_user(0, &infop->si_errno);
>> 		retval |= __put_user(0, &infop->si_code);
>> 		retval |= __put_user(0, &infop->si_pid);
>> 		retval |= __put_user(0, &infop->si_uid);
>> 		retval |= __put_user(0, &infop->si_status);
>> 	}
>> is what kernel usually does when filling multiple structure members.
> 
> 
> I don't think it matters much.  Taking seven trips into the fault handler
> where one would do seems a bit dumb though.

If all you need is good/bad you could just separate the put_user calls 
with || and only go through the error handler once.

-- 
    -bill davidsen (davidsen@tmr.com)
"The secret to procrastination is to put things off until the
  last possible moment - but no longer"  -me

  reply	other threads:[~2004-08-31 15:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-15 23:03 [PATCH] waitid system call Roland McGrath
2004-08-16  5:40 ` Roland McGrath
2004-08-16 17:15   ` Michael Kerrisk
2004-08-16 21:12     ` Roland McGrath
2004-08-19 17:20       ` Michael Kerrisk
2004-08-19 20:53         ` Roland McGrath
2004-08-20  6:00           ` Michael Kerrisk
2004-08-20  9:02             ` Michael Kerrisk
2004-08-20 20:04               ` Roland McGrath
2004-08-24 11:51                 ` Michael Kerrisk
2004-08-31  6:04                   ` Roland McGrath
2004-08-31  6:26                     ` Jakub Jelinek
2004-08-31  6:37                       ` Roland McGrath
2004-08-31  6:40                       ` Andrew Morton
2004-08-31 15:53                         ` Bill Davidsen [this message]
2004-08-31 18:26                       ` Linus Torvalds
2004-08-31 23:51                         ` Roland McGrath
2004-09-01 11:31                           ` Michael Kerrisk
2004-08-31  7:22                     ` Michael Kerrisk
2004-08-22  8:53               ` Tonnerre
     [not found] <2tCiy-8pK-13@gated-at.bofh.it>
2004-08-16  0:03 ` Andi Kleen
2004-08-16  2:10   ` Roland McGrath

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='ch26fb$8ps$1@gatekeeper.tmr.com' \
    --to=davidsen@tmr.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 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.