Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Apr 2018 08:17:09 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        Manuel =?ISO-8859-1?Q?St=FChn?= <freebsdnewbie@freenet.de>, freebsd-hackers@freebsd.org
Subject:   Re: Getting pthread names
Message-ID:  <1525097829.57768.140.camel@freebsd.org>
In-Reply-To: <20180430111434.GA18085@freebsd-t450.fritz.box>
References:  <20180430111434.GA18085@freebsd-t450.fritz.box>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2018-04-30 at 13:14 +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?

The applications I know of that can display thread names (ps, top,
procstat) retrieve it using libprocstat and the procstat_getprocs(3)
function. The libprocstat functions access the information via /dev/kvm
or sysctl, but those interfaces return raw binary kernel data that
userland should not try to directly interpret for themselves.

-- Ian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1525097829.57768.140.camel>