lkml.org 
[lkml]   [2013]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 11/12] pid: rewrite task helper functions avoiding task->pid and task->tgid
    On Tue, Aug 20, 2013 at 05:32:03PM -0400, Richard Guy Briggs wrote:
    > This stops these four task helper functions from using the deprecated and
    > error-prone task->pid and task->tgid.
    >
    > (informed by ebiederman's ea5a4d01)
    > Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    > Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
    > ---
    > include/linux/sched.h | 8 ++++----
    > 1 files changed, 4 insertions(+), 4 deletions(-)
    >
    > diff --git a/include/linux/sched.h b/include/linux/sched.h
    > index 8e69807..46e739d 100644
    > --- a/include/linux/sched.h
    > +++ b/include/linux/sched.h
    > @@ -1579,7 +1579,7 @@ static inline int pid_alive(struct task_struct *p)
    > */
    > static inline int is_global_init(struct task_struct *tsk)
    > {
    > - return tsk->pid == 1;
    > + return task_pid_nr(tsk) == 1;
    > }
    >
    > extern struct pid *cad_pid;
    > @@ -1930,7 +1930,7 @@ extern struct task_struct *idle_task(int cpu);
    > */
    > static inline bool is_idle_task(const struct task_struct *p)
    > {
    > - return p->pid == 0;
    > + return task_pid(p) == &init_struct_pid;
    > }
    > extern struct task_struct *curr_task(int cpu);
    > extern void set_curr_task(int cpu, struct task_struct *p);

    Why would you ever want to do this? It just makes these tests more
    expensive for no gain what so ff'ing ever.


    \
     
     \ /
      Last update: 2013-08-22 22:21    [W:2.166 / U:0.116 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site