Commit Graph

2545 Commits

Author SHA1 Message Date
Christian Göttsche 2ae1906479 Panel: initialize cursorOn member
Panel.c:496:14: runtime error: load of value 190, which is not a valid value for type 'bool'
2021-12-08 12:40:13 +01:00
Nathan Scott 0e58784224 Fix memory leak on shutdown in new screen settings code.
Also tidy up the calloc call parameters in the initial allocation
of this pointer, thanks to @BenBE for noticing.
2021-12-07 17:04:49 +11:00
Sohaib Mohamed 4ef5e4296e fix CI issue
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
2021-12-07 17:04:49 +11:00
Sohaib Mohamed ba3a1df806 Fix misc styleguide issues and add missing header files
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
2021-12-07 17:04:49 +11:00
Sohaib Mohamed b672e60886 Enable tabs for a fresh install of htop Only
If the new htop is configured with htoprc having no tabs (eg on upgrade)
then the interface will not automatically introduce/enable them.
However, for a fresh install of htop, enabling them automatically

Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
2021-12-07 17:04:49 +11:00
Sohaib Mohamed cd6457ef88 Fixup tabs with dynamic Columns - add missing `Dynamic()` 2021-12-07 17:04:49 +11:00
Sohaib Mohamed 31fe29c5a7 Pass correct ColorElements values to Panel_setSelectionColor 2021-12-07 17:04:49 +11:00
Nathan Scott cc2547fcf0 Improvements to the tab code after initial feedback 2021-12-07 17:04:49 +11:00
Hisham Muhammad 72ba20fa5f Introduce screen tabs
This is a forward port (by nathans) of Hisham's original code.
2021-12-07 17:04:49 +11:00
Christian Göttsche ff4f44b22a Pre-select the last sent signal in SignalsPanel
Instead of pre-selecting SIGTERM every time, select the signal last
send in the same htop session.

Closes: #862
2021-12-05 19:36:36 +01:00
Christian Göttsche a38f48481e Process: highlight UNINTERRUPTIBLE_WAIT state (D)
Commit d8dfbbd3 ("Tidy up process state handling") did change the
highlighting of the UNINTERRUPTIBLE_WAIT state (D) from red to gray.
As this state might means the process probably still has work to do and
can hint at bottlenecks, revert this particular change.

Fixes: d8dfbbd3 ("Tidy up process state handling")
2021-12-05 19:29:10 +01:00
Christian Göttsche 61c9fe44a3 CGroupUtils: avoid unsigned integer underflow
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).
2021-12-05 19:28:07 +01:00
Emmanuel Mathi-Amorim ff0ea41c86 Fix issue where last line is not cleared when SIGINT is received
When we close the application using the quit function F10, the last line
is cleared so that on terminals which do not support ALTBUF the last
line is not clobbered. This do not happen when the application exits as
a result of a signal (SIGINT,SIGTERM,SIGQUIT).

Move the logic to clear the last line into the CRT_done function. This
ensures that it will be executed when the CRT_handleSIGTERM is called.
2021-12-01 17:08:13 +01:00
Nathan Scott 43e9be5a8f Update version number to 3.2.0-dev to identify git repo builds 2021-11-30 12:10:54 +11:00
Nathan Scott d73783d6db Release 3.1.2 2021-11-30 12:03:21 +11:00
Nathan Scott 89b7c4c9f9 Merge branch 'release_action' of https://github.com/rofl0r/htop into rofl0r-release_action 2021-11-30 11:16:57 +11:00
Nathan Scott 78aefc2a99 Minor typo fix and wordsmith-ing in the changelog 2021-11-30 11:15:35 +11:00
Benny Baumann 697c502b7e Update changelog to include recent changes 2021-11-28 23:34:41 +01:00
Lutz Mader 171aa0faaa Add a fix to use gettimeofday if monotonic is not available. 2021-11-28 23:13:46 +01:00
Peter VandeHaar ddfacb8694 Get file size using stat() for OpenFilesScreen if missing from lsof 2021-11-28 20:32:02 +01:00
Peter VandeHaar 5beef3e737 Strip prefix "0t" from OFFSET column of OpenFilesScreen 2021-11-28 20:32:02 +01:00
Peter VandeHaar 27a18830d5 Add OFFSET column to OpenFilesScreen 2021-11-28 20:32:02 +01:00
Benny Baumann b98a4f8d56 Include support for legacy LXC cgroup naming 2021-11-28 20:19:10 +01:00
Benny Baumann 55e073a455 Use helpers for parsing of cgroup labels 2021-11-28 20:19:10 +01:00
Benny Baumann 915b558bbe Document CCGROUP column 2021-11-28 20:19:10 +01:00
Benny Baumann 550100327b Extract string writing/buffer handling into some callback 2021-11-28 20:19:10 +01:00
Benny Baumann 9dc964bb42 Compress cgroup names based on some heuristics 2021-11-28 20:19:10 +01:00
Benny Baumann ea4282784d Filter leading colons in CGROUP name 2021-11-28 20:19:10 +01:00
Benny Baumann 1c3c149d20 Ensure maximum width for CGROUP column 2021-11-28 20:19:10 +01:00
rofl0r 42c0493021 add github workflow to build release tarball 2021-11-23 16:29:25 +00:00
Guillaume Gomez 1284ab4835 Reduce allocation size of cp_time_n and cp_time_o on FreeBSD and DragonFlyBSD 2021-11-19 12:46:48 +01:00
Rin Cat (鈴猫) 07496eafb0 Linux: use proper way to detect kernel threads
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.
2021-11-09 19:04:25 +01:00
Nathan Scott e7a8d14cbd Correct the order of xCalloc parameters in a couple of places
No functional change.  Thanks to @BenBE for pointing these out.
2021-11-05 09:22:09 +11:00
Sohaib Mohamed 21cb1c4d59 Cleanup: Fix misc styleguide issues
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
2021-11-04 23:13:38 +01:00
Nathan Scott e64269df2c Fix process state handling compiler warning on PCP platform 2021-11-03 15:46:20 +11:00
marcluque d8dfbbd37c Tidy up process state handling 2021-11-02 20:02:54 +01:00
Christian Göttsche afa3fe4af1 Drop unicode whitespace 2021-11-01 12:12:13 +01:00
Volodymyr Vasiutyk 2ef70ad7f6 Early program termination only from main() 2021-10-31 15:07:00 +01:00
Benny Baumann 2977414d54 Discard stale information from DiskIO and NetworkIO meters
This ensures the initial read of the data is not misinterpreted as arbitrarily large values.
Also this forces the maximum update interval between two subsequent reads to within 30s.

Fixes #860
2021-10-30 10:57:14 +02:00
Silke Hofstra 696f79fe50 Dynamically scale the ST_UID size to support 32-bit UIDs
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-27 21:20:59 +02:00
Christian Göttsche 4374a267be Linux: restore battery state with numbered AC's 2021-10-26 10:58:59 +02:00
aninsen 3e70de64b3 Code clean up for reading battery info 2021-10-25 22:43:10 +02:00
Christian Hesse 3f9f52fd29 Linux: ignore mapped /dev/zero
Virtualbox maps /dev/zero for memory allocation. That results in
false positive, so ignore.
2021-10-25 21:05:28 +02:00
наб dfa62506b7 Allow -u UID
Defaults to username, of course, like all POSIX utilities do
2021-10-24 04:39:58 +02:00
Lucas Werkmeister 731b4003a2 Fix Security Attributes column header width
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.
2021-10-20 15:02:26 +02:00
Daniel Lange 30c5004cbb Merge branch 'del-exe-lib-docs' of BenBE/htop into main 2021-10-19 06:59:11 +02:00
Benny Baumann 9d3a1d4981 Elaborate the highlighting of outdated/deleted executables and libraries 2021-10-19 00:39:24 +02:00
Christian Göttsche 60cfa2edce FreeBSD: add comment for memory leak workaround
Follow-up of #841

[ci skip]
2021-10-15 22:22:30 +02:00
Christian Göttsche 604744f68d Header: allocate memory for terminating entry
The names array is terminated by a NULL entry, thus allocate space for
one more than entries.

Fixes: #844

==6708==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000045b8 at pc 0x000000589ee1 bp 0x7ffcd1dee220 sp 0x7ffcd1dee218
READ of size 8 at 0x6060000045b8 thread T0
    #0 0x589ee0 in String_freeArray ./XUtils.c:157:23
    #1 0x56c9af in Settings_delete ./Settings.c:31:7
    #2 0x4ee44b in CommandLine_run ./CommandLine.c:395:4
    #3 0x4d6fb2 in main ./htop.c:15:11
    #4 0x7ff3b8154e49 in __libc_start_main csu/../csu/libc-start.c:314:16
    #5 0x428aa9 in _start (./htop+0x428aa9)

0x6060000045b8 is located 0 bytes to the right of 56-byte region [0x606000004580,0x6060000045b8)
allocated by thread T0 here:
    #0 0x4a53f2 in __interceptor_calloc (./htop+0x4a53f2)
    #1 0x5890ba in xCalloc ./XUtils.c:55:17
    #2 0x50a044 in Header_writeBackToSettings ./Header.c:148:34
    #3 0x4de861 in Action_runSetup ./Action.c:91:7
    #4 0x4de861 in actionSetup ./Action.c:386:4
    #5 0x515caf in MainPanel_eventHandler ./MainPanel.c:106:19
    #6 0x56a5c1 in ScreenManager_run ./ScreenManager.c:235:19
    #7 0x4ee13b in CommandLine_run ./CommandLine.c:364:4
    #8 0x4d6fb2 in main ./htop.c:15:11
    #9 0x7ff3b8154e49 in __libc_start_main csu/../csu/libc-start.c:314:16
2021-10-15 12:16:41 +02:00
Benny Baumann 13fe58f54a Update version number to 3.2.0-dev to identify git repo builds 2021-10-14 23:53:41 +02:00