Commit Graph

2396 Commits

Author SHA1 Message Date
Christian Göttsche 8c43856380 FreeBSD: populate processor field 2021-01-30 14:21:26 +01:00
Christian Göttsche 79620d01c0 FreeBSD: drop unused jail_errmsg variable 2021-01-30 14:21:26 +01:00
Christian Göttsche 399add39ca FreeBSD: simplify kernel thread logic 2021-01-30 14:21:26 +01:00
Christian Göttsche 56c4055fd1 FreeBSD: drop unused ProcessList fields 2021-01-30 14:21:26 +01:00
Christian Göttsche fa499fc155 FreeBSD: misc 2021-01-30 14:21:26 +01:00
Christian Göttsche fdaa15bd8d Linux: overhaul io process fields
- avoid UBSAN conversions
- print N/A on no data (i.e. as unprivileged user)
- fix rate calculation to show bytes (instead of a thousandth)
- print bytes as human number (i.e. 8MB) instead of 8388608
- stabilize sorting by adjusting NAN values to very tiny negative number
2021-01-30 14:21:26 +01:00
Christian Göttsche fee744abd2 Update generic process field display
- sort cases by identifier
- use check snprintf
- color nice value of 0 as gray
- color cpu and memory percentages of 0.0 as gray
- color number of threads of 1 as gray
- color idle and sleeping state as gray
- color tgid matching pid (indicating main thread) as gray
2021-01-30 14:21:26 +01:00
Christian Göttsche d5de1bc23d Overhaul sorting of state process column
Do not sort by ascii value of the state identifier, sort by relevance
2021-01-30 14:21:26 +01:00
Christian Göttsche a3c8285237 Refactor to tty_nr process field display
If no terminal name can be found, fall back to generic display method
with major and minor device numbers.

Print special value '(none)' in case both are zero.
2021-01-30 14:21:26 +01:00
Christian Göttsche 03d6345c89 Process: document process fields
Drop unused fields 'flags' and 'exit_signal'
2021-01-30 14:21:26 +01:00
divinity76 93378b9ee5 fix typo/missing newline for --enable-static
https://i.imgur.com/byraZxG.png
2021-01-30 13:20:09 +01:00
Christian Göttsche 3acf28c259 Unsupported: pass compilation 2021-01-29 14:12:44 +01:00
Christian Göttsche bd694c0ce6 Do not call exit(3) in signal handler
Call safe _exit(2) instead
2021-01-29 12:38:30 +01:00
Christian Göttsche fd8c0611af Use different function on different detection method to avoid caching
Using the same function for the same library causes AC_CHECK_LIB to use
cached results.
Since we change the detection method via different or no
ncurses(5|6)-config invocation, avoid such caching by using different
functions.
2021-01-28 23:40:37 +01:00
Christian Göttsche f27bab470b Drop duplicate option
Option subdir-objects is now define in configure.ac
2021-01-28 23:40:37 +01:00
YJ Lee 34da6fdadb Avoid syntax injection inside code block
Co-authored-by: BenBE <BenBE@geshi.org>
2021-01-28 09:21:18 +01:00
Youngjae Lee e54a790b14 TraceScreen: draw panel header 2021-01-28 09:21:18 +01:00
Youngjae Lee 3c61813ea6 InfoScreen: add mouse wheel scroll 2021-01-28 09:21:18 +01:00
Youngjae Lee fd45845829 InfoScreen: fix mouse selection 2021-01-28 09:21:18 +01:00
Daniel Lange 92fb69f5a0 Merge branch 'todo' of cgzones/htop
Make CRT_init get an instance of Settings instead of a separate colorScheme
2021-01-28 07:36:14 +01:00
Daniel Lange 5644d0194b Merge branch 'default_libcap' (configure overhaul) of cgzones/htop 2021-01-28 07:31:15 +01:00
Christian Göttsche 6dba60f6bd Pass Settings to CRT_init
Resolve todo
2021-01-27 17:14:15 +01:00
Christian Göttsche 211121f060 Drop invalid todo
The surrounding code has nothing to do with colors
2021-01-27 17:06:21 +01:00
Christian Göttsche d77703b3dc ci: use as-needed linker flag in gcc full-featured build
Test whether there are any linking issues
2021-01-27 15:36:50 +01:00
Christian Göttsche 3035e29e74 Use typedef names instead of raw struct ones 2021-01-26 21:16:23 +01:00
Christian Göttsche 575edffb4b Add configure option to create static htop binary 2021-01-25 18:01:39 +01:00
Christian Göttsche 759a34039c configure: fail immediately on missing requirement 2021-01-25 17:57:21 +01:00
Christian Göttsche 38b6a0148f configure: misc modernizations
- require autoconf version 2.69
  was released in 2012 and one still can configure and build on older
  systems (just not generate the configure script)
- use modern C99 compiler check
- drop obsolete checks: AC_C_CONST, AC_FUNC_CLOSEDIR_VOID, AC_FUNC_STAT
- drop AC_HEADER_STDBOOL in favor of C99 compatibility
2021-01-25 17:57:21 +01:00
Christian Göttsche f3623b7880 configure: reformat for improved reabability 2021-01-25 17:57:21 +01:00
Christian Göttsche 5e103ff9d1 configure: overhaul option handling
Switch Linux capabilities default from "no" to "check"

Document default settings

Use more readable formatting
2021-01-25 17:54:37 +01:00
Christian Göttsche 0f04714a03 Fix possible division by zero
Do not pass a nmemb of 0 to calloc, cause it's unportable and forbidden
with our wrapper.

Found by Coverity
2021-01-25 17:33:29 +01:00
Christian Göttsche 2ec44098f9 Allow meters in text mode to span empty neighbors to the right
Closes: #484
2021-01-23 15:20:47 +01:00
Daniel Lange 6f6e0ec571 Update copyright for 2021 2021-01-22 20:06:51 +01:00
Daniel Lange d269d7247f Merge branch 'mop-up-sort-mess' of fasterit/htop 2021-01-22 16:26:42 +01:00
Daniel Lange 041feeca18 Add note to users about sort logic changes to ChangeLog 2021-01-22 16:24:33 +01:00
Daniel Lange 074703bd5c Implement stable tie-breaker and add more defaultSortDesc fields as per cgzones' suggestions, simplify Process_compare flow from BenBE 2021-01-22 09:57:44 +01:00
Christian Göttsche 4dadbe3b34 configure: add -Winit-self warning 2021-01-21 19:49:07 +01:00
Daniel Lange 4531b31d92 Sort out the mess around column sorting that had accumulated over time 2021-01-21 14:27:23 +01:00
James Abbatiello b20bb543ce Find the correct library for clock_gettime before trying to use it
Otherwise if clock_gettime is librt then this code will incorrectly believe
that the function does not exist at all.
2021-01-20 15:04:03 +01:00
David Zarzycki 03824da684 Linux: individual huge page values in the huge page meter 2021-01-19 18:06:48 +01:00
Christian Göttsche 4d85848988 Linux: handle hugepages
Subtract hugepages from normal memory.
Add a HugePageMeter.

Closes: #447
2021-01-19 18:06:48 +01:00
Daniel Lange 71f51a20c1 Define PATH_MAX for GNU/hurd
Otherwise fails with
"> linux/LinuxProcessList.c:889:20: error: ‘PATH_MAX’ undeclared (first use in this function)"
2021-01-16 12:31:44 +01:00
Christian Göttsche 1f20c0fb3d Linux: fall back to cpuinfo on slow scaling_cur_freq read
On some AMD and Intel CPUs read()ing scaling_cur_freq is quite slow
(> 1ms). This delay accumulates for every core.
If the read on CPU 0 takes longer than 500us bail out and fall back to
reading the frequencies from /proc/cpuinfo.
Once the condition has been met, bail out early for the next couple of
scans.

Closes: #471
2021-01-15 20:55:53 +01:00
Christian Göttsche b5a5e83470 LED Meter: display wide characters and restore non-wide ncurses support
Print wide characters, like degree sign, properly via mvadd_wch().
Ignore attributes when returning value from RichString_getCharVal() in
non-wide ncurses mode to test against raw characters.
2021-01-15 20:41:10 +01:00
Christian Göttsche b9adc30b86 RichString: implement safe rewind
The current rewind logic causes issues when rewinding over the short
string optimization boundary.
2021-01-15 20:41:10 +01:00
Christian Göttsche 08ac22ddb9 RichString: refactor writing limited amount of columns
Closes: #468
2021-01-15 20:41:10 +01:00
Christian Göttsche ceee96dcba Do not try to set not owned capabilities
If the process has already less capabilities than we are trying to keep,
do not try to set them.
2021-01-13 22:12:06 +01:00
Christian Göttsche 5fde0e0127 RichString_appendChr: add parameter to set attributes
Allows to set attributes when padding process fields in non-wide ncurses
mode.

Closes: #475
2021-01-13 19:22:33 +01:00
Christian Göttsche 78b993dbb4 kfreeBSD: include config.h for _GNU_SOURCE (part 2)
strcasestr(3) is a GNU extension and when compiling freebsd/Platform.c
on kfreebsd for Debian <string.h> is included before we define
_GNU_SOURCE, so the function is not available.

In file included from ./Object.h:16,
                 from ./ListItem.h:12,
                 from ./Meter.h:16,
                 from ./Header.h:10,
                 from ./Action.h:15,
                 from freebsd/Platform.h:13,
                 from freebsd/Platform.c:8:
./XUtils.h: In function ‘String_contains_i’:
./XUtils.h:43:11: warning: implicit declaration of function ‘strcasestr’; did you mean ‘strcasecmp’? [-Wimplicit-function-declaration]
   43 |    return strcasestr(s1, s2) != NULL;
      |           ^~~~~~~~~~
      |           strcasecmp
./XUtils.h:43:30: warning: comparison between pointer and integer
   43 |    return strcasestr(s1, s2) != NULL;
      |                              ^~
In file included from ./Object.h:16,
                 from ./ProcessList.h:16,
                 from freebsd/FreeBSDProcessList.h:15,
                 from freebsd/FreeBSDProcessList.c:8:
./XUtils.h: In function ‘String_contains_i’:
./XUtils.h:43:11: warning: implicit declaration of function ‘strcasestr’; did you mean ‘strcasecmp’? [-Wimplicit-function-declaration]
   43 |    return strcasestr(s1, s2) != NULL;
      |           ^~~~~~~~~~
      |           strcasecmp
./XUtils.h:43:30: warning: comparison between pointer and integer
   43 |    return strcasestr(s1, s2) != NULL;
      |                              ^~
2021-01-12 19:05:46 +01:00
Christian Göttsche 47cebafd77 kfreeBSD: include config.h for _GNU_SOURCE
strcasestr(3) is a GNU extension and when compiling freebsd/Platform.c
on kfreebsd for Debian <string.h> is included before we define
_GNU_SOURCE, so the function is not available.

In file included from ./Object.h:16,
                 from ./ListItem.h:12,
                 from ./Meter.h:16,
                 from ./Header.h:10,
                 from ./Action.h:15,
                 from freebsd/Platform.h:13,
                 from freebsd/Platform.c:8:
./XUtils.h: In function ‘String_contains_i’:
./XUtils.h:43:11: warning: implicit declaration of function ‘strcasestr’; did you mean ‘strcasecmp’? [-Wimplicit-function-declaration]
   43 |    return strcasestr(s1, s2) != NULL;
      |           ^~~~~~~~~~
      |           strcasecmp
./XUtils.h:43:30: warning: comparison between pointer and integer
   43 |    return strcasestr(s1, s2) != NULL;
      |                              ^~
In file included from ./Object.h:16,
                 from ./ProcessList.h:16,
                 from freebsd/FreeBSDProcessList.h:15,
                 from freebsd/FreeBSDProcessList.c:8:
./XUtils.h: In function ‘String_contains_i’:
./XUtils.h:43:11: warning: implicit declaration of function ‘strcasestr’; did you mean ‘strcasecmp’? [-Wimplicit-function-declaration]
   43 |    return strcasestr(s1, s2) != NULL;
      |           ^~~~~~~~~~
      |           strcasecmp
./XUtils.h:43:30: warning: comparison between pointer and integer
   43 |    return strcasestr(s1, s2) != NULL;
      |                              ^~
2021-01-12 17:02:16 +01:00