Commit 02a30bfe authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

warning fixes

parent 5cc89986
...@@ -28,7 +28,7 @@ int BatteryMeter_attributes[] = { ...@@ -28,7 +28,7 @@ int BatteryMeter_attributes[] = {
BATTERY BATTERY
}; };
static unsigned long int parseUevent(FILE * file, char *key) { static unsigned long int parseUevent(FILE * file, const char *key) {
char line[100]; char line[100];
unsigned long int dValue = 0; unsigned long int dValue = 0;
...@@ -117,7 +117,7 @@ static ACPresence chkIsOnline() { ...@@ -117,7 +117,7 @@ static ACPresence chkIsOnline() {
if (access(PROCDIR "/acpi/ac_adapter", F_OK) == 0) { if (access(PROCDIR "/acpi/ac_adapter", F_OK) == 0) {
const struct dirent *dirEntries; const struct dirent *dirEntries;
char *power_supplyPath = PROCDIR "/acpi/ac_adapter"; const char *power_supplyPath = PROCDIR "/acpi/ac_adapter";
DIR *power_supplyDir = opendir(power_supplyPath); DIR *power_supplyDir = opendir(power_supplyPath);
char *entryName; char *entryName;
...@@ -170,7 +170,7 @@ static ACPresence chkIsOnline() { ...@@ -170,7 +170,7 @@ static ACPresence chkIsOnline() {
} else { } else {
char *power_supplyPath = "/sys/class/power_supply"; const char *power_supplyPath = "/sys/class/power_supply";
if (access("/sys/class/power_supply", F_OK) == 0) { if (access("/sys/class/power_supply", F_OK) == 0) {
const struct dirent *dirEntries; const struct dirent *dirEntries;
...@@ -240,7 +240,7 @@ static double getProcBatData() { ...@@ -240,7 +240,7 @@ static double getProcBatData() {
static double getSysBatData() { static double getSysBatData() {
const struct dirent *dirEntries; const struct dirent *dirEntries;
char *power_supplyPath = "/sys/class/power_supply/"; const char *power_supplyPath = "/sys/class/power_supply/";
DIR *power_supplyDir = opendir(power_supplyPath); DIR *power_supplyDir = opendir(power_supplyPath);
...@@ -292,7 +292,7 @@ static void BatteryMeter_setValues(Meter * this, char *buffer, int len) { ...@@ -292,7 +292,7 @@ static void BatteryMeter_setValues(Meter * this, char *buffer, int len) {
this->values[0] = percent; this->values[0] = percent;
char *onAcText, *onBatteryText, *unknownText; const char *onAcText, *onBatteryText, *unknownText;
unknownText = "%.1f%%"; unknownText = "%.1f%%";
if (this->mode == TEXT_METERMODE) { if (this->mode == TEXT_METERMODE) {
......
...@@ -23,17 +23,17 @@ typedef struct CategoriesPanel_ { ...@@ -23,17 +23,17 @@ typedef struct CategoriesPanel_ {
}*/ }*/
static char* MetersFunctions[] = {" ", " ", " ", "Type ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done ", NULL}; static const char* MetersFunctions[] = {" ", " ", " ", "Type ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done ", NULL};
static char* AvailableMetersFunctions[] = {" ", " ", " ", " ", "Add L ", "Add R ", " ", " ", " ", "Done ", NULL}; static const char* AvailableMetersFunctions[] = {" ", " ", " ", " ", "Add L ", "Add R ", " ", " ", " ", "Done ", NULL};
static char* DisplayOptionsFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL}; static const char* DisplayOptionsFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL};
static char* ColumnsFunctions[] = {" ", " ", " ", " ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done ", NULL}; static const char* ColumnsFunctions[] = {" ", " ", " ", " ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done ", NULL};
static char* ColorsFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL}; static const char* ColorsFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL};
static char* AvailableColumnsFunctions[] = {" ", " ", " ", " ", "Add ", " ", " ", " ", " ", "Done ", NULL}; static const char* AvailableColumnsFunctions[] = {" ", " ", " ", " ", "Add ", " ", " ", " ", " ", "Done ", NULL};
static void CategoriesPanel_delete(Object* object) { static void CategoriesPanel_delete(Object* object) {
Panel* super = (Panel*) object; Panel* super = (Panel*) object;
......
What's new in version 0.8.4 What's new in version 0.8.4
* Show custom thread names
(thanks to Anders Torger)
* Fix license terms with regard to PLPA
(thanks to Tom Callaway)
What's new in version 0.8.3 What's new in version 0.8.3
......
...@@ -27,7 +27,7 @@ typedef struct ColorsPanel_ { ...@@ -27,7 +27,7 @@ typedef struct ColorsPanel_ {
}*/ }*/
static char* ColorSchemes[] = { static const char* ColorSchemes[] = {
"Default", "Default",
"Monochromatic", "Monochromatic",
"Black on White", "Black on White",
......
...@@ -36,17 +36,17 @@ char* FUNCTIONBAR_CLASS = "FunctionBar"; ...@@ -36,17 +36,17 @@ char* FUNCTIONBAR_CLASS = "FunctionBar";
#define FUNCTIONBAR_CLASS NULL #define FUNCTIONBAR_CLASS NULL
#endif #endif
static char* FunctionBar_FKeys[] = {"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", NULL}; static const char* FunctionBar_FKeys[] = {"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", NULL};
static char* FunctionBar_FLabels[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", NULL}; static const char* FunctionBar_FLabels[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", NULL};
static int FunctionBar_FEvents[] = {KEY_F(1), KEY_F(2), KEY_F(3), KEY_F(4), KEY_F(5), KEY_F(6), KEY_F(7), KEY_F(8), KEY_F(9), KEY_F(10)}; static int FunctionBar_FEvents[] = {KEY_F(1), KEY_F(2), KEY_F(3), KEY_F(4), KEY_F(5), KEY_F(6), KEY_F(7), KEY_F(8), KEY_F(9), KEY_F(10)};
FunctionBar* FunctionBar_new(char** functions, char** keys, int* events) { FunctionBar* FunctionBar_new(const char** functions, const char** keys, int* events) {
FunctionBar* this = malloc(sizeof(FunctionBar)); FunctionBar* this = malloc(sizeof(FunctionBar));
Object_setClass(this, FUNCTIONBAR_CLASS); Object_setClass(this, FUNCTIONBAR_CLASS);
((Object*) this)->delete = FunctionBar_delete; ((Object*) this)->delete = FunctionBar_delete;
this->functions = functions; this->functions = (char**) functions;
if (keys && events) { if (keys && events) {
this->staticData = false; this->staticData = false;
this->functions = malloc(sizeof(char*) * 15); this->functions = malloc(sizeof(char*) * 15);
...@@ -60,8 +60,8 @@ FunctionBar* FunctionBar_new(char** functions, char** keys, int* events) { ...@@ -60,8 +60,8 @@ FunctionBar* FunctionBar_new(char** functions, char** keys, int* events) {
} }
} else { } else {
this->staticData = true; this->staticData = true;
this->functions = functions ? functions : FunctionBar_FLabels; this->functions = (char**)( functions ? functions : FunctionBar_FLabels );
this->keys = FunctionBar_FKeys; this->keys = (char**) FunctionBar_FKeys;
this->events = FunctionBar_FEvents; this->events = FunctionBar_FEvents;
this->size = 10; this->size = 10;
} }
...@@ -82,7 +82,7 @@ void FunctionBar_delete(Object* cast) { ...@@ -82,7 +82,7 @@ void FunctionBar_delete(Object* cast) {
free(this); free(this);
} }
void FunctionBar_setLabel(FunctionBar* this, int event, char* text) { void FunctionBar_setLabel(FunctionBar* this, int event, const char* text) {
assert(!this->staticData); assert(!this->staticData);
for (int i = 0; i < this->size; i++) { for (int i = 0; i < this->size; i++) {
if (this->events[i] == event) { if (this->events[i] == event) {
......
...@@ -37,11 +37,11 @@ extern char* FUNCTIONBAR_CLASS; ...@@ -37,11 +37,11 @@ extern char* FUNCTIONBAR_CLASS;
#define FUNCTIONBAR_CLASS NULL #define FUNCTIONBAR_CLASS NULL
#endif #endif
FunctionBar* FunctionBar_new(char** functions, char** keys, int* events); FunctionBar* FunctionBar_new(const char** functions, const char** keys, int* events);
void FunctionBar_delete(Object* cast); void FunctionBar_delete(Object* cast);
void FunctionBar_setLabel(FunctionBar* this, int event, char* text); void FunctionBar_setLabel(FunctionBar* this, int event, const char* text);
void FunctionBar_draw(FunctionBar* this, char* buffer); void FunctionBar_draw(FunctionBar* this, char* buffer);
......
...@@ -17,6 +17,7 @@ int HostnameMeter_attributes[] = { ...@@ -17,6 +17,7 @@ int HostnameMeter_attributes[] = {
}; };
static void HostnameMeter_setValues(Meter* this, char* buffer, int size) { static void HostnameMeter_setValues(Meter* this, char* buffer, int size) {
(void) this;
gethostname(buffer, size-1); gethostname(buffer, size-1);
} }
......
...@@ -44,7 +44,7 @@ static void ListItem_display(Object* cast, RichString* out) { ...@@ -44,7 +44,7 @@ static void ListItem_display(Object* cast, RichString* out) {
RichString_write(out, CRT_colors[DEFAULT_COLOR], buffer); RichString_write(out, CRT_colors[DEFAULT_COLOR], buffer);
} }
ListItem* ListItem_new(char* value, int key) { ListItem* ListItem_new(const char* value, int key) {
ListItem* this = malloc(sizeof(ListItem)); ListItem* this = malloc(sizeof(ListItem));
Object_setClass(this, LISTITEM_CLASS); Object_setClass(this, LISTITEM_CLASS);
((Object*)this)->display = ListItem_display; ((Object*)this)->display = ListItem_display;
......
...@@ -30,7 +30,7 @@ extern char* LISTITEM_CLASS; ...@@ -30,7 +30,7 @@ extern char* LISTITEM_CLASS;
#define LISTITEM_CLASS NULL #define LISTITEM_CLASS NULL
#endif #endif
ListItem* ListItem_new(char* value, int key); ListItem* ListItem_new(const char* value, int key);
void ListItem_append(ListItem* this, char* text); void ListItem_append(ListItem* this, char* text);
......
...@@ -21,10 +21,10 @@ int LoadMeter_attributes[] = { LOAD }; ...@@ -21,10 +21,10 @@ int LoadMeter_attributes[] = { LOAD };
static inline void LoadAverageMeter_scan(double* one, double* five, double* fifteen) { static inline void LoadAverageMeter_scan(double* one, double* five, double* fifteen) {
int activeProcs, totalProcs, lastProc; int activeProcs, totalProcs, lastProc;
FILE *fd = fopen(PROCDIR "/loadavg", "r"); FILE *fd = fopen(PROCDIR "/loadavg", "r");
int read = fscanf(fd, "%lf %lf %lf %d/%d %d", one, five, fifteen, int total = fscanf(fd, "%lf %lf %lf %d/%d %d", one, five, fifteen,
&activeProcs, &totalProcs, &lastProc); &activeProcs, &totalProcs, &lastProc);
(void) read; (void) total;
assert(read == 6); assert(total == 6);
fclose(fd); fclose(fd);
} }
......
...@@ -38,11 +38,11 @@ static void MemoryMeter_setValues(Meter* this, char* buffer, int size) { ...@@ -38,11 +38,11 @@ static void MemoryMeter_setValues(Meter* this, char* buffer, int size) {
static void MemoryMeter_display(Object* cast, RichString* out) { static void MemoryMeter_display(Object* cast, RichString* out) {
char buffer[50]; char buffer[50];
Meter* this = (Meter*)cast; Meter* this = (Meter*)cast;
int div = 1024; char* format = "%ldM "; int k = 1024; const char* format = "%ldM ";
long int totalMem = this->total / div; long int totalMem = this->total / k;
long int usedMem = this->values[0] / div; long int usedMem = this->values[0] / k;
long int buffersMem = this->values[1] / div; long int buffersMem = this->values[1] / k;
long int cachedMem = this->values[2] / div; long int cachedMem = this->values[2] / k;
RichString_init(out); RichString_init(out);
RichString_append(out, CRT_colors[METER_TEXT], ":"); RichString_append(out, CRT_colors[METER_TEXT], ":");
sprintf(buffer, format, totalMem); sprintf(buffer, format, totalMem);
......
...@@ -42,7 +42,7 @@ typedef void(*Meter_Draw)(Meter*, int, int, int); ...@@ -42,7 +42,7 @@ typedef void(*Meter_Draw)(Meter*, int, int, int);
struct MeterMode_ { struct MeterMode_ {
Meter_Draw draw; Meter_Draw draw;
char* uiName; const char* uiName;
int h; int h;
}; };
...@@ -53,9 +53,9 @@ struct MeterType_ { ...@@ -53,9 +53,9 @@ struct MeterType_ {
int items; int items;
double total; double total;
int* attributes; int* attributes;
char* name; const char* name;
char* uiName; const char* uiName;
char* caption; const char* caption;
MeterType_Init init; MeterType_Init init;
MeterType_Done done; MeterType_Done done;
MeterType_SetMode setMode; MeterType_SetMode setMode;
...@@ -161,7 +161,7 @@ void Meter_delete(Object* cast) { ...@@ -161,7 +161,7 @@ void Meter_delete(Object* cast) {
free(this); free(this);
} }
void Meter_setCaption(Meter* this, char* caption) { void Meter_setCaption(Meter* this, const char* caption) {
free(this->caption); free(this->caption);
this->caption = strdup(caption); this->caption = strdup(caption);
} }
...@@ -325,7 +325,7 @@ static int GraphMeterMode_colors[21] = { ...@@ -325,7 +325,7 @@ static int GraphMeterMode_colors[21] = {
GRAPH_8, GRAPH_8, GRAPH_9 GRAPH_8, GRAPH_8, GRAPH_9
}; };
static char* GraphMeterMode_characters = "^`'-.,_~'`-.,_~'`-.,_"; static const char* GraphMeterMode_characters = "^`'-.,_~'`-.,_~'`-.,_";
static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
...@@ -345,15 +345,15 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { ...@@ -345,15 +345,15 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
value /= this->total; value /= this->total;
drawBuffer[METER_BUFFER_LEN - 1] = value; drawBuffer[METER_BUFFER_LEN - 1] = value;
for (int i = METER_BUFFER_LEN - w, k = 0; i < METER_BUFFER_LEN; i++, k++) { for (int i = METER_BUFFER_LEN - w, k = 0; i < METER_BUFFER_LEN; i++, k++) {
double value = drawBuffer[i]; value = drawBuffer[i];
DrawDot( CRT_colors[DEFAULT_COLOR], y, ' ' ); DrawDot( CRT_colors[DEFAULT_COLOR], y, ' ' );
DrawDot( CRT_colors[DEFAULT_COLOR], y+1, ' ' ); DrawDot( CRT_colors[DEFAULT_COLOR], y+1, ' ' );
DrawDot( CRT_colors[DEFAULT_COLOR], y+2, ' ' ); DrawDot( CRT_colors[DEFAULT_COLOR], y+2, ' ' );
double threshold = 1.00; double threshold = 1.00;
for (int i = 0; i < 21; i++, threshold -= 0.05) for (int j = 0; j < 21; j++, threshold -= 0.05)
if (value >= threshold) { if (value >= threshold) {
DrawDot(CRT_colors[GraphMeterMode_colors[i]], y+(i/7.0), GraphMeterMode_characters[i]); DrawDot(CRT_colors[GraphMeterMode_colors[j]], y+(j/7.0), GraphMeterMode_characters[j]);
break; break;
} }
} }
...@@ -362,7 +362,7 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { ...@@ -362,7 +362,7 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
/* ---------- LEDMeterMode ---------- */ /* ---------- LEDMeterMode ---------- */
static char* LEDMeterMode_digits[3][10] = { static const char* LEDMeterMode_digits[3][10] = {
{ " __ "," "," __ "," __ "," "," __ "," __ "," __ "," __ "," __ "}, { " __ "," "," __ "," __ "," "," __ "," __ "," __ "," __ "," __ "},
{ "| |"," |"," __|"," __|","|__|","|__ ","|__ "," |","|__|","|__|"}, { "| |"," |"," __|"," __|","|__|","|__ ","|__ "," |","|__|","|__|"},
{ "|__|"," |","|__ "," __|"," |"," __|","|__|"," |","|__|"," __|"}, { "|__|"," |","|__ "," __|"," |"," __|","|__|"," |","|__|"," __|"},
...@@ -374,6 +374,7 @@ static void LEDMeterMode_drawDigit(int x, int y, int n) { ...@@ -374,6 +374,7 @@ static void LEDMeterMode_drawDigit(int x, int y, int n) {
} }
static void LEDMeterMode_draw(Meter* this, int x, int y, int w) { static void LEDMeterMode_draw(Meter* this, int x, int y, int w) {
(void) w;
MeterType* type = this->type; MeterType* type = this->type;
char buffer[METER_BUFFER_LEN]; char buffer[METER_BUFFER_LEN];
type->setValues(this, buffer, METER_BUFFER_LEN - 1); type->setValues(this, buffer, METER_BUFFER_LEN - 1);
......
...@@ -44,7 +44,7 @@ typedef void(*Meter_Draw)(Meter*, int, int, int); ...@@ -44,7 +44,7 @@ typedef void(*Meter_Draw)(Meter*, int, int, int);
struct MeterMode_ { struct MeterMode_ {
Meter_Draw draw; Meter_Draw draw;
char* uiName; const char* uiName;
int h; int h;
}; };
...@@ -55,9 +55,9 @@ struct MeterType_ { ...@@ -55,9 +55,9 @@ struct MeterType_ {
int items; int items;
double total; double total;
int* attributes; int* attributes;
char* name; const char* name;
char* uiName; const char* uiName;
char* caption; const char* caption;
MeterType_Init init; MeterType_Init init;
MeterType_Done done; MeterType_Done done;
MeterType_SetMode setMode; MeterType_SetMode setMode;
...@@ -120,7 +120,7 @@ Meter* Meter_new(ProcessList* pl, int param, MeterType* type); ...@@ -120,7 +120,7 @@ Meter* Meter_new(ProcessList* pl, int param, MeterType* type);
void Meter_delete(Object* cast); void Meter_delete(Object* cast);
void Meter_setCaption(Meter* this, char* caption); void Meter_setCaption(Meter* this, const char* caption);
void Meter_setMode(Meter* this, int modeIndex); void Meter_setMode(Meter* this, int modeIndex);
......
...@@ -87,7 +87,7 @@ static HandlerResult MetersPanel_EventHandler(Panel* super, int ch) { ...@@ -87,7 +87,7 @@ static HandlerResult MetersPanel_EventHandler(Panel* super, int ch) {
return result; return result;
} }
MetersPanel* MetersPanel_new(Settings* settings, char* header, Vector* meters, ScreenManager* scr) { MetersPanel* MetersPanel_new(Settings* settings, const char* header, Vector* meters, ScreenManager* scr) {
MetersPanel* this = (MetersPanel*) malloc(sizeof(MetersPanel)); MetersPanel* this = (MetersPanel*) malloc(sizeof(MetersPanel));
Panel* super = (Panel*) this; Panel* super = (Panel*) this;
Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true); Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true);
......
...@@ -21,6 +21,6 @@ typedef struct MetersPanel_ { ...@@ -21,6 +21,6 @@ typedef struct MetersPanel_ {
} MetersPanel; } MetersPanel;
MetersPanel* MetersPanel_new(Settings* settings, char* header, Vector* meters, ScreenManager* scr); MetersPanel* MetersPanel_new(Settings* settings, const char* header, Vector* meters, ScreenManager* scr);
#endif #endif
...@@ -43,9 +43,9 @@ typedef struct OpenFilesScreen_ { ...@@ -43,9 +43,9 @@ typedef struct OpenFilesScreen_ {
}*/ }*/
static char* tbFunctions[] = {"Refresh", "Done ", NULL}; static const char* tbFunctions[] = {"Refresh", "Done ", NULL};
static char* tbKeys[] = {"F5", "Esc"}; static const char* tbKeys[] = {"F5", "Esc"};
static int tbEvents[] = {KEY_F(5), 27}; static int tbEvents[] = {KEY_F(5), 27};
...@@ -112,7 +112,7 @@ static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(int pid) { ...@@ -112,7 +112,7 @@ static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(int pid) {
static void OpenFilesScreen_scan(OpenFilesScreen* this) { static void OpenFilesScreen_scan(OpenFilesScreen* this) {
Panel* panel = this->display; Panel* panel = this->display;
int index = MAX(Panel_getSelectedIndex(panel), 0); int idx = MAX(Panel_getSelectedIndex(panel), 0);
Panel_prune(panel); Panel_prune(panel);
OpenFiles_ProcessData* process = OpenFilesScreen_getProcessData(this->process->pid); OpenFiles_ProcessData* process = OpenFilesScreen_getProcessData(this->process->pid);
if (process->error == 127) { if (process->error == 127) {
...@@ -144,7 +144,7 @@ static void OpenFilesScreen_scan(OpenFilesScreen* this) { ...@@ -144,7 +144,7 @@ static void OpenFilesScreen_scan(OpenFilesScreen* this) {
} }
free(process); free(process);
Vector_sort(panel->items); Vector_sort(panel->items);
Panel_setSelected(panel, index); Panel_setSelected(panel, idx);
} }
void OpenFilesScreen_run(OpenFilesScreen* this) { void OpenFilesScreen_run(OpenFilesScreen* this) {
......
...@@ -113,7 +113,7 @@ inline void Panel_setRichHeader(Panel* this, RichString header) { ...@@ -113,7 +113,7 @@ inline void Panel_setRichHeader(Panel* this, RichString header) {
this->needsRedraw = true; this->needsRedraw = true;
} }
inline void Panel_setHeader(Panel* this, char* header) { inline void Panel_setHeader(Panel* this, const char* header) {
Panel_setRichHeader(this, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], header)); Panel_setRichHeader(this, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], header));
} }
......
...@@ -76,7 +76,7 @@ void Panel_done(Panel* this); ...@@ -76,7 +76,7 @@ void Panel_done(Panel* this);
extern void Panel_setRichHeader(Panel* this, RichString header); extern void Panel_setRichHeader(Panel* this, RichString header);
extern void Panel_setHeader(Panel* this, char* header); extern void Panel_setHeader(Panel* this, const char* header);
void Panel_setEventHandler(Panel* this, Panel_EventHandler eh); void Panel_setEventHandler(Panel* this, Panel_EventHandler eh);
......
...@@ -73,16 +73,16 @@ typedef struct Process_ { ...@@ -73,16 +73,16 @@ typedef struct Process_ {
struct ProcessList_ *pl; struct ProcessList_ *pl;
bool updated; bool updated;
unsigned int pid; pid_t pid;
char* comm; char* comm;
int indent; int indent;
char state; char state;
bool tag; bool tag;
unsigned int ppid; pid_t ppid;
unsigned int pgrp; unsigned int pgrp;
unsigned int session; unsigned int session;
unsigned int tty_nr; unsigned int tty_nr;
unsigned int tgid; pid_t tgid;
int tpgid; int tpgid;
unsigned long int flags; unsigned long int flags;
#ifdef DEBUG #ifdef DEBUG
...@@ -160,7 +160,7 @@ char* PROCESS_CLASS = "Process"; ...@@ -160,7 +160,7 @@ char* PROCESS_CLASS = "Process";
#define PROCESS_CLASS NULL #define PROCESS_CLASS NULL
#endif #endif
char *Process_fieldNames[] = { const char *Process_fieldNames[] = {
"", "PID", "Command", "STATE", "PPID", "PGRP", "SESSION", "", "PID", "Command", "STATE", "PPID", "PGRP", "SESSION",
"TTY_NR", "TPGID", "FLAGS", "MINFLT", "CMINFLT", "MAJFLT", "CMAJFLT", "TTY_NR", "TPGID", "FLAGS", "MINFLT", "CMINFLT", "MAJFLT", "CMAJFLT",
"UTIME", "STIME", "CUTIME", "CSTIME", "PRIORITY", "NICE", "ITREALVALUE", "UTIME", "STIME", "CUTIME", "CSTIME", "PRIORITY", "NICE", "ITREALVALUE",
...@@ -182,7 +182,7 @@ char *Process_fieldNames[] = { ...@@ -182,7 +182,7 @@ char *Process_fieldNames[] = {
"*** report bug! ***" "*** report bug! ***"
}; };
char *Process_fieldTitles[] = { const char *Process_fieldTitles[] = {
"", " PID ", "Command ", "S ", " PPID ", " PGRP ", " SESN ", "", " PID ", "Command ", "S ", " PPID ", " PGRP ", " SESN ",
" TTY ", "TPGID ", "- ", "- ", "- ", "- ", "- ", " TTY ", "TPGID ", "- ", "- ", "- ", "- ", "- ",
" UTIME+ ", " STIME+ ", "- ", "- ", "PRI ", " NI ", "- ", " UTIME+ ", " STIME+ ", "- ", "- ", "PRI ", " NI ", "- ",
...@@ -198,7 +198,7 @@ char *Process_fieldTitles[] = { ...@@ -198,7 +198,7 @@ char *Process_fieldTitles[] = {
" VXID ", " VXID ",
#endif #endif
#ifdef HAVE_TASKSTATS #ifdef HAVE_TASKSTATS
" RD_CHAR ", " WR_CHAR ", " RD_SYSC ", " WR_SYSC ", " IO_RD ", " IO_WR ", " IO_CANCEL ", " RD_CHAR ", " WR_CHAR ", " RD_SYSC ", " WR_SYSC ", " IO_RBYTES ", " IO_WBYTES ", " IO_CANCEL ",
" IORR ", " IOWR ", " IO ", " IORR ", " IOWR ", " IO ",
#endif #endif
}; };
...@@ -367,7 +367,7 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel ...@@ -367,7 +367,7 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel
case M_SHARE: Process_printLargeNumber(this, str, this->m_share * PAGE_SIZE_KB); return; case M_SHARE: Process_printLargeNumber(this, str, this->m_share * PAGE_SIZE_KB); return;
case ST_UID: snprintf(buffer, n, "%4d ", this->st_uid); break; case ST_UID: snprintf(buffer, n, "%4d ", this->st_uid); break;
case USER: { case USER: {
if (Process_getuid != this->st_uid) if (Process_getuid != (int) this->st_uid)
attr = CRT_colors[PROCESS_SHADOW]; attr = CRT_colors[PROCESS_SHADOW];
if (this->user) { if (this->user) {
snprintf(buffer, n, "%-8s ", this->user); snprintf(buffer, n, "%-8s ", this->user);
...@@ -435,7 +435,7 @@ static void Process_display(Object* cast, RichString* out) { ...@@ -435,7 +435,7 @@ static void Process_display(Object* cast, RichString* out) {
RichString_init(out); RichString_init(out);
for (int i = 0; fields[i]; i++) for (int i = 0; fields[i]; i++)
Process_writeField(this, out, fields[i]); Process_writeField(this, out, fields[i]);
if (this->pl->shadowOtherUsers && this->st_uid != Process_getuid) if (this->pl->shadowOtherUsers && (int)this->st_uid != Process_getuid)
RichString_setAttr(out, CRT_colors[PROCESS_SHADOW]); RichString_setAttr(out, CRT_colors[PROCESS_SHADOW]);
if (this->tag == true) if (this->tag == true)
RichString_setAttr(out, CRT_colors[PROCESS_TAG]); RichString_setAttr(out, CRT_colors[PROCESS_TAG]);
...@@ -467,7 +467,7 @@ Process* Process_new(struct ProcessList_ *pl) { ...@@ -467,7 +467,7 @@ Process* Process_new(struct ProcessList_ *pl) {
} }
Process* Process_clone(Process* this) { Process* Process_clone(Process* this) {
Process* clone = malloc(sizeof(Process)); Process* copy = malloc(sizeof(Process));
#if HAVE_TASKSTATS #if HAVE_TASKSTATS
this->io_rchar = 0; this->io_rchar = 0;
this->io_wchar = 0; this->io_wchar = 0;
...@@ -481,10 +481,10 @@ Process* Process_clone(Process* this) { ...@@ -481,10 +481,10 @@ Process* Process_clone(Process* this) {
this->io_rate_write_time = 0; this->io_rate_write_time = 0;
this->io_cancelled_write_bytes = 0; this->io_cancelled_write_bytes = 0;
#endif #endif
memcpy(clone, this, sizeof(Process)); memcpy(copy, this, sizeof(Process));
this->comm = NULL; this->comm = NULL;
this->pid = 0; this->pid = 0;
return clone; return copy;
} }
void Process_toggleTag(Process* this) { void Process_toggleTag(Process* this) {
...@@ -512,8 +512,8 @@ bool Process_setAffinity(Process* this, unsigned long mask) { ...@@ -512,8 +512,8 @@ bool Process_setAffinity(Process* this, unsigned long mask) {
} }
#endif #endif
void Process_sendSignal(Process* this, int signal) { void Process_sendSignal(Process* this, int sgn) {
kill(this->pid, signal); kill(this->pid, sgn);
} }
int Process_pidCompare(const void* v1, const void* v2) { int Process_pidCompare(const void* v1, const void* v2) {
......
...@@ -46,7 +46,7 @@ in the source distribution for its full text. ...@@ -46,7 +46,7 @@ in the source distribution for its full text.
#ifndef Process_isThread #ifndef Process_isThread
#define Process_isThread(process) (process->pid != process->tgid || process->m_size == 0) #define Process_isThread(_process) (_process->pid != _process->tgid || _process->m_size == 0)
#endif #endif
typedef enum ProcessField_ { typedef enum ProcessField_ {
...@@ -75,16 +75,16 @@ typedef struct Process_ { ...@@ -75,16 +75,16 @@ typedef struct Process_ {
struct ProcessList_ *pl; struct ProcessList_ *pl;
bool updated; bool updated;
unsigned int pid; pid_t pid;
char* comm; char* comm;
int indent; int indent;
char state; char state;
bool tag; bool tag;
unsigned int ppid; pid_t ppid;
unsigned int pgrp; unsigned int pgrp;
unsigned int session; unsigned int session;
unsigned int tty_nr; unsigned int tty_nr;
unsigned int tgid; pid_t tgid;
int tpgid; int tpgid;
unsigned long int flags; unsigned long int flags;
#ifdef DEBUG #ifdef DEBUG
...@@ -161,9 +161,9 @@ extern char* PROCESS_CLASS; ...@@ -161,9 +161,9 @@ extern char* PROCESS_CLASS;
#define PROCESS_CLASS NULL #define PROCESS_CLASS NULL
#endif #endif
extern char *Process_fieldNames[]; extern const char *Process_fieldNames[];
extern char *Process_fieldTitles[]; extern const char *Process_fieldTitles[];
#define ONE_K 1024 #define ONE_K 1024
#define ONE_M (ONE_K * ONE_K) #define ONE_M (ONE_K * ONE_K)
...@@ -185,7 +185,7 @@ unsigned long Process_getAffinity(Process* this); ...@@ -185,7 +185,7 @@ unsigned long Process_getAffinity(Process* this);
bool Process_setAffinity(Process* this, unsigned long mask); bool Process_setAffinity(Process* this, unsigned long mask);
#endif #endif
void Process_sendSignal(Process* this, int signal); void Process_sendSignal(Process* this, int sgn);
int Process_pidCompare(const void* v1, const void* v2); int Process_pidCompare(const void* v1, const void* v2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment