Date: Wed, 30 Mar 2016 13:44:00 +0200 From: Willem Jan Withagen <wjw@digiware.nl> To: Sergey Kandaurov <pluknet@gmail.com> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: Getting a thread name Message-ID: <56FBBC00.6000901@digiware.nl> In-Reply-To: <CAE-mSO%2B3HMm_mthwGLPiLzmRfxaF2dViHfPzWusAjqd=8TMUHw@mail.gmail.com> References: <56FBAD69.908@digiware.nl> <CAE-mSO%2B3HMm_mthwGLPiLzmRfxaF2dViHfPzWusAjqd=8TMUHw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 30-3-2016 13:35, Sergey Kandaurov wrote: > 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. 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56FBBC00.6000901>