summaryrefslogtreecommitdiffstats
path: root/linux
Commit message (Collapse)AuthorAgeFilesLines
* fix container detection for LXCilyam82022-05-081-1/+1
|
* LinuxProcessList_recurseProcTree: keep on read errorDenis Lisov2022-05-051-1/+6
| | | | | | | | If a process goes away while reading its fields, but we already have that process in the list, we should keep it in case the "highlight dying processes" mode is active. Not only is that expected in this mode, but this should also ensure parents are in the list when their children are (wanted for tree mode consistency).
* LinuxProcessList_recurseProcTree: open dirfd firstDenis Lisov2022-05-051-8/+8
| | | | | | | | | | A process can die between reading the directory listing and opening the directory FD (if HAVE_OPENAT) or /proc files (otherwise) for reading the process data. This race would cause LinuxProcessList_recurseProcTree to remove it from the list immediately, which is unexpected in the "highlight dying processes" mode and can break the tree structure. This patch closes this race in the HAVE_OPENAT case by only accessing the process entry after the directory FD has been opened.
* Remove redundant sscanf calls (in (s)scanf a blank validates _zero_ or more ↵Daniel Lange2022-05-051-7/+2
| | | | | | | | whitespace) man sscanf(3): A sequence of white-space characters (space, tab, newline, etc.; see isspace(3)). This directive matches any amount of white space, including none, in the input.
* Fix typoChristian Göttsche2022-04-301-4/+4
|
* 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 xCalloc for allocating cpuDataer-azh2022-03-271-1/+1
|
* Linux: allocate cpuData before reading cpu count.er-azh2022-03-261-3/+10
|
* Linux: fix crash in LXDer-azh2022-03-261-1/+1
|
* Skip system slice nameBenny Baumann2022-03-061-0/+6
| | | | | This shortens paths like /system.slice/system-postgres.slice/postgres@12-main.service to /[S]/postgres@12-main. Without this some cgroup names for getty processes explode in length.
* Reduce column width spam by snapdBenny Baumann2022-03-061-0/+18
|
* Auto-size (normalized) CPU usage columnsBenny Baumann2022-03-062-5/+6
|
* Linux: dynamically adjust column width of CGROUP C(ompressed)CGROUPChristian Göttsche2022-03-062-5/+16
|
* Linux: dynamically adjust the SECATTR column widthChristian Göttsche2022-03-062-2/+5
| | | | | | | | SELinux contexts can be quite long; adjust the column width dynamically at each cycle to the longest value. Also with the recent addition of multiple screens, over-long columns can be moved into their own screen.
* Fix division by zero when calculating IO ratesBenny Baumann2022-02-031-2/+4
| | | | Fixes #935
* LinuxProcessList: do not collect LRS per threadDenis Lisov2021-12-181-2/+4
| | | | | It's a memory map property, so it's process-wide and collecting it just once should be enough.
* 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-172-2/+2
|
* 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-073-17/+33
| | | | This is a forward port (by nathans) of Hisham's original code.
* CGroupUtils: avoid unsigned integer underflowChristian Göttsche2021-12-051-1/+1
| | | | | | | Do not underflow count at the last iteration, which triggers UBSAN when using -fsanitize=unsigned-integer-overflow. This is useful as those underflows can be a result of a flawed counting logic (e.g. a counter gets reduced more than increased).
* Include support for legacy LXC cgroup namingBenny Baumann2021-11-281-0/+30
|
* Use helpers for parsing of cgroup labelsBenny Baumann2021-11-281-9/+21
|
* Extract string writing/buffer handling into some callbackBenny Baumann2021-11-283-131/+121
|
* Compress cgroup names based on some heuristicsBenny Baumann2021-11-286-1/+329
|
* Filter leading colons in CGROUP nameBenny Baumann2021-11-281-3/+10
|
* Ensure maximum width for CGROUP columnBenny Baumann2021-11-281-2/+2
|
* Linux: use proper way to detect kernel threadsRin Cat (鈴猫)2021-11-092-15/+23
| | | | | | Use PF_KTHREAD flag in /proc/[pid]/stat to detect kernel threads. This fixed an issue when a process's cmdline is empty, htop think it is a kernel thread.
* Tidy up process state handlingmarcluque2021-11-021-4/+20
|
* Early program termination only from main()Volodymyr Vasiutyk2021-10-312-10/+12
|
* Dynamically scale the ST_UID size to support 32-bit UIDsSilke Hofstra2021-10-271-2/+2
| | | | | | | | | | | | | | | | | | 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.
* 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
|
* Linux: ignore mapped /dev/zeroChristian Hesse2021-10-251-0/+5
| | | | | Virtualbox maps /dev/zero for memory allocation. That results in false positive, so ignore.
* Fix Security Attributes column header widthLucas Werkmeister2021-10-201-2/+2
| | | | | | | | | Limit the maximum width (instead of only the minimum width), pad the header width accordingly, and also remove extra stray spaces from the format string (the main spacing should just come from the alignment of the value). Fixes #850.
* Report hugepage memory as real and used memory (as before)Nathan Scott2021-10-121-2/+2
| | | | | | This is real, physical memory available for applications to use. We should not try to pretend otherwise; its confusing for users and inconsistent with all other tools.
* Linux: improve tryRead macro safetyChristian Göttsche2021-10-011-3/+3
| | | | | | | | | | Add an explicit else clause so a following else branch for a prior if condition does not get mixed up. Also force a trailing semicolon and thereby silence current -Wextra-semi-stmt warnings. Improve readability of the hwloc_bitmap_foreach_begin loop macro.
* Merge branch 'o_path' of https://github.com/cgzones/htop into cgzones-o_pathNathan Scott2021-09-271-0/+4
|\
| * Linux: define O_PATH if not definedChristian Göttsche2021-09-241-0/+4
| | | | | | | | | | | | | | Defining O_PATH if not defined by <fcntl.h> does not really add any maintenance cost and might improve some portability. Related: #804
* | Linux: always compute procExeDeleted if already setChristian Göttsche2021-09-241-2/+2
|/ | | | | | | | A process, whose executable has been replaced and thus marked by htop, can be re-executed with the replaced executable, with the same PID, in two ways: the Linux feature checkpoint/restore or re-execution of PID 1. The actual check is just a string comparison, like the dropped condition, leading to (almost) no computation overhead.
* Update license headers to explicitly say GPLv2+Daniel Lange2021-09-2218-18/+18
|
* Linux: recalculate LRS valueChristian Göttsche2021-09-121-1/+1
| | | | | The LRS value is only zero in the first cycle; drop the check to recalculate while running.
* Linux: zero CPU data after allocationChristian Göttsche2021-09-111-7/+4
| | | | | | | | | | | | | | | | | | | | Zero all the CPU data, like totalPeriod, after its memory allocation via realloc(3). Conditional jump or move depends on uninitialised value(s) at 0x132A9B: LinuxProcessList_scanCPUTime (LinuxProcessList.c:1928) by 0x1358C3: ProcessList_goThroughEntries (LinuxProcessList.c:2079) by 0x12A79A: ProcessList_scan (ProcessList.c:627) by 0x11CA67: CommandLine_run (CommandLine.c:357) by 0x4A81E49: (below main) (libc-start.c:314) Uninitialised value was created by a heap allocation at 0x48396C5: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x12F633: xRealloc (XUtils.c:64) by 0x12F633: xReallocArray (XUtils.c:78) by 0x1325A8: LinuxProcessList_updateCPUcount (LinuxProcessList.c:207) by 0x134E0A: ProcessList_new (LinuxProcessList.c:284) by 0x11C8D0: CommandLine_run (CommandLine.c:301) by 0x4A81E49: (below main) (libc-start.c:314)
* Add a Process_printPercentage helper routineHisham Muhammad2021-09-051-19/+5
| | | | | Replace several open-coded variants of percentage formatting. This function has been ported from Hishams old 'next' branch.
* Add completion handling for dynamic meters and columnsNathan Scott2021-09-031-0/+4
| | | | | | | Be sure to free dynamic memory allocated for meters and columns strings, no-op on platforms other than pcp. Closes #774
* Linux: rework disk-io parsingChristian Göttsche2021-09-021-14/+5
| | | | | | | | | Generalize sub-diskname handling, like sdb1/sdb2, to not count the usage twice with the aggregate top-diskname, like sdb. Rely on /proc/diskstats being ordered, e.g. no sub-diskname precedes its top-diskname. Closes: #675
* linux: simplify recheck conditionChristian Göttsche2021-09-021-1/+1
| | | | | | `recheck` is calculated modulo 2048, so its maximum value is 2047. Drop the quite similar (up to 27 milliseconds) explicit check against 2000.
* linux: color void delay accounting values grayChristian Göttsche2021-09-021-4/+8
| | | | | | Use the color gray, similar to other process fields, if the delay accounting value is either 0 (or very small) or cannot be accessed, e.g. by an unprivileged user.
* linux: drop unused macro IOPriority_errorChristian Göttsche2021-09-021-2/+0
|

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