[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CANudz+t_yXA621maPO+Cn5hGtsyL-ebn2hzFv+2XxOA9KyL2Fw@mail.gmail.com>
Date: Mon, 13 Feb 2012 15:34:19 +0800
From: loody <miloody@...il.com>
To: kernelnewbies@...nelnewbies.org,
LKML <linux-kernel@...r.kernel.org>
Subject: some questions about container_of and user_struct
hi all:
I add below function in free_uid to get which task try to free user_struct
struct task_struct *p;
struct cred *c;
c = container_of(up,struct cred, user);
p = container_of(c,struct task_struct,real_cred);
printk("%s user %p, cred->user = %p p->pid = %d\n",__func__,up, c->user,p->pid);
but p->pid is always 0.
I think it is wrong for me to get cred and task by using container_of.
1. from kernel definition below, is it ok that member is pointer?
#define container_of(ptr, type, member)
2. is there already exist macros or functions I can use for #1 above?
3. what is user_struct used for? When and under what circumstances
kernel will try to release it.
4. since user_struct is allocated by kmem_cache_zalloc, is there api
or tool I can monitor it?
Thanks for your help,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists