This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]