From owner-freebsd-hackers@freebsd.org Tue May 1 20:10:40 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FA72FB6DBC for ; Tue, 1 May 2018 20:10:40 +0000 (UTC) (envelope-from wjw@digiware.nl) Received: from smtp.digiware.nl (smtp.digiware.nl [176.74.240.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F28B8585D for ; Tue, 1 May 2018 20:10:39 +0000 (UTC) (envelope-from wjw@digiware.nl) Received: from router.digiware.nl (localhost.digiware.nl [127.0.0.1]) by smtp.digiware.nl (Postfix) with ESMTP id 4913D3B92C; Tue, 1 May 2018 22:10:32 +0200 (CEST) X-Virus-Scanned: amavisd-new at digiware.com Received: from smtp.digiware.nl ([127.0.0.1]) by router.digiware.nl (router.digiware.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ns44EQSgsB9Z; Tue, 1 May 2018 22:10:31 +0200 (CEST) Received: from [192.168.11.152] (unknown [192.168.11.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.digiware.nl (Postfix) with ESMTPSA id ABB533B92B; Tue, 1 May 2018 22:10:31 +0200 (CEST) Subject: Re: Getting pthread names To: =?UTF-8?Q?Manuel_St=c3=bchn?= Cc: freebsd-hackers@freebsd.org References: <20180430111434.GA18085@freebsd-t450.fritz.box> <20180430135711.GT6887@kib.kiev.ua> <20180430192506.GA86258@freebsd-t450.fritz.box> From: Willem Jan Withagen Message-ID: <5504160e-f3d9-db64-c851-fd829b28c04c@digiware.nl> Date: Tue, 1 May 2018 22:10:32 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180430192506.GA86258@freebsd-t450.fritz.box> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: nl Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 May 2018 20:10:40 -0000 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. 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