Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

内核中如何打印当前线程的进程id,线程id

142 views
Skip to first unread message

Youyou

unread,
Nov 16, 2010, 9:09:05 PM11/16/10
to

在用户态好像只要调用gettid(), getpid()即可。
在内核态怎么使用,是不是有个当前进程的数据结构?这个数据结构叫什么?
--

[m [36m※ 来源:·水木社区 http://newsmth.net·[FROM: 166.111.68.*] [m

孑瓜犭虫白勺犭瓜犭里

unread,
Nov 16, 2010, 9:27:59 PM11/16/10
to
pid, tgid 在考虑到 NAMESPACE 的时候比较麻烦。。

【 在 KDr2 (R2D2) 的大作中提到: 】
: gettid: current->pid;
: getpid: current->tgid;
: include/linux/sched.h: struct task_struct

--

[m [37m※ 来源:·水木社区 http://newsmth.net·[FROM: 220.194.0.*] [m

R2D2

unread,
Nov 16, 2010, 9:25:01 PM11/16/10
to
gettid: current->pid;
getpid: current->tgid;

include/linux/sched.h: struct task_struct

【 在 yoyolu05 (Youyou) 的大作中提到: 】
: 在用户态好像只要调用gettid(), getpid()即可。
: 在内核态怎么使用,是不是有个当前进程的数据结构?这个数据结构叫什么?


--
我等了你三年,三年哪,我要重新再来
我不是想证明自己有多么了不起,
我只是要告诉别人,我失去了的东西,我一定要拿回来!


[m [1;31m※ 来源:·水木社区 newsmth.net·[FROM: 211.103.143.*] [m

Youyou

unread,
Nov 16, 2010, 10:18:49 PM11/16/10
to

thanks

【 在 KDr2 (R2D2) 的大作中提到: 】
: gettid: current->pid;


: getpid: current->tgid;
: include/linux/sched.h: struct task_struct

--

[m [37m※ 来源:·水木社区 http://newsmth.net·[FROM: 166.111.68.*] [m

0 new messages