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:
Jim Warner 2019-09-27 00:00:00 -05:00 committed by Craig Small
parent 11df806a7c
commit 97f7c7a549
2 changed files with 0 additions and 50 deletions

View File

@ -69,21 +69,6 @@ struct utlbuf_s {
int siz; // current len of the above int siz; // current len of the above
} utlbuf_s; } 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; static int task_dir_missing;
@ -295,7 +280,6 @@ ENTER(0x220);
S--; // put back the '\n' or '\0' S--; // put back the '\n' or '\0'
continue; continue;
} }
#ifdef SIGNAL_STRING
case_ShdPnd: case_ShdPnd:
memcpy(P->signal, S, 16); memcpy(P->signal, S, 16);
P->signal[16] = '\0'; P->signal[16] = '\0';
@ -316,23 +300,6 @@ ENTER(0x220);
memcpy(P->_sigpnd, S, 16); memcpy(P->_sigpnd, S, 16);
P->_sigpnd[16] = '\0'; P->_sigpnd[16] = '\0';
continue; 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: case_State:
P->state = *S; P->state = *S;
continue; continue;
@ -437,16 +404,10 @@ ENTER(0x220);
#endif #endif
// recent kernels supply per-tgid pending signals // recent kernels supply per-tgid pending signals
#ifdef SIGNAL_STRING
if(!is_proc || !P->signal[0]){ if(!is_proc || !P->signal[0]){
memcpy(P->signal, P->_sigpnd, 16); memcpy(P->signal, P->_sigpnd, 16);
P->signal[16] = '\0'; 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" // Linux 2.4.13-pre1 to max 2.4.xx have a useless "Tgid"
// that is not initialized for built-in kernel tasks. // that is not initialized for built-in kernel tasks.

View File

@ -15,7 +15,6 @@
#include <unistd.h> #include <unistd.h>
#include <proc/namespace.h> #include <proc/namespace.h>
#define SIGNAL_STRING
// the following is development only, forcing display of "[ duplicate ENUM ]" strings // the following is development only, forcing display of "[ duplicate ENUM ]" strings
// #define FALSE_THREADS /* set most child string fields to NULL */ // #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 pcpu, // stat (special) elapsed tics for %CPU usage calculation
maj_delta, // stat (special) major page faults since last update maj_delta, // stat (special) major page faults since last update
min_delta; // stat (special) minor page faults since last update min_delta; // stat (special) minor page faults since last update
#ifdef SIGNAL_STRING
char char
// Linux 2.1.7x and up have 64 signals. Allow 64, plus '\0' and padding. // Linux 2.1.7x and up have 64 signals. Allow 64, plus '\0' and padding.
signal[18], // status mask of pending signals signal[18], // status mask of pending signals
@ -64,15 +62,6 @@ typedef struct proc_t {
sigignore[18], // status mask of ignored signals sigignore[18], // status mask of ignored signals
sigcatch[18], // status mask of caught signals sigcatch[18], // status mask of caught signals
_sigpnd[18]; // status mask of PER TASK pending 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 unsigned long
start_code, // stat address of beginning of code segment start_code, // stat address of beginning of code segment
end_code, // stat address of end of code segment end_code, // stat address of end of code segment