From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96135161508741.tru64-unix-managers.marc@archive.invalid> From: Wai-Sun Chia Date: Sun, 18 Jun 2000 18:05:39 +0000 To: tru64-unix-managers Subject: /proc, PIOCTUSAGE and friends X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96135161508741 Hello managers, I'm have to write an utility which monitors the component threads in an in-house developed multithreaded application (this is on Tru64 4.0f). Something akin to ps and vmstat, but for individual threads within an application... Basing on proc(4), I've managed to figure out how PIOCNTHR and PIOCTLIST work. Below is a code snippet: /* Obtain a list tids for all the active threads */ ioctl(fd, PIOCNTHR, &nbr_thr); tid = (tid_t *)calloc(nbr_thr, sizeof(tid_t)); ioctl(fd, PIOCTLIST, tid); for (i = 0; i < nbr_thr; i++) { printf("tid %d = 0x%lx\n", i, tid[i]); } Output is something like: tid 0 = 0x5 tid 1 = 0x7 tid 2 = 0x9 tid 3 = 0xb tid 4 = 0xd tid 5 = 0xf tid 6 = 0x11 tid 7 = 0x15 Problem is I'm stuck here, as I got no idea how to use the thread-specific PIOCTSTATUS and the non-documented PIOCTUSAGE (only in procfs.h) ioctl commands? Any code samples is very much appreciated.. (I managed to get PIOCSTATUS and PIOCUSAGE working though; i.e. the process level stuff). -- Wai-Sun "squidster" Chia Web/Unix Developer Professional Services Division