# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= htop VERSION= 3.3.0 KEYWORDS= sysutils VARIANTS= standard SDESC[standard]= Interactive process viewer for Unix HOMEPAGE= https://hisham.hm/htop/ CONTACT= nobody DOWNLOAD_GROUPS= main SITES[main]= GITHUB/htop-dev:htop:3.3.0 DISTFILE[1]= generated:main DF_INDEX= 1 SPKGS[standard]= single OPTIONS_AVAILABLE= none OPTIONS_STANDARD= none USES= autoreconf libtool ncurses pkgconfig execinfo bdb:5 python:build LICENSE= GPLv2:single LICENSE_TERMS= single:{{WRKDIR}}/TERMS LICENSE_FILE= GPLv2:{{WRKSRC}}/COPYING LICENSE_SCHEME= solo FPC_EQUIVALENT= sysutils/htop MUST_CONFIGURE= gnu CONFIGURE_ARGS= --enable-unicode post-extract: ${AWK} '/## License/ { x=1 } {if (x) print $$0;}' \ ${WRKSRC}/README > ${WRKDIR}/TERMS [FILE:825:descriptions/desc.single] htop is an enhanced version of top, the interactive process viewer, which can display the list of processes in a tree form. Comparison between 'htop' and 'top' * In 'htop' you can scroll the list vertically and horizontally to see all processes and full command lines. * In 'top' you are subject to a delay for each unassigned key you press (especially when multi-key escape sequences are triggered by accident). * 'htop' starts faster ('top' seems to collect data for a while before displaying anything). * In 'htop' you don't need to type the process number to kill a process, in 'top' you do. * In 'htop' you don't need to type the process number or the priority value to renice a process, in 'top' you do. * In 'htop' you can kill multiple processes at once. * 'top' is older, hence, more tested. [FILE:105:distinfo] 1e5cc328eee2bd1acff89f860e3179ea24b85df3ac483433f92a29977b14b045 406012 htop-dev-htop-3.3.0.tar.gz [FILE:132:manifests/plist.single] bin/htop share/applications/htop.desktop share/icons/hicolor/scalable/apps/htop.svg share/man/man1/htop.1.gz share/pixmaps/htop.png [FILE:1319:patches/patch-dragonflybsd_DragonFlyBSDMachine.c] --- dragonflybsd/DragonFlyBSDMachine.c.orig 2024-01-10 09:54:15 UTC +++ dragonflybsd/DragonFlyBSDMachine.c @@ -119,7 +119,7 @@ Machine* Machine_new(UsersTable* usersTa } void Machine_delete(Machine* super) { - const DragonFlyBSDMachine* this = (const DragonFlyBSDMachine*) super; + DragonFlyBSDMachine* this = (DragonFlyBSDMachine*) super; Machine_done(super); @@ -223,7 +223,7 @@ static void DragonFlyBSDMachine_scanCPUT } static void DragonFlyBSDMachine_scanMemoryInfo(Machine* super) { - DragonFlyBSDMachine* this = (DragonFlyBSDProcessTable*) super; + DragonFlyBSDMachine* this = (DragonFlyBSDMachine*) super; // @etosan: // memory counter relationships seem to be these: @@ -319,7 +319,7 @@ retry: free(jails); } -char* DragonFlyBSDMachine_readJailName(DragonFlyBSDMachine* host, int jailid) { +char* DragonFlyBSDMachine_readJailName(const DragonFlyBSDMachine* host, int jailid) { char* hostname; char* jname; @@ -339,3 +339,12 @@ void Machine_scan(Machine* super) { DragonFlyBSDMachine_scanCPUTime(super); DragonFlyBSDMachine_scanJails(this); } + +bool Machine_isCPUonline(const Machine* host, unsigned int id) { + assert(id < host->existingCPUs); + + // TODO: support offline CPUs and hot swapping + (void) host; (void) id; + + return true; +} [FILE:396:patches/patch-dragonflybsd_DragonFlyBSDMachine.h] --- dragonflybsd/DragonFlyBSDMachine.h.orig 2024-01-10 09:54:15 UTC +++ dragonflybsd/DragonFlyBSDMachine.h @@ -56,6 +56,6 @@ typedef struct DragonFlyBSDMachine_ { unsigned long* cp_times_n; } DragonFlyBSDMachine; -char* DragonFlyBSDMachine_readJailName(DragonFlyBSDMachine* host, int jailid); +char* DragonFlyBSDMachine_readJailName(const DragonFlyBSDMachine* host, int jailid); #endif [FILE:1921:patches/patch-dragonflybsd_DragonFlyBSDProcessTable.c] --- dragonflybsd/DragonFlyBSDProcessTable.c.orig 2024-01-10 09:54:15 UTC +++ dragonflybsd/DragonFlyBSDProcessTable.c @@ -37,7 +37,7 @@ ProcessTable* ProcessTable_new(Machine* } void ProcessTable_delete(Object* cast) { - const DragonFlyBSDProcessTable* this = (DragonFlyBSDProcessTable*) cast; + DragonFlyBSDProcessTable* this = (DragonFlyBSDProcessTable*) cast; ProcessTable_done(&this->super); free(this); } @@ -130,8 +130,8 @@ static void DragonFlyBSDProcessTable_upd } void ProcessTable_goThroughEntries(ProcessTable* super) { - const Machine* host = super->host; - const DragonFlyMachine* dhost = (const DragonFlyMachine*) host; + const Machine* host = super->super.host; + const DragonFlyBSDMachine* dhost = (const DragonFlyBSDMachine*) host; const Settings* settings = host->settings; bool hideKernelThreads = settings->hideKernelThreads; @@ -168,7 +168,7 @@ void ProcessTable_goThroughEntries(Proce proc->pgrp = kproc->kp_pgid; // process group id proc->session = kproc->kp_sid; proc->st_uid = kproc->kp_uid; // user ID - proc->processor = kproc->kp_lwp.kl_origcpu; + proc->processor = kproc->kp_lwp.kl_cpuid; proc->starttime_ctime = kproc->kp_start.tv_sec; Process_fillStarttimeBuffer(proc); proc->user = UsersTable_getRef(host->usersTable, proc->st_uid); @@ -216,7 +216,7 @@ void ProcessTable_goThroughEntries(Proce proc->time = (kproc->kp_lwp.kl_uticks + kproc->kp_lwp.kl_sticks + kproc->kp_lwp.kl_iticks) / 10000; proc->percent_cpu = 100.0 * ((double)kproc->kp_lwp.kl_pctcpu / (double)dhost->kernelFScale); - proc->percent_mem = 100.0 * proc->m_resident / (double)(super->totalMem); + proc->percent_mem = 100.0 * proc->m_resident / (double)(super->super.host->totalMem); Process_updateCPUFieldWidths(proc->percent_cpu); if (proc->percent_cpu > 0.1) { [FILE:1632:patches/patch-dragonflybsd_Platform.c] --- dragonflybsd/Platform.c.orig 2024-01-10 09:54:15 UTC +++ dragonflybsd/Platform.c @@ -36,6 +36,7 @@ in the source distribution for its full #include "XUtils.h" #include "dragonflybsd/DragonFlyBSDProcess.h" #include "dragonflybsd/DragonFlyBSDProcessTable.h" +#include "dragonflybsd/DragonFlyBSDMachine.h" #include "generic/fdstat_sysctl.h" @@ -193,7 +194,7 @@ double Platform_setCPUValues(Meter* this v[CPU_METER_NICE] = cpuData->nicePercent; v[CPU_METER_NORMAL] = cpuData->userPercent; - if (super->settings->detailedCPUTime) { + if (host->settings->detailedCPUTime) { v[CPU_METER_KERNEL] = cpuData->systemPercent; v[CPU_METER_IRQ] = cpuData->irqPercent; this->curItems = 4; @@ -232,9 +233,33 @@ void Platform_setSwapValues(Meter* this) } char* Platform_getProcessEnv(pid_t pid) { - // TODO - (void)pid; // prevent unused warning - return NULL; + char *env = NULL, **fenv = NULL, *ptr = NULL; + size_t size = 0; + kvm_t *kd; + struct kinfo_proc *kp; + char errbuf[_POSIX2_LINE_MAX]; + int count; + + kd = kvm_openfiles(NULL, "/dev/null", NULL, 0, errbuf); + if (kd == NULL) + return NULL; + + kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &count); + fenv = kvm_getenvv(kd, kp, 0); + kvm_close(kd); + + if (fenv) { + ptr = fenv[0]; + while (ptr && *ptr) { + size += strlen(ptr) + 1; + ptr += strlen(ptr) + 1; + } + env = xMalloc(size+2); + memcpy(env, fenv[0], size); + env[size] = 0; + env[size+1] = 0; + } + return env; } FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) { [FILE:660:patches/patch-generic_fdstat__sysctl.c] --- generic/fdstat_sysctl.c.orig 2024-01-10 09:54:15 UTC +++ generic/fdstat_sysctl.c @@ -65,9 +65,9 @@ void Generic_getFileDescriptors_sysctl(d #if defined(HTOP_DARWIN) Generic_getFileDescriptors_sysctl_internal( "kern.maxfiles", "kern.num_files", 0, 0, used, max); -#elif defined(HTOP_DRAGONFLY) +#elif defined(HTOP_DRAGONFLYBSD) Generic_getFileDescriptors_sysctl_internal( - "kern.maxfiles", NULL, 0, sizeof(struct kinfo_file), used, max); + "kern.maxfiles", "kern.openfiles", 0, 0, used, max); #elif defined(HTOP_FREEBSD) Generic_getFileDescriptors_sysctl_internal( "kern.maxfiles", "kern.openfiles", 0, 0, used, max);