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]

Re: new feature and discussion: filtering on pids


The POSIX notion of a process, identified by a PID, is not what
current->pid means inside the Linux kernel.  The ->pid field is in fact a
systemwide thread identifier, which happens to match the PID for
single-threaded processes and for the initial thread in NPTL multithreaded
processes.  The ->tgid field gives the POSIX process PID, which is what PID
means in Solaris.  A systemtap construct intended to match something called
"pid" in Solaris should use ->tgid, not ->pid.  In Solaris parlance, the
->pid number is the LWPID.

Unfortunately, Linux has more flavors of multithreadedness than POSIX
processes (NPTL).  This includes the obsolete linuxthreads, as well as
weirdo private uses of the kernel features it's based on (clone).  To
distinguish "same process" as usually construed by those notions, you have
to select for threads sharing the address space.  This is easy enough to do
given some setup before running the probe.  i.e., looking up the target PID
and caching a reference to its address space data structure.

Various more complex selection criteria are easy enough to set up this way
too.  It just takes translator support for having the module initializer do
some setup calls parameterized by stap argument details.


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