Getting pthread names
Ian Lepore
ian at freebsd.org
Mon Apr 30 14:17:18 UTC 2018
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
More information about the freebsd-hackers
mailing list