Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 May 2018 22:10:32 +0200
From:      Willem Jan Withagen <wjw@digiware.nl>
To:        =?UTF-8?Q?Manuel_St=c3=bchn?= <freebsdnewbie@freenet.de>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Getting pthread names
Message-ID:  <5504160e-f3d9-db64-c851-fd829b28c04c@digiware.nl>
In-Reply-To: <20180430192506.GA86258@freebsd-t450.fritz.box>
References:  <20180430111434.GA18085@freebsd-t450.fritz.box> <20180430135711.GT6887@kib.kiev.ua> <20180430192506.GA86258@freebsd-t450.fritz.box>

next in thread | previous in thread | raw e-mail | index | archive | help
On 30/04/2018 21:25, Manuel Stühn wrote:
> On Mon, Apr 30, 2018 at 04:57:11PM +0300, Konstantin Belousov wrote:
>> On Mon, Apr 30, 2018 at 01:14:34PM +0200, Manuel St?hn wrote:
>>> Hi,
>>>
>>> for setting a name for pthreads i found pthread_set_name_np(3), but for
>>> retrieving the name i found nothing. Is there any api like
>>> pthread_getname_np for FreeBSD? Or is there another way to retrieve the
>>> threads name within an application?
>>
>> Not like pthread_getname_np(), but still something.  You can use
>> (binary) sysctl kern.proc.pid.<pid> to get struct kinfo_proc for all
>> threads.  In the structure, the ki_tdname() member contains the thread
>> name as set by pthread_set_name_np(3).
> 
> Thank you (all) for your answer(s) and hints! I'll have a look into this.

I asked the same question some time ago, because Ceph also uses this in 
all kinds of analysis. It is/was still on my todo list, but since it is 
only informational, it is not high on priority.

But would be more than interested to test/use an implementation.

--WjW





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5504160e-f3d9-db64-c851-fd829b28c04c>