summaryrefslogtreecommitdiffstats
path: root/Process.h
Commit message (Collapse)AuthorAgeFilesLines
* Align parameter names in declarations with definitionsChristian Göttsche2024-04-081-2/+2
|
* Linux: detect container process by different PID namespaceChristian Göttsche2024-04-061-1/+1
| | | | | | | Container engines like docker and podman rely on Linux namespaces. If available check if the target process is inside a different PID namespace than htop. This check will mark sandbox'ed applications, e.g. under bubblewrap, but not light-wight containers, like distrobox.
* Linux: gather permitted capabilities via capget(2)Christian Göttsche2024-04-061-1/+8
| | | | | | | | | #1211 has shown reading /proc/<pid>/status might have a significant performance impact. It was started to be read by default to gather the permitted capabilities of the process. Gather permitted capabilities via the syscall capget(2) instead. cap_get_proc(3) is not used to avoid linking with -lcap.
* Introduce autoTitleRightAlign column flagChristian Göttsche2024-03-271-0/+3
| | | | | | 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.
* Force to keep explicit forward declarationsBenny Baumann2023-12-261-2/+2
|
* Update includes based on IWYUBenny Baumann2023-12-261-0/+1
|
* Fix code styleBenny Baumann2023-12-261-2/+2
|
* Support dynamic screens with 'top-most' entities beyond processesSohaib Mohamed2023-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* Introduce Row and Table classes for screens beyond top-processesNathan Scott2023-08-301-150/+48
| | | | | | | | | 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.
* Minor data type fixes in Process.c and PCPProcess.cExplorer092023-08-181-1/+1
| | | | | | | | In PCPProcess_writeField(), the "n" variable should be size_t type. The "n" parameters of Process_printPercentage() and PCPProcess_printDelay() should be size_t type as well. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* Introduce Machine class for host-specific info (split from ProcessList)Nathan Scott2023-05-081-6/+5
| | | | | | | | | | | 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: highlight username if process has elevated privilegesChristian Göttsche2023-02-051-0/+7
| | | | | | Highlight processes started from binaries with file capabilities set, like kwin_wayland, or retaining Linux capabilities, via the ambient set, after switching from the root user, e.g. rtkit.
* Add support for scheduling policiesChristian Göttsche2023-02-051-0/+5
| | | | | | | | | | | | | 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
* Add option to shadow path prefixesChristian Göttsche2023-02-031-0/+1
| | | | | | | | | Shadow path prefixes which are used by distributions, like /usr/bin/ /usr/sbin/ /bin/ /sbin/ /usr/libexec/
* Implement LinuxProcessList_checkPidNamespacevaldaarhun2022-08-291-0/+3
| | | | | | | | | | | | | | | | | | Add actionToggle and fix LinuxProcessList_checkPidNamespace Read cgroup file irrespective of flags Improve logic to check if running in container Add isContainerOrVMSlice() Also change "(Process *)lp" to "proc" Remove check for root slice Remove Process_isRunningInContainer Co-authored-by: BenBE <BenBE@geshi.org>
* Avoid UB for deep nested processesChristian Göttsche2022-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also increase the limit for nesting by using 64 bit integers. ProcessList.c:242:36: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' #0 0x561cfec000a8 in ProcessList_buildTreeBranch ProcessList.c:242:36 #1 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #2 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #3 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #4 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #5 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #6 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #7 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #8 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #9 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #10 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #11 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #12 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #13 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #14 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #15 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #16 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #17 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #18 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #19 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #20 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #21 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #22 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #23 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #24 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #25 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #26 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #27 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #28 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #29 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #30 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #31 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7 #32 0x561cfebfb734 in ProcessList_buildTree ProcessList.c:312:10 #33 0x561cfebfb050 in ProcessList_updateDisplayList ProcessList.c:326:10 #34 0x561cfebfc58b in ProcessList_rebuildPanel ProcessList.c:374:4 #35 0x561cfec07953 in checkRecalculation ScreenManager.c:139:7 #36 0x561cfec07953 in ScreenManager_run ScreenManager.c:226:10 #37 0x561cfeb8899a in CommandLine_run CommandLine.c:378:4 #38 0x561cfeb6d6d4 in main htop.c:15:11 #39 0x7f14860291e9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #40 0x7f148602929b in __libc_start_main csu/../csu/libc-start.c:392:3 #41 0x561cfeaafb20 in _start (htop+0x105b20) (BuildId: fc4b9e52ffc111ca8b4cd53136a238414120a858)
* Refactor code for rendering command line cacheBenny Baumann2022-05-311-8/+1
| | | | Fixes #1008
* Correct PROCESS_MAX_UID_DIGITS constantExplorer092022-05-301-1/+1
| | | | | | | | | | The PROCESS_MAX_UID_DIGITS=19 introduced in 696f79fe5099d510fc6ecc6d1e2f0ab3ae29e04e doesn't make sense. The `uid_t` type does not require to be signed in POSIX. If we are to support 64 bits as the maximum size of `uid_t`, then PROCESS_MAX_UID_DIGITS should be 20. (= floor(log10(UINT64_MAX)) + 1). Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* ProcessList: fix quadratic process removal when scanningCharlie Vieth2022-05-051-1/+5
| | | | | | | | | | | | | | | | | | | | | | | This commit changes ProcessList_scan to lazily remove Processes by index, which is known, instead of performing a brute-force search by pid and immediately reclaiming the lost vector space via compaction. Searching by pid is potentially quadratic in ProcessList_scan because the process we are searching for is always at the back of the vector (the scan starts from the back of the vector). Additionally, removal via Vector_remove immediately reclaims space (by sliding elements down). With these changes process removal in ProcessList_scan is now linear. Changes: * ProcessList: add new ProcessList_removeIndex function to remove by index * Vector: add Vector_softRemove and Vector_compact functions to support lazy removal/deletion of entries Vector_softRemove Vector_compact * Vector: replace Vector_count with Vector_countEquals since it only used for consistency assertions.
* Auto-size (normalized) CPU usage columnsBenny Baumann2022-03-061-1/+2
|
* Linux: dynamically adjust the SECATTR column widthChristian Göttsche2022-03-061-0/+7
| | | | | | | | 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.
* ProcessList: cleanup the tree set sorting remainsDenis Lisov2022-02-131-3/+0
| | | | | They're no longer needed as rebuilding the tree from scratch is just as fast.
* ProcessList_buildTree: sort by parent for fast searchDenis Lisov2022-02-131-0/+3
| | | | | | | ProcessList_buildTreeBranch used to search for children with a linear scan of the process table, which made tree build time quadratic in process count. Pre-sorting the list by parent PID (if known) makes it possible to select the correct slice by bisection much faster.
* Drop getCommandStr member of ProcessChristian Göttsche2021-12-171-6/+2
| | | | | | Formatting the merged command string is now implemented in an platform independent way. Drop the Process member getCommandStr designed for overrides of individual platforms.
* Tidy up process state handlingmarcluque2021-11-021-14/+22
|
* Dynamically scale the ST_UID size to support 32-bit UIDsSilke Hofstra2021-10-271-0/+7
| | | | | | | | | | | | | | | | | | 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.
* Update license headers to explicitly say GPLv2+Daniel Lange2021-09-221-1/+1
|
* Add a Process_printPercentage helper routineHisham Muhammad2021-09-051-0/+2
| | | | | Replace several open-coded variants of percentage formatting. This function has been ported from Hishams old 'next' branch.
* Process: drop unused merged-command bit fieldsChristian Göttsche2021-09-021-2/+0
|
* PCP: support for 'dynamic columns' added at runtimeSohaib Mohamed2021-08-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements support for arbitrary Performance Co-Pilot metrics with per-process instance domains to form new htop columns. The column-to-metric mappings are setup using configuration files which will be documented via man pages as part of a follow-up commit. We provide an initial set of column configurations so as to provide new capabilities to pcp-htop: including configs for containers, open fd counts, scheduler run queue time, tcp/udp bytes/calls sent/recv, delay acct, virtual machine guests, detailed virtual memory, swap. Note there is a change to the configuration file path resolution algorithm introduced for 'dynamic meters'. First, look in any custom PCP_HTOP_DIR location. Then iterate, in priority order, users home directory, then local sysadmins files in /etc/pcp/htop, then readonly configuration files below /usr/share/pcp/htop. This final location becomes the preferred place for our own shipped meter and column files. The Settings file (htoprc) writing code is updated to not using the numeric identifier for dynamic columns. The same strategy used for dynamic meters is used here where we write Dynamic(name) so the name can be setup once more at start. Regular (static) columns writing to htoprc - i.e. numerically indexed - is unchanged.
* Respect "Show custom thread names" settingBenny Baumann2021-07-171-0/+1
|
* Pointer indication aligned to typenameBenny Baumann2021-07-151-11/+11
|
* Check processes for using deleted shared librariesChristian Göttsche2021-06-091-0/+3
| | | | | | | | | Shared libraries can be replaced by an upgrade, highlight processes using deleted shared libraries. Link with highlightDeletedExe setting, enabled by default. Currently only checked on Linux.
* Move CWD field handling to platform-neutral codeBenny Baumann2021-05-251-1/+7
|
* Add ELAPSED process columnChristian Göttsche2021-05-231-0/+1
| | | | | | | | | Add process columns showing the elapsed time since the process was started. Similar to STARTTIME, but shows the time passed since the process start instead of the fixed start time of the process. Closes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=782636
* Process: add convenience helper functions to update merged command line ↵Christian Göttsche2021-05-231-0/+4
| | | | related data
* Drop mc->maxLen fieldBenny Baumann2021-05-231-1/+0
|
* Move PROC_COMM/PROC_EXE column handling to global Process implementationBenny Baumann2021-05-231-0/+2
|
* Move Process_makeCommandStr to global Process implementationBenny Baumann2021-05-231-0/+6
|
* Move LinuxProcess_getCommandStr to Process_getCommandStrBenny Baumann2021-05-231-1/+4
|
* Move kernel/userland thread handling to platform-independent implementationBenny Baumann2021-05-231-1/+18
|
* Move mergeCommand to global process structBenny Baumann2021-05-231-0/+34
|
* Rename cmdlineBasenameOffset to cmdlineBasenameEnd to properly indicate the ↵Benny Baumann2021-05-231-2/+2
| | | | fields purpose
* Move procCmdlineBasenameOffset as cmdlineBasenameStart to global Process ↵Benny Baumann2021-05-231-0/+3
| | | | structure
* Move procExeBasenameOffset to main Process structureBenny Baumann2021-05-231-0/+3
| | | | This drops procExeLen, as that field is implicit by strlen(Process->procExe)
* Move procExeDeleted flag to main Process structureBenny Baumann2021-05-231-0/+3
|
* Rename basenameOffset to cmdlineBasenameOffsetBenny Baumann2021-05-231-3/+3
|
* Move procComm and procExe to main Process structureBenny Baumann2021-05-231-0/+6
|
* Process: Put the time field more to the endBenny Baumann2021-05-231-3/+3
|
* Rename command line field from comm to cmdlineBenny Baumann2021-05-231-2/+2
|

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