int siz; // current len of the above
} utlbuf_s;
-#ifndef SIGNAL_STRING
-// convert hex string to unsigned long long
-static unsigned long long unhex(const char *restrict cp){
- unsigned long long ull = 0;
- for(;;){
- char c = *cp++;
- if(!( (c >= '0' && c <= '9') ||
- (c >= 'A' && c <= 'F') ||
- (c >= 'a' && c <= 'f') )) break;
- ull = (ull<<4) | (c - (c >= 'a' ? 'a'-10 : c >= 'A' ? 'A'-10 : '0'));
- }
- return ull;
-}
-#endif
-
static int task_dir_missing;
S--; // put back the '\n' or '\0'
continue;
}
-#ifdef SIGNAL_STRING
case_ShdPnd:
memcpy(P->signal, S, 16);
P->signal[16] = '\0';
memcpy(P->_sigpnd, S, 16);
P->_sigpnd[16] = '\0';
continue;
-#else
- case_ShdPnd:
- P->signal = unhex(S);
- continue;
- case_SigBlk:
- P->blocked = unhex(S);
- continue;
- case_SigCgt:
- P->sigcatch = unhex(S);
- continue;
- case_SigIgn:
- P->sigignore = unhex(S);
- continue;
- case_SigPnd:
- P->_sigpnd = unhex(S);
- continue;
-#endif
case_State:
P->state = *S;
continue;
#endif
// recent kernels supply per-tgid pending signals
-#ifdef SIGNAL_STRING
if(!is_proc || !P->signal[0]){
memcpy(P->signal, P->_sigpnd, 16);
P->signal[16] = '\0';
}
-#else
- if(!is_proc){
- P->signal = P->_sigpnd;
- }
-#endif
// Linux 2.4.13-pre1 to max 2.4.xx have a useless "Tgid"
// that is not initialized for built-in kernel tasks.
#include <unistd.h>
#include <proc/namespace.h>
-#define SIGNAL_STRING
// the following is development only, forcing display of "[ duplicate ENUM ]" strings
// #define FALSE_THREADS /* set most child string fields to NULL */
pcpu, // stat (special) elapsed tics for %CPU usage calculation
maj_delta, // stat (special) major page faults since last update
min_delta; // stat (special) minor page faults since last update
-#ifdef SIGNAL_STRING
char
// Linux 2.1.7x and up have 64 signals. Allow 64, plus '\0' and padding.
signal[18], // status mask of pending signals
sigignore[18], // status mask of ignored signals
sigcatch[18], // status mask of caught signals
_sigpnd[18]; // status mask of PER TASK pending signals
-#else
- long long
- // Linux 2.1.7x and up have 64 signals.
- signal, // status mask of pending signals
- blocked, // status mask of blocked signals
- sigignore, // status mask of ignored signals
- sigcatch, // status mask of caught signals
- _sigpnd; // status mask of PER TASK pending signals
-#endif
unsigned long
start_code, // stat address of beginning of code segment
end_code, // stat address of end of code segment