Mark process argument of Process_isThread const

This commit is contained in:
Christian Göttsche 2020-10-07 19:02:15 +02:00 committed by cgzones
parent 7fa0f19ffd
commit 41eea8a355
17 changed files with 22 additions and 22 deletions

View File

@ -20,7 +20,7 @@ static const char* const InfoScreenKeys[] = {"F3", "F4", "F5", "Esc"};
static int InfoScreenEvents[] = {KEY_F(3), KEY_F(4), KEY_F(5), 27};
InfoScreen* InfoScreen_init(InfoScreen* this, Process* process, FunctionBar* bar, int height, const char* panelHeader) {
InfoScreen* InfoScreen_init(InfoScreen* this, const Process* process, FunctionBar* bar, int height, const char* panelHeader) {
this->process = process;
if (!bar) {
bar = FunctionBar_new(InfoScreenFunctions, InfoScreenKeys, InfoScreenEvents);

View File

@ -29,14 +29,14 @@ typedef struct InfoScreenClass_ {
struct InfoScreen_ {
Object super;
Process* process;
const Process* process;
Panel* display;
FunctionBar* bar;
IncSet* inc;
Vector* lines;
};
InfoScreen* InfoScreen_init(InfoScreen* this, Process* process, FunctionBar* bar, int height, const char* panelHeader);
InfoScreen* InfoScreen_init(InfoScreen* this, const Process* process, FunctionBar* bar, int height, const char* panelHeader);
InfoScreen* InfoScreen_done(InfoScreen* this);

View File

@ -116,7 +116,7 @@ typedef struct ProcessFieldData_ {
void Process_writeField(Process* this, RichString* str, ProcessField field);
long Process_compare(const void* v1, const void* v2);
void Process_delete(Object* cast);
bool Process_isThread(Process* this);
bool Process_isThread(const Process* this);
extern ProcessFieldData Process_fields[];
extern ProcessPidColumn Process_pidColumns[];
extern char Process_pidFormat[20];

View File

@ -45,7 +45,7 @@ void Process_delete(Object* cast) {
free(this);
}
bool Process_isThread(Process* this) {
bool Process_isThread(const Process* this) {
(void) this;
return false;
}

View File

@ -26,7 +26,7 @@ DarwinProcess* DarwinProcess_new(Settings* settings);
void Process_delete(Object* cast);
bool Process_isThread(Process* this);
bool Process_isThread(const Process* this);
void DarwinProcess_setStartTime(Process *proc, struct extern_proc *ep, time_t now);

View File

@ -128,8 +128,8 @@ long DragonFlyBSDProcess_compare(const void* v1, const void* v2) {
}
}
bool Process_isThread(Process* this) {
DragonFlyBSDProcess* fp = (DragonFlyBSDProcess*) this;
bool Process_isThread(const Process* this) {
const DragonFlyBSDProcess* fp = (const DragonFlyBSDProcess*) this;
if (fp->kernel == 1 )
return 1;

View File

@ -41,6 +41,6 @@ void DragonFlyBSDProcess_writeField(Process* this, RichString* str, ProcessField
long DragonFlyBSDProcess_compare(const void* v1, const void* v2);
bool Process_isThread(Process* this);
bool Process_isThread(const Process* this);
#endif

View File

@ -127,8 +127,8 @@ long FreeBSDProcess_compare(const void* v1, const void* v2) {
}
}
bool Process_isThread(Process* this) {
FreeBSDProcess* fp = (FreeBSDProcess*) this;
bool Process_isThread(const Process* this) {
const FreeBSDProcess* fp = (const FreeBSDProcess*) this;
if (fp->kernel == 1 )
return 1;

View File

@ -39,6 +39,6 @@ void FreeBSDProcess_writeField(Process* this, RichString* str, ProcessField fiel
long FreeBSDProcess_compare(const void* v1, const void* v2);
bool Process_isThread(Process* this);
bool Process_isThread(const Process* this);
#endif

View File

@ -389,6 +389,6 @@ long LinuxProcess_compare(const void* v1, const void* v2) {
return (diff > 0) ? 1 : (diff < 0 ? -1 : 0);
}
bool Process_isThread(Process* this) {
bool Process_isThread(const Process* this) {
return (Process_isUserlandThread(this) || Process_isKernelThread(this));
}

View File

@ -147,7 +147,7 @@ typedef struct LinuxProcess_ {
char *secattr;
} LinuxProcess;
#define Process_isKernelThread(_process) (((LinuxProcess*)(_process))->isKernelThread)
#define Process_isKernelThread(_process) (((const LinuxProcess*)(_process))->isKernelThread)
#define Process_isUserlandThread(_process) (_process->pid != _process->tgid)
@ -185,6 +185,6 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field)
long LinuxProcess_compare(const void* v1, const void* v2);
bool Process_isThread(Process* this);
bool Process_isThread(const Process* this);
#endif

View File

@ -209,6 +209,6 @@ long OpenBSDProcess_compare(const void* v1, const void* v2) {
}
}
bool Process_isThread(Process* this) {
bool Process_isThread(const Process* this) {
return (Process_isKernelThread(this));
}

View File

@ -35,6 +35,6 @@ void OpenBSDProcess_writeField(Process* this, RichString* str, ProcessField fiel
long OpenBSDProcess_compare(const void* v1, const void* v2);
bool Process_isThread(Process* this);
bool Process_isThread(const Process* this);
#endif

View File

@ -150,8 +150,8 @@ long SolarisProcess_compare(const void* v1, const void* v2) {
}
}
bool Process_isThread(Process* this) {
SolarisProcess* fp = (SolarisProcess*) this;
bool Process_isThread(const Process* this) {
const SolarisProcess* fp = (const SolarisProcess*) this;
if (fp->kernel == 1 ) {
return 1;

View File

@ -58,6 +58,6 @@ void SolarisProcess_writeField(Process* this, RichString* str, ProcessField fiel
long SolarisProcess_compare(const void* v1, const void* v2);
bool Process_isThread(Process* this);
bool Process_isThread(const Process* this);
#endif

View File

@ -131,7 +131,7 @@ void Platform_setSwapValues(Meter* this) {
(void) this;
}
bool Process_isThread(Process* this) {
bool Process_isThread(const Process* this) {
(void) this;
return false;
}

View File

@ -43,7 +43,7 @@ void Platform_setMemoryValues(Meter* this);
void Platform_setSwapValues(Meter* this);
bool Process_isThread(Process* this);
bool Process_isThread(const Process* this);
char* Platform_getProcessEnv(pid_t pid);