[Devel] Re: [RFC][PATCH] rename 'struct pid'
Eric W. Biederman
ebiederm at xmission.com
Wed Apr 11 09:03:45 PDT 2007
"Serge E. Hallyn" <serue at us.ibm.com> writes:
> Exactly, so why call it a 'pid == process id' if it's not just an id?
>
> If all we wanted was a kernel level process id, we could use the address
> of the task struct.
No we can not. The address of the task struct can change for PIDTYPE_PID
when we call exec, if you don't call exec from your primary thread.
Further we could not compare the pids of a session and a process group
and a task if we were using addresses of struct task.
> 'struct pid' is there to provide lightweight,
> lasting references. So if we didn't want it to serve as a task_ref, we
> wouldn't need it at all.
Not at all true. Like any good solution it simultaneously has several
purposes, and in fact what is the current struct pid has been in the
kernel a very long time as the has table entry you find when doing
a pid lookup.
> Look it's not that we're saying struct pid was such a bad name, it's
> that we have struct pid, struct pid_nr, struct pid_ns, pid_t, etc, and
> some of those *need* to be renamed. The pid_ns is in fact a pid
> namespace, the pid_nr is in fact a pid number for a task in some pid
> namespace, and struct pid happens to also serve as task_ref. Renaming
> just that one should suddenly make pid_nr and pid_ns much less
> confusing imo.
I do agree with seem to be swarming in a see of pids. Largely that
is a problem in kernel/pid.c where you are expected to know what you
are doing.
We can easily rename something besides struct pid and get the same
effect, especially in the core where everything is static.
I think the later file descriptor analogy is very apt, and as
such I would be happy to call it struct process_identifier.
Other then that likes rename things like struct pid_nr. The one
should be local to kernel/pid.c so we could call it something.
Also for fixing the problem of swimming in a see of pids it is
the functions, variable and field names that we have to fix not
the nearly so much the structure name.
I suspect if we start changing the other names we can fix the problem
and possibly come up with a better name that is equally description.
Starting by renaming struct pid is the wrong place.
Eric
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list