Commit Graph

2141 Commits

Author SHA1 Message Date
Benny Baumann 94a52cb5c9 Rename cmdlineBasenameOffset to cmdlineBasenameEnd to properly indicate the fields purpose 2021-05-23 09:22:21 +02:00
Benny Baumann 666f70c58c Move procCmdlineBasenameOffset as cmdlineBasenameStart to global Process structure 2021-05-23 09:22:21 +02:00
Benny Baumann 6dc485dd20 Remove duplicate field LinuxProcess->procCmdlineBasenameEnd
This field held practically the same value as cmdlineBasenameEnd
2021-05-23 09:22:21 +02:00
Benny Baumann a685661866 Move procExeBasenameOffset to main Process structure
This drops procExeLen, as that field is implicit by strlen(Process->procExe)
2021-05-23 09:22:21 +02:00
Benny Baumann 93a44acf7e Move procExeDeleted flag to main Process structure 2021-05-23 09:22:21 +02:00
Benny Baumann b839987df7 Rename basenameOffset to cmdlineBasenameOffset 2021-05-23 09:22:21 +02:00
Benny Baumann d74e8b7554 Move procComm and procExe to main Process structure 2021-05-23 09:22:21 +02:00
Benny Baumann 10790f0a54 Process: Put the time field more to the end 2021-05-23 09:22:21 +02:00
Benny Baumann 02431c43e1 Rename command line field from comm to cmdline 2021-05-23 09:22:21 +02:00
Benny Baumann fbec3e4005 Refactor makeCommandStr 2021-05-23 09:22:21 +02:00
Benny Baumann 07a4657a47 DragonFlyBSD: Fix included headers 2021-05-22 18:16:11 +02:00
Benny Baumann 2c8353e7cf DragonFlyBSD: Indentation and formatting fixes 2021-05-21 22:42:00 +02:00
Christian Göttsche ee9e7edbc1 Solaris: handle ERR macro redefinitions
On OmniOS /usr/include/sys/regset.h redefines ERR to 13 - \r, breaking
the Enter key.
Since ncruses macros use the ERR macro, we can not use another name.

Closes: #634
2021-05-20 19:16:29 +02:00
Christian Göttsche a62987c787 Solaris: improve process columns
- fill tty name
- fill session id
- show real tgid not adjusted
- drop unimplemented TPGID, MINFLT and MAJFLT
- adjust header width of ZONEID, which get auto-adjusted as a pid-column
2021-05-20 17:54:40 +02:00
Christian Göttsche 013d2efa51 Solaris: correct process env memory handling
Allow strncpy to NUL-terminate the buffer and do not return a non free-
able string literal.
2021-05-20 16:43:40 +02:00
Christian Göttsche 27be880d0f Solaris: reduce function scopes 2021-05-20 16:43:40 +02:00
Christian Göttsche 6b57898034 Solaris: reduce variable scope
Also check for getloadavg(3c) failure
2021-05-20 16:43:40 +02:00
Christian Göttsche 906dcf5cb3 Solaris: silence signed comparison 2021-05-20 16:43:40 +02:00
Christian Göttsche 8f34225a49 Solaris: fix includes 2021-05-20 16:43:40 +02:00
Christian Göttsche fdda291a0e Solaris: add kstat lookup wrappers
The system interfaces kstat_lookup() and kstat_data_lookup() take a
non-constant string parameter, but passing string literals is valid.

Add wrapper functions to ignore all the const-discard warnings.
2021-05-20 16:43:40 +02:00
Christian Göttsche 4676e35f42 DragonFlyBSD: fixup columns 2021-05-19 17:53:14 +02:00
Christian Göttsche 69cfaf2381 configure: ignore warning about delay accounting on non-Linux platform
If pkg-config is not installed the following message gets printed, even
on non Linux platform:

"Linux delay accounting support can not be enabled, cause pkg-config is
required for checking its availability"
2021-05-16 20:01:25 +02:00
Christian Göttsche d2ee40597c Use STDERR_FILENO instead of magic number 2021-05-16 19:55:51 +02:00
Christian Göttsche 1f5f40c091 Print current settings on crash 2021-05-16 19:55:31 +02:00
Daniel Lange 204bc710ba Adjust to current label reality and the fact that Github can't search for multiple labels ORed ... yet.
Has been only five years ... https://github.com/isaacs/github/issues/660
2021-05-14 11:29:29 +02:00
Daniel Lange 40ecde9d88 Add Github label disclaimer as per vi's comment
cf. 6900e57efd (commitcomment-50786333)
2021-05-14 11:17:35 +02:00
mayurdahibhate 3f86a011e6 platform-dependent files included relative to main source directory 2021-05-10 18:40:53 +02:00
mayurdahibhate 1b74dfe187 cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
Christian Göttsche d9c95369bc Enclose macro argument
Also enclosing is unnecessary in declaration as in
    int (VAR);
2021-05-10 17:48:05 +02:00
Christian Göttsche d918cd9f2a Align parameter name of Generic_gettime_realtime
Align with name in implementation.
2021-05-10 17:48:05 +02:00
Christian Göttsche 54d7c6a080 Sort include headers 2021-05-10 17:48:05 +02:00
Christian Göttsche 90ae730fd4 Ignore IDE configuration files
[skip ci]
2021-05-10 17:04:46 +02:00
Christian Göttsche 323d7e73aa Linux: update IO fields
- fix header width of IO_READ_RATE

- save data in bytes (not kilobytes) to better compute rate

- fix rate data: multiply with 1000 to compensate time difference in
  milliseconds

- rename unit less variable now into realtimeMs

- use Process_printBytes(..., data * pageSize, ...) instead of
  Process_printKBytes(..., data * pageSizeKB, ...) to avoid wrapper
2021-04-26 18:02:58 +02:00
Christian Göttsche b41e4d9c54 Rework process field print functions
Make functions formatting data for a process field column less error
prone, unify interfaces and improve some internals.

* Process_printBytes
  - rename from Process_humanNumber
  - take number in bytes, not kilobytes
  - handle petabytes
  - increase buffer to avoid crashes when the passed value is
    ~ ULLONG_MAX

* Process_printKBytes
  - add wrapper for Process_printBytes taking kilobytes keeping -1 as
  special value

* Process_printCount
  - rename from Process_colorNumber

* Process_printTime
  - add coloring parameter as other print functions
  - improve coloring and formatting for larger times

* Process_printRate
  - rename from Process_outputRate
  - use local buffer instead of passed one; this function prints to the
    RichString after all
2021-04-26 18:02:58 +02:00
Christian Göttsche 6bbb454881 LinuxProcess: print default buffer in ascii
`RichString_appendWide()` is more expensive than
`RichString_appendAscii()` due to the calls to `mbstowcs(3)` and
`iswprint(3)`.

Use the latter to print the process field buffer by default.

For the following fields this theoretically can corrupt the output:
  - SECATTR
  - CGROUP
  - CTID
2021-04-26 17:51:45 +02:00
Christian Göttsche a2be57d768 Process: print default buffer in ascii
`RichString_appendWide()` is more expensive than
`RichString_appendAscii()` due to the calls to `mbstowcs(3)` and
`iswprint(3)`.

Use the latter to print the process field buffer by default.

For the following fields this theoretically can corrupt the output:
  - TTY
2021-04-26 17:51:45 +02:00
Christian Göttsche 436808ff99 Use RichString_appendnAscii where possible
`RichString_appendnAscii()` avoids a `strlen(3)` call over
` RichString_appendAscii()`.
Use the former where the length is available from a previous checked
`snprintf(3)` call.

Keep `RichString_appendAscii()` when passing a string literal and
rely on compilers to optimize the `strlen(3)` call away.
2021-04-26 17:51:45 +02:00
Christian Göttsche 099dab88be ZfsCompressedArcMeter: avoid division by 0
On systems not using ZFS `this->values[0]` is zero.
2021-04-22 17:12:02 +02:00
Christian Göttsche 2d7069feb4 Linux: handle Shmem being part of Cached
See https://lore.kernel.org/patchwork/patch/648763/

Do not show twice by subtracting from Cached.

Closes: #591
2021-04-22 10:48:15 +02:00
Nathan Scott 3db3737d75 Update FUNDING.yaml to use open_collective directly (thanks cgzones) 2021-04-22 14:37:09 +10:00
Benny Baumann a75b99a15e Document '?' key to reach the help screen 2021-04-21 21:49:03 +02:00
Christian Göttsche 615fc934ff Add assert for unreachable switch case
Like the default case in Process_writeField()
2021-04-21 20:58:28 +02:00
Christian Göttsche bd689ab0d3 Avoid implicit pointer to bool conversion in assignment
Improve readability
2021-04-21 20:58:28 +02:00
Christian Göttsche d58c2f0606 Drop ProcessList_get and ProcessList_size
Only used inside ProcessList.c and only once each.
2021-04-21 20:58:28 +02:00
Christian Göttsche 5dbca0193d Make MainPanel_pidSearch a static function
Not used elsewhere.
2021-04-21 20:58:28 +02:00
Christian Göttsche a05e78f531 Linux: use more robust pid parsing
Also add comment to condition
2021-04-21 20:58:28 +02:00
Nathan Scott ace5730f89 Add github funding link to htop opencollective page 2021-04-21 16:33:07 +10:00
Stuart Henderson feec16cbb5 don't include offline CPUs in summary for OpenBSD
By default, OpenBSD disables SMT (hyperthreading) cpu pseudo-cores.
This can be changed at runtime by setting the hw.smt sysctl so they
may become active later, therefore they are still present in cpu
stat structures but are marked as offline.

As done with native top(1), this drops them from the cpu summary
graphs.
2021-04-18 16:58:20 +02:00
Christian Göttsche d63394b5f6 DragonFlyBSD: resolve sign comparison
Compat.c: In function 'Compat_faccessat':
  Compat.c:46:14: error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare]
     46 |    if (dirfd != AT_FDCWD || mode != F_OK) {
        |              ^~
2021-04-14 17:29:56 +02:00
Christian Göttsche 99cde7edec FreeBSD: silence unsigned integer underflow
freebsd/FreeBSDProcessList.c:252:47: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
      #0 0x397c32 in FreeBSDProcessList_scanCPU /root/workspace/htop/htop/freebsd/FreeBSDProcessList.c:252:47
      #1 0x38fe76 in ProcessList_goThroughEntries /root/workspace/htop/htop/freebsd/FreeBSDProcessList.c:438:4
      #2 0x35ef9a in ProcessList_scan /root/workspace/htop/htop/ProcessList.c:618:4
      #3 0x31ee9e in main /root/workspace/htop/htop/htop.c:468:4
      #4 0x26bbcf in _start /usr/src/lib/csu/amd64/crt1.c:76:7
2021-04-14 17:29:56 +02:00