summaryrefslogtreecommitdiffstats
path: root/linux/Platform.c
Commit message (Collapse)AuthorAgeFilesLines
* Use 'fp' name for local 'FILE*' variables.Explorer092024-04-171-26/+26
| | | | | | | | | | | It is inappropriate to use the 'fd' name for 'FILE*' variables. POSIX file descriptiors are of type 'int' and are distinguished from ISO C stream pointers (type 'FILE*'). Rename these variables to 'fp', which is a preferred naming in POSIX. (Note that ISO C preferred the 'stream' name for the variables.) No code changes.
* Avoid glibc FILE API for number of open filesBenny Baumann2024-03-271-5/+5
|
* Avoid glibc FILE API for maxpidBenny Baumann2024-03-271-9/+15
|
* Avoid glibc FILE API for loadavgBenny Baumann2024-03-271-13/+14
|
* Avoid glibc FILE API for uptime readingBenny Baumann2024-03-271-7/+13
|
* Linux: add GPU meter and process columnChristian Göttsche2024-03-271-0/+2
| | | | | | | Based on the DRM client usage stats[1] add statistics for GPU time spend and percentage utilization. [1]: https://www.kernel.org/doc/html/latest/gpu/drm-usage-stats.html
* Explicitly check sscanf(3) and fscanf(3) return valuesChristian Göttsche2024-01-251-1/+1
| | | | | | | | | Compare the return value of sscanf(3) and fscanf(3) explicitly against the expected number of parsed items and avoid implicit boolean conversion. Such an implicit conversion would treat EOF (-1) the same as at least one item parsed successfully. Reported by CodeQL.
* Update includes based on IWYUBenny Baumann2023-12-261-1/+1
|
* Fix code styleBenny Baumann2023-12-261-2/+2
|
* Move shared memory next to used memoryKevin Bracey2023-10-261-1/+1
| | | | | | | | | 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.
* Merge branch 'style-header-consistency' of https://github.com/BenBE/htop ↵Nathan Scott2023-10-101-3/+2
|\ | | | | | | into BenBE-style-header-consistency
| * Make header sort order consistent againBenny Baumann2023-05-241-2/+1
| |
| * Always mark config.h with IWYU pragma: keepBenny Baumann2023-05-241-1/+1
| |
* | Correct pid_t type return from Platform_getMaxPid functionNathan Scott2023-09-041-3/+3
| | | | | | | | | | | | | | 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).
* | Introduce Row and Table classes for screens beyond top-processesNathan Scott2023-08-301-2/+2
| | | | | | | | | | | | | | | | | | 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.
* | Rework ZramMeter and remove MeterClass.comprisedValuesExplorer092023-08-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The 'comprisedValues' boolean property unnecessarily complicates the drawing algorithms of Bar meters and Graph meters. Since the only user of 'comprisedValues' is ZramMeter, it is better to rework the meter so that it no longer needs 'comprisedValues'. The 'values[ZRAM_METER_UNCOMPRESSED]' now stores the difference between uncompressed and compressed data size. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* | Replace isnan() with better comparisons (isgreater(), etc.)Explorer092023-08-181-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Short-term fix for docker container detectionlestermfp2023-07-071-1/+1
|/ | | https://github.com/htop-dev/htop/issues/1223
* Adapt platform code for the new Machine base classNathan Scott2023-05-081-26/+27
| | | | | Move host-centric data to new derived <Platform>Machine classes, separate from process-list-centric data.
* Introduce Machine class for host-specific info (split from ProcessList)Nathan Scott2023-05-081-19/+20
| | | | | | | | | | | 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.
* Linux: (hack) work around the fact that Zswapped pages may be SwapCachedIvan Shapovalov2023-04-231-0/+15
|
* Linux: implement zswap supportIvan Shapovalov2023-04-231-1/+14
| | | | | | | On Linux, use zswap to populate "compressed memory" metrics added in the previous commit. Fixes #104.
* {Memory,Swap}Meter: add "compressed memory" metricsIvan Shapovalov2023-04-231-0/+1
| | | | | | | | 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.
* {Memory,Swap}Meter: make sure new constants are used consistentlyIvan Shapovalov2023-04-231-2/+2
|
* ZramMeter: update bar modeChristian Göttsche2023-04-111-2/+3
| | | | | | Show both compressed and uncompressed bars. Closes: #1216
* Minor code formatting consistency fixesBenny Baumann2023-04-111-4/+4
|
* Improve CPU computation codeGuillaume Gomez2023-03-041-3/+2
|
* Improve code readability by using enum values instead of raw numbersGuillaume Gomez2023-03-041-5/+5
|
* Implement File Descriptor Meter support for LinuxBenny Baumann2023-02-191-0/+20
|
* Misc cleanupChristian Göttsche2023-02-181-2/+1
| | | | | | * declare read-only pointer parameter const * drop duplicate include of <errno.h> * use String_startsWith
* Linux: add IRQ PSI meterMatthias Maier2023-02-131-0/+1
| | | | | | | | | | | | The linux kernel recently gained a new PSI meter, namely a new /proc/pressure/irq meter has been added [1]: full avg10=0.00 avg60=0.00 avg300=0.00 total=100648410 This commit adds support for this PSI meter by adding a PressureStallIRQFullMeter_class. [1] https://github.com/torvalds/linux/commit/52b1364ba0b105122d6de0e719b36db705011ac1
* Add a systemd user meter to monitor user units.Aidan Epstein2023-02-051-0/+1
|
* Use a 0x{devnum} format for devices in lock screen, like files screenнаб2023-01-081-1/+4
| | | | Also reflow it to not be absolutely bonkers
* Replace meaningless ID column with FD column in lock screenнаб2023-01-081-3/+3
| | | | Doubly meaningless since the IDs are now per-FD
* Clean out Platform_getInodeFilenameнаб2023-01-081-55/+0
| | | | | | 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
* Fix Linux Platform_getProcessLocks() for file-description locksнаб2023-01-081-40/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of filtering the global /proc/locks by PID-that-locked (which is different than the process that holds it for inherited flock(2)s and always literal -1 for fcntl(F_OFD_SETLK)s), just look at the locks on open files For a process with: $ head /proc/$$/fdinfo/{9,10,11} ==> /proc/797393/fdinfo/9 <== pos: 0 flags: 0100000 mnt_id: 2775 lock: 1: FLOCK ADVISORY WRITE 818754 00:69:7 0 EOF ==> /proc/797393/fdinfo/10 <== pos: 0 flags: 0100000 mnt_id: 127 lock: 1: FLOCK ADVISORY WRITE 828244 00:30:509028 0 EOF lock: 2: OFDLCK ADVISORY READ -1 00:30:509028 0 199 ==> /proc/797393/fdinfo/11 <== pos: 0 flags: 0100000 mnt_id: 2775 lock: 1: FLOCK ADVISORY WRITE 935925 00:69:1187 0 EOF Instead of: No locks have been found for the selected process. I now observe: 1 FLOCK ADVISORY WRITE 00:30:00000000000000509028 0 <END OF FILE> /home/nabijaczleweli/.feeds 1 FLOCK ADVISORY WRITE 00:69:00000000000000000007 0 <END OF FILE> /home/nabijaczleweli/uwu/mart.html 1 FLOCK ADVISORY WRITE 00:69:00000000000000001187 0 <END OF FILE> /home/nabijaczleweli/uwu/removedfile (deleted) 2 OFDLCK ADVISORY READ 00:30:00000000000000509028 0 199 /home/nabijaczleweli/.feeds This also fixes an obvious issue where the filename for fd 0 would never be resolved
* Improve code readability by creating constants for memory valuesGuillaume Gomez2023-01-071-8/+8
|
* Reformat code baseBenny Baumann2022-10-241-1/+1
| | | | | | | | | | | | | | 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
* Please Clang 15Christian Göttsche2022-08-091-2/+2
| | | | | | | CRT.c:1015:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] void CRT_done() { ^ void
* consider only shrinkable ZFS ARC as cache on Linuxilyam82022-05-301-2/+7
|
* fix container detection for LXCilyam82022-05-081-1/+1
|
* Remove stray fprintf left from testing (introduced in 7039abe)Daniel Lange2022-04-261-1/+0
|
* Guess lxc or docker from /proc/1/mountsDaniel Lange2022-04-021-1/+28
| | | | | | | | | At the moment this is used to make the memory meter report sane values even if the host has ZFS and that leaks through into a containerized environment Fixes #863 Includes a clever check for magic PROC_PID_INIT_INO in /proc/self/ns/pid thanks to Pavel Snajdr (snajpa)
* Use correct command field as default fieldChristian Göttsche2021-12-171-2/+2
| | | | | The default htop command process field has the enum identifier `COMM` but the name `Command` (`COMM` is the field name for /proc/<PID>/comm).
* Mark ScreenDefaults constChristian Göttsche2021-12-171-1/+1
|
* Linux: read generic sysfs batteriesChristian Göttsche2021-12-081-14/+47
| | | | | | | | | Not all batteries entries in /sys/class/power_supply start with either BAT or AC, but might have device specific names, e.g. CMB1. Detect the types of those entries and parse them accordingly. Closes: #881 Fixes: 3e70de64 ("Code clean up for reading battery info")
* Introduce screen tabsHisham Muhammad2021-12-071-1/+14
| | | | This is a forward port (by nathans) of Hisham's original code.
* Early program termination only from main()Volodymyr Vasiutyk2021-10-311-7/+9
|
* Linux: restore battery state with numbered AC'sChristian Göttsche2021-10-261-1/+1
|
* Code clean up for reading battery infoaninsen2021-10-251-152/+86
|

© 2014-2024 Faster IT GmbH | imprint | privacy policy