From 459733295954ec0d5958f9a8d955d0c164876c84 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 9 Sep 2020 19:38:15 +1000 Subject: Switch variable/field naming from WhiteList to MatchList --- ProcessList.c | 6 +++--- ProcessList.h | 6 +++--- darwin/DarwinProcessList.c | 4 ++-- darwin/DarwinProcessList.h | 2 +- dragonflybsd/DragonFlyBSDProcessList.c | 4 ++-- dragonflybsd/DragonFlyBSDProcessList.h | 2 +- freebsd/FreeBSDProcessList.c | 4 ++-- freebsd/FreeBSDProcessList.h | 2 +- htop.c | 16 ++++++++-------- linux/LinuxProcessList.c | 4 ++-- linux/LinuxProcessList.h | 2 +- openbsd/OpenBSDProcessList.c | 2 +- openbsd/OpenBSDProcessList.h | 2 +- solaris/SolarisProcessList.c | 4 ++-- solaris/SolarisProcessList.h | 2 +- unsupported/UnsupportedProcessList.c | 4 ++-- unsupported/UnsupportedProcessList.h | 2 +- 17 files changed, 34 insertions(+), 34 deletions(-) diff --git a/ProcessList.c b/ProcessList.c index 025c87af..aa529d5b 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -15,11 +15,11 @@ in the source distribution for its full text. #include -ProcessList* ProcessList_init(ProcessList* this, ObjectClass* klass, UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { +ProcessList* ProcessList_init(ProcessList* this, ObjectClass* klass, UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) { this->processes = Vector_new(klass, true, DEFAULT_SIZE); this->processTable = Hashtable_new(140, false); this->usersTable = usersTable; - this->pidWhiteList = pidWhiteList; + this->pidMatchList = pidMatchList; this->userId = userId; // tree-view auxiliary buffer @@ -254,7 +254,7 @@ void ProcessList_rebuildPanel(ProcessList* this) { if ( (!p->show) || (this->userId != (uid_t) -1 && (p->st_uid != this->userId)) || (incFilter && !(String_contains_i(p->comm, incFilter))) - || (this->pidWhiteList && !Hashtable_get(this->pidWhiteList, p->tgid)) ) + || (this->pidMatchList && !Hashtable_get(this->pidMatchList, p->tgid)) ) hidden = true; if (!hidden) { diff --git a/ProcessList.h b/ProcessList.h index 73f6c687..7b572d8f 100644 --- a/ProcessList.h +++ b/ProcessList.h @@ -38,7 +38,7 @@ typedef struct ProcessList_ { int following; uid_t userId; const char* incFilter; - Hashtable* pidWhiteList; + Hashtable* pidMatchList; #ifdef HAVE_LIBHWLOC hwloc_topology_t topology; @@ -64,12 +64,12 @@ typedef struct ProcessList_ { } ProcessList; -ProcessList* ProcessList_new(UsersTable* ut, Hashtable* pidWhiteList, uid_t userId); +ProcessList* ProcessList_new(UsersTable* ut, Hashtable* pidMatchList, uid_t userId); void ProcessList_delete(ProcessList* pl); void ProcessList_goThroughEntries(ProcessList* pl); -ProcessList* ProcessList_init(ProcessList* this, ObjectClass* klass, UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId); +ProcessList* ProcessList_init(ProcessList* this, ObjectClass* klass, UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId); void ProcessList_done(ProcessList* this); diff --git a/darwin/DarwinProcessList.c b/darwin/DarwinProcessList.c index cedabc9d..39d99c15 100644 --- a/darwin/DarwinProcessList.c +++ b/darwin/DarwinProcessList.c @@ -114,11 +114,11 @@ struct kinfo_proc *ProcessList_getKInfoProcs(size_t *count) { return processes; } -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) { size_t len; DarwinProcessList* this = xCalloc(1, sizeof(DarwinProcessList)); - ProcessList_init(&this->super, Class(Process), usersTable, pidWhiteList, userId); + ProcessList_init(&this->super, Class(Process), usersTable, pidMatchList, userId); /* Initialize the CPU information */ this->super.cpuCount = ProcessList_allocateCPULoadInfo(&this->prev_load); diff --git a/darwin/DarwinProcessList.h b/darwin/DarwinProcessList.h index 7d6f5343..c6b29665 100644 --- a/darwin/DarwinProcessList.h +++ b/darwin/DarwinProcessList.h @@ -47,7 +47,7 @@ void ProcessList_getVMStats(vm_statistics_t p); struct kinfo_proc *ProcessList_getKInfoProcs(size_t *count); -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId); +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId); void ProcessList_delete(ProcessList* this); diff --git a/dragonflybsd/DragonFlyBSDProcessList.c b/dragonflybsd/DragonFlyBSDProcessList.c index 08303ba6..cd5526a7 100644 --- a/dragonflybsd/DragonFlyBSDProcessList.c +++ b/dragonflybsd/DragonFlyBSDProcessList.c @@ -41,12 +41,12 @@ static int MIB_kern_cp_time[2]; static int MIB_kern_cp_times[2]; static int kernelFScale; -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) { size_t len; char errbuf[_POSIX2_LINE_MAX]; DragonFlyBSDProcessList* dfpl = xCalloc(1, sizeof(DragonFlyBSDProcessList)); ProcessList* pl = (ProcessList*) dfpl; - ProcessList_init(pl, Class(DragonFlyBSDProcess), usersTable, pidWhiteList, userId); + ProcessList_init(pl, Class(DragonFlyBSDProcess), usersTable, pidMatchList, userId); // physical memory in system: hw.physmem // physical page size: hw.pagesize diff --git a/dragonflybsd/DragonFlyBSDProcessList.h b/dragonflybsd/DragonFlyBSDProcessList.h index 403aa096..84ab1c5a 100644 --- a/dragonflybsd/DragonFlyBSDProcessList.h +++ b/dragonflybsd/DragonFlyBSDProcessList.h @@ -53,7 +53,7 @@ typedef struct DragonFlyBSDProcessList_ { #define _UNUSED_ __attribute__((unused)) -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId); +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId); void ProcessList_delete(ProcessList* this); diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c index a4deaad9..6318d424 100644 --- a/freebsd/FreeBSDProcessList.c +++ b/freebsd/FreeBSDProcessList.c @@ -41,12 +41,12 @@ static int MIB_kern_cp_time[2]; static int MIB_kern_cp_times[2]; static int kernelFScale; -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) { size_t len; char errbuf[_POSIX2_LINE_MAX]; FreeBSDProcessList* fpl = xCalloc(1, sizeof(FreeBSDProcessList)); ProcessList* pl = (ProcessList*) fpl; - ProcessList_init(pl, Class(FreeBSDProcess), usersTable, pidWhiteList, userId); + ProcessList_init(pl, Class(FreeBSDProcess), usersTable, pidMatchList, userId); // physical memory in system: hw.physmem // physical page size: hw.pagesize diff --git a/freebsd/FreeBSDProcessList.h b/freebsd/FreeBSDProcessList.h index 1805c5af..281bf3e2 100644 --- a/freebsd/FreeBSDProcessList.h +++ b/freebsd/FreeBSDProcessList.h @@ -48,7 +48,7 @@ typedef struct FreeBSDProcessList_ { } FreeBSDProcessList; -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId); +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId); void ProcessList_delete(ProcessList* this); diff --git a/htop.c b/htop.c index 37727d00..2cf2602e 100644 --- a/htop.c +++ b/htop.c @@ -57,7 +57,7 @@ static void printHelpFlag() { // ---------------------------------------- typedef struct CommandLineSettings_ { - Hashtable* pidWhiteList; + Hashtable* pidMatchList; uid_t userId; int sortKey; int delay; @@ -70,7 +70,7 @@ typedef struct CommandLineSettings_ { static CommandLineSettings parseArguments(int argc, char** argv) { CommandLineSettings flags = { - .pidWhiteList = NULL, + .pidMatchList = NULL, .userId = -1, // -1 is guaranteed to be an invalid uid_t (see setreuid(2)) .sortKey = 0, .delay = -1, @@ -163,13 +163,13 @@ static CommandLineSettings parseArguments(int argc, char** argv) { char* saveptr; char* pid = strtok_r(argCopy, ",", &saveptr); - if(!flags.pidWhiteList) { - flags.pidWhiteList = Hashtable_new(8, false); + if(!flags.pidMatchList) { + flags.pidMatchList = Hashtable_new(8, false); } while(pid) { unsigned int num_pid = atoi(pid); - Hashtable_put(flags.pidWhiteList, num_pid, (void *) 1); + Hashtable_put(flags.pidMatchList, num_pid, (void *) 1); pid = strtok_r(NULL, ",", &saveptr); } free(argCopy); @@ -215,7 +215,7 @@ int main(int argc, char** argv) { Process_setupColumnWidths(); UsersTable* ut = UsersTable_new(); - ProcessList* pl = ProcessList_new(ut, flags.pidWhiteList, flags.userId); + ProcessList* pl = ProcessList_new(ut, flags.pidMatchList, flags.userId); Settings* settings = Settings_new(pl->cpuCount); pl->settings = settings; @@ -281,8 +281,8 @@ int main(int argc, char** argv) { UsersTable_delete(ut); Settings_delete(settings); - if(flags.pidWhiteList) { - Hashtable_delete(flags.pidWhiteList); + if(flags.pidMatchList) { + Hashtable_delete(flags.pidMatchList); } return 0; } diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index c9303a04..8dae13c5 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -149,11 +149,11 @@ static void LinuxProcessList_initNetlinkSocket(LinuxProcessList* this) { #endif -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) { LinuxProcessList* this = xCalloc(1, sizeof(LinuxProcessList)); ProcessList* pl = &(this->super); - ProcessList_init(pl, Class(LinuxProcess), usersTable, pidWhiteList, userId); + ProcessList_init(pl, Class(LinuxProcess), usersTable, pidMatchList, userId); LinuxProcessList_initTtyDrivers(this); #ifdef HAVE_DELAYACCT diff --git a/linux/LinuxProcessList.h b/linux/LinuxProcessList.h index aa7317ab..c484e75c 100644 --- a/linux/LinuxProcessList.h +++ b/linux/LinuxProcessList.h @@ -92,7 +92,7 @@ typedef struct LinuxProcessList_ { #define PROC_LINE_LENGTH 4096 #endif -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId); +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId); void ProcessList_delete(ProcessList* pl); diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c index 71cd5627..0fe43ba7 100644 --- a/openbsd/OpenBSDProcessList.c +++ b/openbsd/OpenBSDProcessList.c @@ -29,7 +29,7 @@ in the source distribution for its full text. static long fscale; -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) { int mib[] = { CTL_HW, HW_NCPU }; int fmib[] = { CTL_KERN, KERN_FSCALE }; int i, e; diff --git a/openbsd/OpenBSDProcessList.h b/openbsd/OpenBSDProcessList.h index d22243f7..0d9defbc 100644 --- a/openbsd/OpenBSDProcessList.h +++ b/openbsd/OpenBSDProcessList.h @@ -39,7 +39,7 @@ typedef struct OpenBSDProcessList_ { } OpenBSDProcessList; -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId); +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId); void ProcessList_delete(ProcessList* this); diff --git a/solaris/SolarisProcessList.c b/solaris/SolarisProcessList.c index e4074a7e..4e4d2828 100644 --- a/solaris/SolarisProcessList.c +++ b/solaris/SolarisProcessList.c @@ -38,10 +38,10 @@ char* SolarisProcessList_readZoneName(kstat_ctl_t* kd, SolarisProcess* sproc) { return zname; } -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) { SolarisProcessList* spl = xCalloc(1, sizeof(SolarisProcessList)); ProcessList* pl = (ProcessList*) spl; - ProcessList_init(pl, Class(SolarisProcess), usersTable, pidWhiteList, userId); + ProcessList_init(pl, Class(SolarisProcess), usersTable, pidMatchList, userId); spl->kd = kstat_open(); diff --git a/solaris/SolarisProcessList.h b/solaris/SolarisProcessList.h index 25962685..9da39b4a 100644 --- a/solaris/SolarisProcessList.h +++ b/solaris/SolarisProcessList.h @@ -48,7 +48,7 @@ typedef struct SolarisProcessList_ { char* SolarisProcessList_readZoneName(kstat_ctl_t* kd, SolarisProcess* sproc); -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId); +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId); void ProcessList_delete(ProcessList* pl); diff --git a/unsupported/UnsupportedProcessList.c b/unsupported/UnsupportedProcessList.c index cad579c2..fc8a54dc 100644 --- a/unsupported/UnsupportedProcessList.c +++ b/unsupported/UnsupportedProcessList.c @@ -12,9 +12,9 @@ in the source distribution for its full text. #include -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) { ProcessList* this = xCalloc(1, sizeof(ProcessList)); - ProcessList_init(this, Class(Process), usersTable, pidWhiteList, userId); + ProcessList_init(this, Class(Process), usersTable, pidMatchList, userId); return this; } diff --git a/unsupported/UnsupportedProcessList.h b/unsupported/UnsupportedProcessList.h index 69a7c1c7..c4b51acf 100644 --- a/unsupported/UnsupportedProcessList.h +++ b/unsupported/UnsupportedProcessList.h @@ -7,7 +7,7 @@ Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ -ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId); +ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId); void ProcessList_delete(ProcessList* this); -- cgit v1.2.3