This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
thread id and process id in 2.6 kernel
- From: Guang Lei Li <liguangl at cn dot ibm dot com>
- To: systemtap at sources dot redhat dot com
- Date: Wed, 9 Nov 2005 16:16:10 +0800
- Subject: thread id and process id in 2.6 kernel
Hi,
In the 2.6 kernel, we should use tgid in task_struct as the process id.
And pid in task_struct should be thread id, although in a single thread
application pid == tgid.
So the pid() in context.stp should be:
function pid:long () %{
if (unlikely(in_interrupt()))
THIS->__retvalue = 0;
else
THIS->__retvalue = current->tgid;
%}
And we should add a tid() function:
function tid:long () %{
if (unlikely(in_interrupt()))
THIS->__retvalue = 0;
else
THIS->__retvalue = current->pid;
%}
Best Regards,
Li Guanglei
- Linux Performance, China Systems & Technology Lab
China Development Labs, Beijing Tel: 86-10-82782244 Ext.3516 Email:
liguangl@cn.ibm.com