From: ebiederm@xmission.com (Eric W. Biederman)
To: Dave Hansen <haveblue@us.ibm.com>
Cc: containers@lists.osdl.org, linux-kernel@vger.kernel.org,
Oleg Nesterov <oleg@tv-sign.ru>
Subject: Re: [Containers] [PATCH 5/7] pid: Implement pid_nr
Date: Wed, 16 Aug 2006 00:29:18 -0600 [thread overview]
Message-ID: <m14pwd6vnl.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <1155669325.18883.10.camel@localhost.localdomain> (Dave Hansen's message of "Tue, 15 Aug 2006 12:15:25 -0700")
Dave Hansen <haveblue@us.ibm.com> writes:
> On Tue, 2006-08-15 at 13:00 -0600, Eric W. Biederman wrote:
>> Dave Hansen <haveblue@us.ibm.com> writes:
>>
>> > On Tue, 2006-08-15 at 12:23 -0600, Eric W. Biederman wrote:
>> >> +static inline pid_t pid_nr(struct pid *pid)
>> >> +{
>> >> + pid_t nr = 0;
>> >> + if (pid)
>> >> + nr = pid->nr;
>> >> + return nr;
>> >> +}
>> >
>> > When is it valid to be passing around a NULL 'struct pid *'?
>>
>> When you don't have one at all. Look at the fcntl case a few
>> patches later, or even the spawnpid case.
>
> Does the fcntl() one originate from anywhere other than find_pid() in
> f_setown()? It seems like, perhaps, the error checking is being done at
> the wrong level.
Yes. It is normally NULL as file handles don't usually have a process
to send a signal to.
>> Then of course there is the later chaos when we get to pid spaces
>> where depending on the pid namespace you are in when you call this
>> on a given struct pid sometimes you will get a pid value and sometimes
>> you won't.
>
> OK, I think it is makes sense to me to say 'get_pid(tsk, pidspace)' and
> get back a NULL 'struct pid' if that task isn't visible in that
> namespace. However, I don't get how it is handy to be able to defer the
> fact that the pid wasn't found until you go do a pid_nr() on that NULL.
If having a pid to signal is optional, which it almost always is,
being able to handle that case easily and return a 0 to user space is helpful.
So far it is my assumption that everything that looks up a pid and converts
a pid to a number will do it with respect to the current processes pidspace.
A very reasonable assumption and only with siginfo have I found a case where
it looks like I might not be able to implement it that way.
Eric
next prev parent reply other threads:[~2006-08-16 6:29 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-15 18:21 Start using struct pid Eric W. Biederman
2006-08-15 18:23 ` [PATCH 1/7] pid: Implement access helpers for a tacks various process groups Eric W. Biederman
2006-08-15 18:40 ` Dave Hansen
2006-08-15 19:03 ` Eric W. Biederman
2006-08-16 8:04 ` [Containers] " Kirill Korotaev
2006-08-15 18:23 ` [PATCH 2/7] pid: Add do_each_pid_task Eric W. Biederman
2006-08-16 3:10 ` [Containers] " Serge E. Hallyn
2006-08-16 4:28 ` Andrew Morton
2006-08-16 6:15 ` Eric W. Biederman
2006-08-16 6:34 ` Eric W. Biederman
2006-08-16 11:57 ` Serge E. Hallyn
2006-08-16 19:17 ` Oleg Nesterov
2006-08-17 21:16 ` [PATCH -mm] simplify pid iterators Oleg Nesterov
2006-08-15 18:23 ` [PATCH 3/7] pid: Implement signal functions that take a struct pid * Eric W. Biederman
2006-08-15 18:23 ` [PATCH 4/7] pid: Export the symbols needed to use " Eric W. Biederman
2006-08-15 18:23 ` [PATCH 5/7] pid: Implement pid_nr Eric W. Biederman
2006-08-15 18:37 ` Dave Hansen
2006-08-15 19:00 ` Eric W. Biederman
2006-08-15 19:15 ` [Containers] " Dave Hansen
2006-08-16 6:29 ` Eric W. Biederman [this message]
2006-08-16 16:27 ` Jan Engelhardt
2006-08-16 17:48 ` Eric W. Biederman
2006-08-16 18:19 ` Oleg Nesterov
2006-08-16 16:18 ` Eric W. Biederman
2006-08-16 21:03 ` Oleg Nesterov
2006-08-16 17:18 ` Eric W. Biederman
2006-08-15 18:23 ` [PATCH 6/7] vt: Update spawnpid to be a struct pid_t Eric W. Biederman
2006-08-15 18:53 ` Alan Cox
2006-08-15 18:45 ` Eric W. Biederman
2006-08-16 8:04 ` [Containers] " Kirill Korotaev
2006-08-16 14:23 ` Eric W. Biederman
2006-08-15 19:38 ` Ray Lehtiniemi
2006-08-16 19:35 ` Oleg Nesterov
2006-08-16 15:43 ` Andrew Morton
2006-08-16 17:55 ` Eric W. Biederman
2006-08-15 18:23 ` [PATCH 7/7] file: Modify struct fown_struct to use a struct pid Eric W. Biederman
2006-08-16 18:45 ` Oleg Nesterov
2006-08-16 18:48 ` Oleg Nesterov
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=m14pwd6vnl.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=containers@lists.osdl.org \
--cc=haveblue@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
/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
Powered by JetHome