[dtrace-discuss] using Dtrace to determins process to semaphore key

Mike Gerdts mgerdts at gmail.com
Wed Feb 7 17:30:25 PST 2007


On 2/7/07, Robert Leach <rleach at nyse.com> wrote:
> How can I use Dtrace to perform kinda like lsof to determine which process is using which ipc key??
>
> I have several keys in memory but I havent used Dtrace before and I do not know how to utilize dtrace or adb to resolve the process which put the key in memory.
>
> IPC status from <running system> as of Wed Feb  7 19:01:48 EST 2007
> T         ID      KEY        MODE        OWNER    GROUP  CREATOR   CGROUP NSEMS   OTIME    CTIME          PROJECT
> Semaphores:
> s          0   0x710054c0 --ra-ra-ra-     root     root     root     root     1 13:53:50 13:53:41          system
> How do I map this key to a process?

I was recently tracking down some interactions between iscsiadm and
<something else>.   This was the dtrace part of the solution:

#! /usr/sbin/dtrace -qs

fbt:semsys:semget:entry
{
    printf("SEMGET %Y %s[%d] key=%d nsems=%d semflag=%x\n",
            walltimestamp, execname, pid, args[0], args[1], args[2])
}

fbt:semsys:semop:entry
{
    printf("SEMOP %Y %s[%d] semid=%d addr=%p\n",
         walltimestamp, execname, pid, args[0], args[1]);
}

I started down the path of trying to find it via mdb, but did not have
a lot of luck going down that route.

Mike

-- 
Mike Gerdts
http://mgerdts.blogspot.com/


More information about the dtrace-discuss mailing list