Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Mar 2016 14:35:41 +0300
From:      Sergey Kandaurov <pluknet@gmail.com>
To:        Willem Jan Withagen <wjw@digiware.nl>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: Getting a thread name
Message-ID:  <CAE-mSO%2B3HMm_mthwGLPiLzmRfxaF2dViHfPzWusAjqd=8TMUHw@mail.gmail.com>
In-Reply-To: <56FBAD69.908@digiware.nl>
References:  <56FBAD69.908@digiware.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On 30 March 2016 at 13:41, Willem Jan Withagen <wjw@digiware.nl> wrote:
> Hi,
>
> pthread_np has a call: pthread_set_name(tid, str).
>
> Now I'm looking for a way of retrieving that name. But there is no:
> pthread_get_name() in the same set.
>
> But I see top actually displaying the threadnames. So can somebody give
> me a hint where to look? Other than going thru top...
>

It's extracted either over kvm(3) or sysctl(3) interface depending on
your needs.  Search for kvm_getprocs() and KERN_PROC respectively.
You can also use libprocstat(3) that is a wrapper.

-- 
wbr,
pluknet



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSO%2B3HMm_mthwGLPiLzmRfxaF2dViHfPzWusAjqd=8TMUHw>