From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ffc1e,e6de223ba2c352f2 X-Google-Attributes: gidffc1e,public X-Google-Thread: fee84,e6de223ba2c352f2 X-Google-Attributes: gidfee84,public From: Dave Butenhof Subject: Re: pthread_setname_np and ps on Digital UNIX 4.0D Date: 1998/03/09 Message-ID: <35041812.729E0A5B@zko.dec.com>#1/1 X-Deja-AN: 332313996 Content-Transfer-Encoding: 7bit References: <350184E1.F5BEFFF1@worldnet.fr> Mime-Version: 1.0 To: Laurent Deniel Content-Type: text/plain; charset=us-ascii Organization: Digital Equipment Corporation Newsgroups: comp.programming.threads,comp.unix.osf.osf1 Laurent Deniel wrote: > Is there a way to display the name of a thread (specified thanks > to the function pthread_setname_np) in commands such a ps ? > (in order to quickly see the behavior of a well-known thread). > If it is not possible with Digital UNIX's ps, someone may > have hacked some interesting similar utilities that display > such thread informations ? The ps command is a utility to show system information, and this would be getting into an entirely different level of process information. It would, arguably, be "inappropriate" to do this in ps. In any case, the decision was made long ago to not do as you suggest. The easiest way to get this information is to attach to the process with ladebug (or another suitable user-level-thread-enabled debugger) and ask for the information. (E.g., ladebug's "show thread" command.) While one certainly could create a standalone utility, you'd need to find the binary associated with the process, look up symbols, use /proc (or equivalent) to access process memory, and so forth -- sounds a lot like a debugger, doesn't it? The mechanism used to access this information is in libpthreaddebug.so. As of 4.0D, the associated header file, is available on the standard OS kit (with the other development header files). Although it's not externally documented, it's heavily commented, and reasonably self-describing. /---------------------------[ Dave Butenhof ]--------------------------\ | Digital Equipment Corporation butenhof@zko.dec.com | | 110 Spit Brook Rd ZKO2-3/Q18 http://members.aol.com/drbutenhof | | Nashua NH 03062-2698 http://www.awl.com/cseng/titles/0-201-63392-2/ | \-----------------[ Better Living Through Concurrency ]----------------/