library: removed that 'SIGNAL_STRING' conditional code
No libprocps user expects signal values to be returned as 'long long' quantities. More importantly the <PIDS> api only returns a 'str' result for signal categories. So this patch eliminates all the conditional code that depends on the absence of the #define 'SIGNAL_STRING'. Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
11df806a7c
commit
97f7c7a549
@ -69,21 +69,6 @@ struct utlbuf_s {
|
||||
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;
|
||||
|
||||
|
||||
@ -295,7 +280,6 @@ ENTER(0x220);
|
||||
S--; // put back the '\n' or '\0'
|
||||
continue;
|
||||
}
|
||||
#ifdef SIGNAL_STRING
|
||||
case_ShdPnd:
|
||||
memcpy(P->signal, S, 16);
|
||||
P->signal[16] = '\0';
|
||||
@ -316,23 +300,6 @@ ENTER(0x220);
|
||||
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;
|
||||
@ -437,16 +404,10 @@ ENTER(0x220);
|
||||
#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.
|
||||
|
@ -15,7 +15,6 @@
|
||||
#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 */
|
||||
|
||||
@ -56,7 +55,6 @@ typedef struct proc_t {
|
||||
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
|
||||
@ -64,15 +62,6 @@ typedef struct proc_t {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user