Commit Graph

2428 Commits

Author SHA1 Message Date
Christian Göttsche fcca4c2f2d valgrind: track origin of uninitialised values 2021-09-11 00:07:23 +02:00
Christian Göttsche dd88510dcd HeaderOptionsPanel: select the current not saved option
Select the current active header layout, not the current saved layout
from the settings, as the value gets only saved back from the active
header to settings on closing the setup menu.

Closes: #785
2021-09-11 00:06:41 +02:00
Christian Göttsche 43ffdb0eda Linux: zero CPU data after allocation
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)
2021-09-11 00:04:00 +02:00
Christian Göttsche bf395e10c5 Add xReallocArrayZero() helper
Add helper function to reallocate an dynamic allocated array including
zeroing the newly allocated memory.
2021-09-11 00:04:00 +02:00
Christian Göttsche 8f259bc5e1 MemorySwapMeter: align with CPU meter
Use the same width for each sub meter to align with CPU meter.
Currently if the total width is even, so it does not split exactly into
2 equal parts plus 1 (for the middle space character column), the extra
column is added to the second meter width.

Closes: #783
2021-09-10 17:09:48 +02:00
Christian Göttsche 38e6136b82 CRT: close backup stderr file after reset
Close the backup file descriptor of original stderr once it has been
restored at stderr.
2021-09-10 17:01:26 +02:00
Christian Hesse 589b0733d9 Settings: set ok when reading configuration from sysconfdir
Without this htoprc from sysconfdir is ignored and default meters
are loaded.
2021-09-10 08:58:58 +02:00
Nathan Scott c9b58c7fbe Add missing end-of-line to htoprc file version mismatch warning 2021-09-08 12:13:56 +10:00
Nathan Scott ca06e68037 Fix a typo in a configure.ac comment 2021-09-08 12:11:58 +10:00
Benny Baumann a516e0852e Update configure to reflect rc2 in the version 2021-09-05 19:07:29 +02:00
Hisham Muhammad 556d7c03e8 Add a Process_printPercentage helper routine
Replace several open-coded variants of percentage formatting.
This function has been ported from Hishams old 'next' branch.
2021-09-05 18:47:07 +02:00
Christian Göttsche 0925c54caa Drop redundant semicolons 2021-09-04 14:17:37 +02:00
Christian Göttsche d0f5b61aa5 hwloc: use int in hwloc_bitmap_foreach_begin loop
Affinity.c:67:10: runtime error: implicit conversion from type 'int' of value -1 (32-bit, signed) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned)
2021-09-04 09:48:53 +02:00
Christian Göttsche 284f8c5e0b configure: output vserver as implied if ancient-vserver is enabled
The build time configuration ancient-vserver implies the configuration
vserver; say so in the configure status report if only ancient-vserver
has been specified.

Also indent with 3 spaces.
2021-09-04 09:48:53 +02:00
Christian Göttsche 11b65a2861 Header: use upper case floating point suffix 2021-09-04 09:48:53 +02:00
Christian Göttsche b85b718e69 Settings: enclose casted macro argument in parenthesis 2021-09-04 09:48:53 +02:00
Christian Göttsche 7891cdc552 Reduce variable scope
Also avoid declaring variables of different type, pointer and array, in
the same line.
2021-09-04 09:48:53 +02:00
Christian Göttsche b9fdf1c2a1 ColumnsPanel: drop unused struct declaration 2021-09-04 09:48:53 +02:00
Christian Göttsche 2844429f15 NetBSD: scale CPU frequencies
Use a value type of 'long int' to avoid ENOMEM failures of sysctl(3).

Also check for "machdep.tsc_freq", scaled in MHz.
2021-09-03 12:17:45 +02:00
Christian Göttsche 3834f2a68f NetBSD: misc const additions 2021-09-03 12:17:45 +02:00
Christian Göttsche 343c2e58be NetBSD: update process fields
Populate fields to ttyname, minflt, majflt and processor.
2021-09-03 12:17:45 +02:00
Christian Göttsche fd2c4f5ddd NetBSD: fix reading environment variables of processes
kvm_getenvv(3) seems not to work with kvm_openfiles(..., KVM_NO_FILES,
...)
2021-09-03 12:17:45 +02:00
Christian Göttsche 7f95ed8528 NetBSD: simplify Platform_setMemoryValues 2021-09-03 12:17:45 +02:00
Christian Göttsche 9579d9b7aa NetBSD: silence dropping const qualifier on define_key(3)
On NetBSD define_key(3) has the prototype

    int define_key(char *sequence, int key_symbol);
2021-09-03 12:17:45 +02:00
Christian Göttsche 0580dbb202 NetBSD: color process state P as running
On NetBSD state 'R' means runnable not running.

Improve the color identifier name accordingly.
2021-09-03 12:17:45 +02:00
Nathan Scott c0c2bb98a2 Add completion handling for dynamic meters and columns
Be sure to free dynamic memory allocated for meters and
columns strings, no-op on platforms other than pcp.

Closes #774
2021-09-03 09:47:01 +02:00
Nathan Scott 9b30870eec
Merge pull request #775 from cgzones/pcp
PCP: do not set exe to empty string
2021-09-03 12:08:00 +10:00
Christian Göttsche 25c945e2ef PCP: do not set exe to empty string
In case the executable is an empty string, e.g. if pcp is run by an
unprivileged user, do not set procExe to an empty value, which breaks
the formatting of the PROCEXE column and the merged-cmdline logic.
2021-09-02 23:37:53 +02:00
Christian Göttsche f94934472f Linux: rework disk-io parsing
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
2021-09-02 22:12:58 +02:00
Christian Göttsche becd33795c Settings: create default meters on no existing config file
If htop is started for the first time and no configuration file exists
the header is empty cause no meters are added as a default.

Add the default meters if parsing all available configuration paths
failed.
2021-09-02 08:03:21 +02:00
Christian Göttsche 74f99e3693 linux: simplify recheck condition
`recheck` is calculated modulo 2048, so its maximum value is 2047.
Drop the quite similar (up to 27 milliseconds) explicit check against
2000.
2021-09-02 08:03:21 +02:00
Christian Göttsche e1f4645bd1 Process: drop unused merged-command bit fields 2021-09-02 08:03:21 +02:00
Christian Göttsche 0afd0fe572 linux: color void delay accounting values gray
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.
2021-09-02 08:03:21 +02:00
Christian Göttsche ff336b652c linux: drop unused macro IOPriority_error 2021-09-02 08:03:21 +02:00
Christian Göttsche 58a59c11f4 linux: drop dead process field column DIRTY
The field for dirty pages in /proc/[pid]/statm is always 0 since Linux
2.6 (see man:proc(5)).
2021-09-02 08:03:21 +02:00
Christian Göttsche 3f806368e0 CPUMeter: use correct buffer size 2021-09-02 08:03:21 +02:00
Christian Göttsche 4855d92469 travis-ci: update
Drop explicit CFLAGS specification as `-Wno-c11-extensions` is enabled
on FreeBSD by the configure script.

Run and check `make install` and `make installcheck`.
2021-09-02 08:03:21 +02:00
Nathan Scott b81bb9038c Fix resource leaks dealing with unrecognised config file version
Plug leaks of an open file descriptor and dynamically allocated
'option' when we bail out early reading unknown config version.
2021-08-31 08:08:01 +02:00
Nathan Scott 1f2f567ca1 Fix meterPanels size calculation for dynamic array allocation 2021-08-31 08:08:01 +02:00
Daniel Lange 393330239e Small editorial fixes to ChangeLog 2021-08-27 09:31:06 +02:00
Nathan Scott d2c34259b4 Remove trailing whitespace in changelog for CI checks 2021-08-27 12:19:50 +10:00
Nathan Scott 858ad8029d Update configure to reflect rc1 in the version 2021-08-27 12:14:23 +10:00
Nathan Scott 6876a4b136 Update ChangeLog 2021-08-27 12:11:22 +10:00
Daniel Lange da7a369fa8 Merge branch 'shorten_crash_report' of cgzones/htop, rebased by BenBE 2021-08-26 19:31:50 +02:00
Christian Göttsche 4ed3ab5c2c Shorten crash output to fit on screen 2021-08-26 14:09:39 +02:00
Daniel Lange 088dc5b9a7 Remove license excemption for PLPA and update GPL-2 license text
The Portable Linux Processor Affinity (PLPA) project has been depreciated in
favour of the Portable Hardware Locality (hwloc) project. So the license
exception present in previous versions of htop is obsolete and thus removed.

The text of COPYING has been updated to the latest upstream license text
of GPL-2 from the Free Software Foundation, Inc. (FSF).
There are only editorial changes like line wrapping, removing page breaks,
updating the "19yy" to "<year>" and changing the FSF address.
2021-08-26 11:37:36 +02:00
Benny Baumann 16faf82739 Clarify naming of Platform_nanosecondsPerSchedulerTick 2021-08-25 20:45:00 +02:00
Daniel Lange df17374a92 Merge branch 'refactor-Darwin-platform-unit-conversion-helpers' of amomchilov/htop 2021-08-25 19:15:17 +02:00
Alexander Momchilov 59d0c5b26a Refactor Darwin platform unit conversion helpers 2021-08-25 11:55:05 -04:00
Daniel Lange fa48c484cc Merge branch 'fix-macOS-time-calculations' of amomchilov/htop 2021-08-25 17:07:06 +02:00