From 2ee50d030178cede83eb9d0005fbc19f819d30fe Mon Sep 17 00:00:00 2001 From: Graham Inggs Date: Mon, 5 Feb 2018 14:48:51 +0200 Subject: Imported Upstream version 2.1.0 --- freebsd/FreeBSDProcess.c | 10 +++++----- freebsd/FreeBSDProcessList.c | 14 +++++++------- freebsd/Platform.c | 4 ++-- freebsd/Platform.h | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'freebsd') diff --git a/freebsd/FreeBSDProcess.c b/freebsd/FreeBSDProcess.c index b0d2c37..f81fadf 100644 --- a/freebsd/FreeBSDProcess.c +++ b/freebsd/FreeBSDProcess.c @@ -61,8 +61,8 @@ ProcessFieldData Process_fields[] = { [STATE] = { .name = "STATE", .title = "S ", .description = "Process state (S sleeping, R running, D disk, Z zombie, T traced, W paging)", .flags = 0, }, [PPID] = { .name = "PPID", .title = " PPID ", .description = "Parent process ID", .flags = 0, }, [PGRP] = { .name = "PGRP", .title = " PGRP ", .description = "Process group ID", .flags = 0, }, - [SESSION] = { .name = "SESSION", .title = " SESN ", .description = "Process's session ID", .flags = 0, }, - [TTY_NR] = { .name = "TTY_NR", .title = " TTY ", .description = "Controlling terminal", .flags = 0, }, + [SESSION] = { .name = "SESSION", .title = " SID ", .description = "Process's session ID", .flags = 0, }, + [TTY_NR] = { .name = "TTY_NR", .title = " TTY ", .description = "Controlling terminal", .flags = 0, }, [TPGID] = { .name = "TPGID", .title = " TPGID ", .description = "Process ID of the fg process group of the controlling terminal", .flags = 0, }, [MINFLT] = { .name = "MINFLT", .title = " MINFLT ", .description = "Number of minor faults which have not required loading a memory page from disk", .flags = 0, }, [MAJFLT] = { .name = "MAJFLT", .title = " MAJFLT ", .description = "Number of major faults which have required loading a memory page from disk", .flags = 0, }, @@ -92,7 +92,7 @@ ProcessPidColumn Process_pidColumns[] = { { .id = TPGID, .label = "TPGID" }, { .id = TGID, .label = "TGID" }, { .id = PGRP, .label = "PGRP" }, - { .id = SESSION, .label = "SESN" }, + { .id = SESSION, .label = "SID" }, { .id = 0, .label = NULL }, }; @@ -117,9 +117,9 @@ void FreeBSDProcess_writeField(Process* this, RichString* str, ProcessField fiel int n = sizeof(buffer) - 1; switch ((int) field) { // add FreeBSD-specific fields here - case JID: snprintf(buffer, n, Process_pidFormat, fp->jid); break; + case JID: xSnprintf(buffer, n, Process_pidFormat, fp->jid); break; case JAIL:{ - snprintf(buffer, n, "%-11s ", fp->jname); break; + xSnprintf(buffer, n, "%-11s ", fp->jname); break; if (buffer[11] != '\0') { buffer[11] = ' '; buffer[12] = '\0'; diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c index b58e6e6..9fef324 100644 --- a/freebsd/FreeBSDProcessList.c +++ b/freebsd/FreeBSDProcessList.c @@ -151,10 +151,10 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui fpl->cp_time_n = xCalloc(cpus, sizeof_cp_time_array); len = sizeof_cp_time_array; - // fetch intial single (or average) CPU clicks from kernel + // fetch initial single (or average) CPU clicks from kernel sysctl(MIB_kern_cp_time, 2, fpl->cp_time_o, &len, NULL, 0); - // on smp box, fetch rest of intial CPU's clicks + // on smp box, fetch rest of initial CPU's clicks if (cpus > 1) { len = 2; sysctlnametomib("kern.cp_times", MIB_kern_cp_times, &len); fpl->cp_times_o = xCalloc(cpus, sizeof_cp_time_array); @@ -175,7 +175,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui len = sizeof(kernelFScale); if (sysctlbyname("kern.fscale", &kernelFScale, &len, NULL, 0) == -1) { - //sane default for kernel provded CPU precentage scaling, at least on x86 machines, in case this sysctl call failed + //sane default for kernel provided CPU percentage scaling, at least on x86 machines, in case this sysctl call failed kernelFScale = 2048; } @@ -398,7 +398,7 @@ char* FreeBSDProcessList_readJailName(struct kinfo_proc* kproc) { jid = jail_get(jiov, 6, 0); if (jid < 0) { if (!jail_errmsg[0]) - snprintf(jail_errmsg, JAIL_ERRMSGLEN, "jail_get: %s", strerror(errno)); + xSnprintf(jail_errmsg, JAIL_ERRMSGLEN, "jail_get: %s", strerror(errno)); return NULL; } else if (jid == kproc->ki_jid) { jname = xStrdup(jnamebuf); @@ -459,17 +459,17 @@ void ProcessList_goThroughEntries(ProcessList* this) { fp->jname = FreeBSDProcessList_readJailName(kproc); } else { if(fp->jid != kproc->ki_jid) { - // proces can enter jail anytime + // process can enter jail anytime fp->jid = kproc->ki_jid; free(fp->jname); fp->jname = FreeBSDProcessList_readJailName(kproc); } if (proc->ppid != kproc->ki_ppid) { - // if there are reapers in the system, proces can get reparented anytime + // if there are reapers in the system, process can get reparented anytime proc->ppid = kproc->ki_ppid; } if(proc->st_uid != kproc->ki_uid) { - // some proceses change users (eg. to lower privs) + // some processes change users (eg. to lower privs) proc->st_uid = kproc->ki_uid; proc->user = UsersTable_getRef(this->usersTable, proc->st_uid); } diff --git a/freebsd/Platform.c b/freebsd/Platform.c index f02daa5..5dd6ca4 100644 --- a/freebsd/Platform.c +++ b/freebsd/Platform.c @@ -43,7 +43,7 @@ ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_R int Platform_numberOfFields = LAST_PROCESSFIELD; -SignalItem Platform_signals[] = { +const SignalItem Platform_signals[] = { { .name = " 0 Cancel", .number = 0 }, { .name = " 1 SIGHUP", .number = 1 }, { .name = " 2 SIGINT", .number = 2 }, @@ -80,7 +80,7 @@ SignalItem Platform_signals[] = { { .name = "33 SIGLIBRT", .number = 33 }, }; -unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem); +const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem); void Platform_setBindings(Htop_Action* keys) { (void) keys; diff --git a/freebsd/Platform.h b/freebsd/Platform.h index ecc0dcd..1735e7e 100644 --- a/freebsd/Platform.h +++ b/freebsd/Platform.h @@ -24,9 +24,9 @@ extern ProcessField Platform_defaultFields[]; extern int Platform_numberOfFields; -extern SignalItem Platform_signals[]; +extern const SignalItem Platform_signals[]; -extern unsigned int Platform_numberOfSignals; +extern const unsigned int Platform_numberOfSignals; void Platform_setBindings(Htop_Action* keys); -- cgit v1.2.3