[Containers] [PATCH 5/7] pid: Implement pid_nr

Eric W. Biederman ebiederm at xmission.com
Tue Aug 15 12:00:52 PDT 2006


Dave Hansen <haveblue at 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.  It simplifies things to
just cope with the fact that sometimes the users just have a NULL
pointers.

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.

Eric



More information about the Containers mailing list