Getting a thread name
Willem Jan Withagen
wjw at digiware.nl
Wed Mar 30 11:44:20 UTC 2016
On 30-3-2016 13:35, Sergey Kandaurov wrote:
> On 30 March 2016 at 13:41, Willem Jan Withagen <wjw at 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.
First 2 sounds rather convoluted....
I have a thread ID and want the string with the threadname back, as set
by pthread_set_name().
Fortunately is the place where I need it atm. is in process wrapup.
So performance is not a real issue.
I'll check your hints, thanx,
--WjW
More information about the freebsd-hackers
mailing list