From owner-freebsd-hackers@freebsd.org Wed May 2 02:39:09 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 54227FBF4B0 for ; Wed, 2 May 2018 02:39:09 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E238C764FE; Wed, 2 May 2018 02:39:08 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (124-148-108-197.dyn.iinet.net.au [124.148.108.197]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id w422d1sC008590 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 1 May 2018 19:39:05 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: Getting pthread names To: Konstantin Belousov , Manuel St?hn Cc: freebsd-hackers@freebsd.org References: <20180430111434.GA18085@freebsd-t450.fritz.box> <20180430135711.GT6887@kib.kiev.ua> From: Julian Elischer Message-ID: <44e3f0c6-0397-404b-3fb9-a67e7f592024@freebsd.org> Date: Wed, 2 May 2018 10:38:55 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180430135711.GT6887@kib.kiev.ua> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US 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: Wed, 02 May 2018 02:39:09 -0000 On 30/4/18 9:57 pm, 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). > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > and ps in the kernel debugger shows it as well from memory check top and ps in "show thread" mode.... at one stage I remember writing code to show thread names but I can't remember what programs it went into..  (around 2001), I suspect that you are expected to remember your own name. the name writing is so other processes can get that information.