On Fri, Sep 30, 2011 at 6:37 AM, <m...@wit.ch> wrote: > Has anyone mastered to trace name lookups (DNS, NIS, LDAP) across the door > to nscd to know which process triggered nscd to do the lookup?
You can't do it from a singular script. You'd need two scripts at least: one for the process calling nss, and one for nscd. If you look around I'm sure you'll find a way to print out the PID/TID of the door caller in the nscd script. Several ways to do this might include: - use FBT to trace calls to cred2ucred() in the kernel for the process with nscd's PID nscd does call door_ucred(3DOOR), which should cause a call to cred2ucred(), which gets the caller's PID as its second argument. - use FBT to trace calls to door_server_dispatch() or door_finish_dispatch() in the kernel for the process with nscd's PID, and grab the current thread's t_door->d_server->d_caller->t_procp->p_pid Here you can also easily grab the thread's TID as the currthread's t_door->d_server->d_caller->t_tid. In both scripts you should trace the current time, the caller's PID and, preferably, thread ID as well. You should also store the caller info in a thread-local in the nscd script and trace that in the actual getXbyY call. Then join the caller/nscd getXbyY traces to the caller traces. This is not entirely reliable because of things like event drops, signals that cause thread/door_call cancellation, ... So you should join actual getXbyY traces to the late-most (latest seems like the wrong word for some reason) trace entry from the matching calling process/thread. Also, this will not be a stable script, since the above are not stable interfaces. There may be stable interfaces that you could use, but I don't know what they are at this moment. Hope that helps. Nico -- _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org