mutex_owner

Andrey Zonov zont at FreeBSD.org
Wed Feb 6 12:50:51 UTC 2013


On 2/5/13 6:37 PM, Dr. Baud wrote:
> All,
> 
>      Anyone use mutex_owner in a dtrace script, as the obvious does not work for me:
> 
>     Content of spin.d:
> 
> #!/usr/sbin/dtrace -qs
> 
> :::*spin
> {
> self->mutex = (kmutex_t *) arg0;
> self->mutex_owner = mutex_owner((kmutex_t *) :self->mutex);
> }
> 

Lock implementation in FreeBSD is different from in Solaris.  The script
below has to do what you want.

:::*spin
{
        self->mtx = (struct mtx *)arg0;
        self->mtx_owner = mutex_owner(self->mtx);
}

Implementation details of mutexes you can find in sys/sys/_mutex.h,
sys/sys/mutex.h, sys/kern/kern_mutex.c.

-- 
Andrey Zonov

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 535 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20130206/acded7ba/attachment.sig>


More information about the freebsd-hackers mailing list