Hello all,

I saw this question about a year back in the archive[1], but with no  
final answer.

I would like to trace shmget calls and also get the id of the shared  
memory segment.

That script looked like[2], but we dont get the id since arg1 is the  
errno value.

How do i access the shm id, i would need this to debug a customer  
problem but i don't have time to learn it the hard way.

Regards
Henrik

1:
http://mail.opensolaris.org/pipermail/dtrace-discuss/2007-August/004473.html

2:
#pragma D option quiet

dtrace:::BEGIN
{
     /* operation  key  shmid  size  flags cpu wall */
     printf("%-10s %-10s %-10s %-10s %-10s %-10s %-10s\n", "operation",
                                                     "key", "shmid",
                                                     "size", "flags",
                                                     "CPU", "Wall  
Time");
}

fbt::shmget:entry
{
    self->key = arg0;
    self->size = arg1;
    self->flags = arg2;
    self->shmgettimestamp = timestamp;
    self->shmgetvtimestamp = vtimestamp;
}

fbt::shmget:return
/ self->shmgettimestamp /
{
    /* operation  key  shmid  size  flags cpu wall */
    printf("%-10s %-10x %-10x %-10d %-10d %-10d %-10d\n", probefunc,
                                           self->key, arg1,
                                           self->size, self->flags,
                                           vtimestamp - self- 
 >shmgetvtimestamp,
                                           timestamp - self- 
 >shmgettimestamp);
}

_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to