From: Alex Lyashkov <shadow@psoft.net>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: possible kernel bug in signal transit.
Date: Sun, 14 Mar 2004 07:56:01 +0200 [thread overview]
Message-ID: <1079243761.8186.46.camel@berloga.shadowland> (raw)
In-Reply-To: <20040313214700.387c4ff3.akpm@osdl.org>
В Вск, 14.03.2004, в 07:47, Andrew Morton пишет:
> Alex Lyashkov <shadow@psoft.net> wrote:
> >
> > > int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp)
> > > {
> > > struct task_struct *p;
> > > struct list_head *l;
> > > struct pid *pid;
> > > int retval;
> > > int found;
> > >
> > > if (pgrp <= 0)
> > > return -EINVAL;
> > >
> > > found = 0;
> > > retval = 0;
> > > for_each_task_pid(pgrp, PIDTYPE_PGID, p, l, pid) {
> > > int err;
> > >
> > > found = 1;
> > > err = group_send_sig_info(sig, info, p);
> > > if (!retval)
> > > retval = err;
> > > }
> > > return found ? retval : -ESRCH;
> > > }
> > not. it error. At this code you save first non zero value err but other
> > been ignored.
>
> Well we can only return one error code. Or are you suggesting that we
> should terminate the loop early on error? If so, why?
You say me can return _last_ error core. but this function return
_first_.
I write second variant where not terminate loop and save _last_ error
code (i was sending in previous mail). but if you have i write full
function:
====
int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp)
{
struct task_struct *p;
struct list_head *l;
struct pid *pid;
int retval = 0;
int err = -1;
if (pgrp <= 0)
return -EINVAL;
for_each_task_pid(pgrp, PIDTYPE_PGID, p, l, pid) {
err = group_send_sig_info(sig, info, p);
if( err )
retval = err;
}
return err==-1 ? -ESRCH : retval;
}
===
what you think about its code ?
--
Alex Lyashkov <shadow@psoft.net>
PSoft
next prev parent reply other threads:[~2004-03-14 5:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-13 17:02 possible kernel bug in signal transit Alex Lyashkov
2004-03-14 1:18 ` Andrew Morton
2004-03-14 4:39 ` Alex Lyashkov
2004-03-14 5:00 ` Andrew Morton
2004-03-14 5:21 ` Alex Lyashkov
2004-03-14 5:47 ` Andrew Morton
2004-03-14 5:56 ` Alex Lyashkov [this message]
2004-03-14 6:09 ` Andrew Morton
2004-03-14 6:26 ` Alex Lyashkov
2004-03-14 6:37 ` Andrew Morton
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=1079243761.8186.46.camel@berloga.shadowland \
--to=shadow@psoft.net \
--cc=akpm@osdl.org \
--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.