summaryrefslogtreecommitdiffstats
path: root/freebsd
AgeCommit message (Collapse)Author
2024-04-08Work around GCC14 memleak diagnosticBenny Baumann
While both pointers are identical, GCC-14 with -fanalyzer complains about these return statements to leak memory. The leak is only reported with LTO though.
2024-03-27Introduce autoTitleRightAlign column flagChristian Göttsche
Instead of handling PERCENT_CPU as a special case for whether to align the title of a dynamically sized column to the right or the left introduce a new flag, which can be reused by other columns.
2023-12-26Use consistent style for process field output/compare functionsBenny Baumann
2023-12-26Fix code styleBenny Baumann
2023-12-26Add includes for config.h as per the discussion in PR #1337Daniel Lange
Many thanks to @Explorer09 Kang-Che Sung (宋岡哲). Also add a #error stanza to XUtils.h in case somebody forgets the beautiful mess GNU forces on us.
2023-10-26Move shared memory next to used memoryKevin Bracey
Shared memory is less available than buffers, so move it left next to used memory. This is in preparation for including shared memory in the basic "in use" for the bar text. It would not make sense to sum a discontiguous region.
2023-09-04Correct pid_t type return from Platform_getMaxPid functionNathan Scott
Coverity scanning shows we end up passing an integer into the Row_setPidColumnWidth routine which requires a pid_t - update each platform to return the correct type (and never return -1 as a failure code, this was being ignored).
2023-08-31Rename ProcessList to ProcessTable throughoutNathan Scott
Following up with some discusson from a few months back, where it was proposed that ProcessTable is a better name. This data structure is definitely not a list ... if it was one-dimensional it'd be a set, but in practice it has much more in common with a two-dimensional table. The Process table is a familiar operating system concept for many people too so it resonates a little in that way as well.
2023-08-31Fix FreeBSD builds after some recent code refactoringNathan Scott
Resolves https://github.com/htop-dev/htop/issues/1290
2023-08-30BSD platforms: Reject negative and zero KERN_FSCALE factorsExplorer09
The "fscale" value, retrieved by sysctl() in BSD platforms, is used for computing CPU percentages of the processes. To prevent a division by zero, we should reject a zero "fscale" value. (A negative "fscale" value will not make sense either.) For DragonFlyBSD and FreeBSD, this would fall back to the hard-coded default scale. For NetBSD and OpenBSD, there is no hard-coded default value, so the zero or negative "fscale" is now a fatal error. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2023-08-30Support dynamic screens with 'top-most' entities beyond processesSohaib Mohamed
This implements our concept of 'dynamic screens' in htop, with a first use-case of pcp-htop displaying things like top-filesystem and top-cgroups under new screen tabs. However the idea is more general than use in pcp-htop and we've paved the way here for us to collectively build mroe general tabular screens in core htop, as well. From the pcp-htop side of things, dynamic screens are configured using text-based configuration files that define the mapping for PCP metrics to columns (and metric instances to rows). Metrics are defined either directly (via metric names) or indirectly via PCP derived metric specifications. Value scaling and the units displayed is automatic based on PCP metric units and data types. This commit represents a collaborative effort of several months, primarily between myself, Nathan and BenBE. Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com> Signed-off-by: Nathan Scott <nathans@redhat.com>
2023-08-30Introduce Row and Table classes for screens beyond top-processesNathan Scott
This commit refactors the Process and ProcessList structures such they each have a new parent - Row and Table, respectively. These new classes handle screen updates relating to anything that could be represented in tabular format, e.g. cgroups, filesystems, etc, without us having to reimplement the display logic repeatedly for each new entity.
2023-08-18Replace isnan() with better comparisons (isgreater(), etc.)Explorer09
The standard isnan() function is defined to never throw FP exceptions even when the argument is a "signaling" NaN. This makes isnan() more expensive than (x != x) expression unless the compiler flag '-fno-signaling-nans' is given. Introduce functions isNaN(), isNonnegative(), isPositive(), sumPositiveValues() and compareRealNumbers(), and replace isnan() in htop's codebase with the new functions. These functions utilize isgreater() and isgreaterequal() comparisons, which do not throw FP exceptions on "quiet" NaNs, which htop uses extensively. With isnan() removed, there is no need to suppress the warning '-Wno-c11-extensions' in FreeBSD. Remove the code from 'configure.ac'. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2023-05-09Shorten CPUData ptr initialization stanzaBenny Baumann
2023-05-09Build fixes for FreeBSDXimalas
Part of a series of changes to get rid of errors and warnings.
2023-05-08Adapt platform code for the new Machine base classNathan Scott
Move host-centric data to new derived <Platform>Machine classes, separate from process-list-centric data.
2023-05-08Introduce Machine class for host-specific info (split from ProcessList)Nathan Scott
First stage in sanitizing the process list structure so that htop can support other types of lists too (cgroups, filesystems, ...), in the not-too-distant future. This introduces struct Machine for system-wide information while keeping process-list information in ProcessList (now much less). Next step is to propogate this separation into each platform, to match these core changes.
2023-04-23{Memory,Swap}Meter: add "compressed memory" metricsIvan Shapovalov
For now, the semantics are mostly fit for Linux zswap subsystem. For instance, we add the third swap usage metric that indicates the amount of memory that is accounted to swap but in fact stored elsewhere. This exactly matches the definition of frontswap/zswap, and is probably of little use to all other platforms.
2023-04-06Refactor and consolidate dynamic meters/columns pointersNathan Scott
This removes the duplication of dynamic meter/column hashtable pointers that has come in between the Settings and ProcessList structures - only one copy of these is needed. With the future planned dynamic screens feature adding another pointer, let us first clean this up before any further duplication happens.
2023-04-01Use shared real memory on FreeBSDChristian Göttsche
Cf. https://github.com/htop-dev/htop/issues/1193#issuecomment-1435673333 for more details. Fixes: #1193 Thanks: @er-azh
2023-03-04Improve code readability by using enum values instead of raw numbersGuillaume Gomez
2023-02-19Implement File Descriptor Meter support for DragonflyBSD/FreeBSD/NetBSDBenny Baumann
2023-02-05Add support for scheduling policiesChristian Göttsche
Add a process column for scheduling policy to show the current scheduling policy of the process. Add a the ability to change the scheduling policy of a process via the key 'Y'. Currently implemented on Linux and FreeBSD only but should be portable, since sched_getscheduler(2) is part of POSIX.1-2001. Closes: #1161
2023-02-05FreeBSD: remove duplicate zfs ARC size subtractioner-azh
2023-02-04Use sysctlnametomib for vm.vmtotaler-azh
2023-02-04Implement shared memory for FreeBSDer-azh
2023-02-04Use strict function prototypes also for defintionsChristian Göttsche
freebsd/Platform.c:151:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] int Platform_getUptime() { ^ void
2023-01-08Improve code readability by creating constants for SWAP memory valuesGuillaume Gomez
2023-01-08Clean out Platform_getInodeFilenameнаб
It's an artefact of the previous implementation of Platform_getProcessLocks for Linux, and is never used; there's no reason for it to have ever been exported
2023-01-07Improve code readability by creating constants for memory valuesGuillaume Gomez
2022-10-24Reformat code baseBenny Baumann
This includes: - Wrap function implementations - Pointer alignment for function signatures - Pointer alignment for variable declarations - Whitespace after keywords - Whitespace after comma - Whitespace around initializers - Whitespace around operators - Code indentation - Line break for single line statements - Misleading alignment
2022-08-04Fix build failure on FreeBSD 10.* due to KERN_PROC_CWD unavailableWHR
2022-05-30Implement FreeBSD support for minimum ZFS ARC sizeBenny Baumann
2022-05-26Process: Display single digit precision for CPU% greater than 99.9%Kumar
Since commit edf319e[1], we're dynamically adjusting column width of "CPU%", showing single digit precision also for values greater than "99.9%" makes "CPU%" column consistent with all other values. [1]: edf319e53d1fb77546505e238d75160a3febe56e Change "Process_printPercentage()" function's logic to always display value (i.e. "val") with single precision. Except when value is greater than "99.9%" for columns like "MEM%", whose width is fixed to "4" and value cannot go beyond "100%". Credits: @Explorer09, thanks for the patch[2] to fix title alignment issue. [2]: https://github.com/htop-dev/htop/pull/959#issuecomment-1092480951 Closes: #957
2022-04-30FreeBSD: free emulation stringChristian Göttsche
2022-04-21Assume process just started when kproc->ki_start returns garbageBenny Baumann
2022-03-06Auto-size (normalized) CPU usage columnsBenny Baumann
2022-01-18freebsd/dragonfly: Stop aligning equals signs in PLATFORM_PROCESS_FIELDSJessica Clarke
ProcessField doesn't do this, nor does any other OS, and it just makes it more annoying to add a new field.
2022-01-16FreeBSD: Add support for showing process emulationJessica Clarke
This displays the same output as ps's -o emul, which is the system call emulation environment, or ABI, in use. This will typically be FreeBSD ELF32 or ELF64, but can also be Linux ELF32 or Linux ELF64 when running Linux binaries under FreeBSD's Linuxulator binary compatibility layer. The column width of 16 is chosen to match KI_EMULNAMELEN's value of 16, most of which is normally used up as FreeBSD ELF32/64 is 13 characters.
2021-12-17Use correct command field as default fieldChristian Göttsche
The default htop command process field has the enum identifier `COMM` but the name `Command` (`COMM` is the field name for /proc/<PID>/comm).
2021-12-17Mark ScreenDefaults constChristian Göttsche
2021-12-07Introduce screen tabsHisham Muhammad
This is a forward port (by nathans) of Hisham's original code.
2021-11-19Reduce allocation size of cp_time_n and cp_time_o on FreeBSD and DragonFlyBSDGuillaume Gomez
2021-11-02Tidy up process state handlingmarcluque
2021-10-31Early program termination only from main()Volodymyr Vasiutyk
2021-10-27Dynamically scale the ST_UID size to support 32-bit UIDsSilke Hofstra
While most Unix-like systems use 16-bit user IDs, Linux supports 32-bit UIDs since version 2.6. UIDs above 65535 are used for UID namespacing of containers, where a container has its own set of 16-bit user IDs. Processes in such containers will have (much) larger UIDs than 65535. Because the current format strings for `ST_UID` and `USER` are `%5d` and `%9d` respectively, processes with such UIDs lead to misaligned columns. Dynamically scale the `ST_UID` column and increase the size of `USER` to 10 characters (length of UINT32_MAX) to ensure that the user ID always fits. Additionally: clean up how the titlebuffer size calculation and ensure the PID column has a minimum size of 5.
2021-10-15FreeBSD: add comment for memory leak workaroundChristian Göttsche
Follow-up of #841 [ci skip]
2021-10-12Plug the memory leak for the Disk I/O meterXimalas
There are no functions in libdevstat to initialise or clean up memory. The simplest change is to mark the local variable info as static.
2021-10-03Release memory for cmdline when Process_updateCmdline() returns.Ximalas
This closes a nasty memory leak. There is at least another leak looming somewhere when Disk I/O is shown in the header area. That could very well be an issue within libdevstat native to FreeBSD.
2021-09-22Update license headers to explicitly say GPLv2+Daniel Lange