thread id and process id in 2.6 kernel

Guang Lei Li liguangl@cn.ibm.com
Wed Nov 9 13:44:00 GMT 2005


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



More information about the Systemtap mailing list