Commit Graph

95 Commits

Author SHA1 Message Date
Benny Baumann 02431c43e1 Rename command line field from comm to cmdline 2021-05-23 09:22:21 +02:00
mayurdahibhate 3f86a011e6 platform-dependent files included relative to main source directory 2021-05-10 18:40:53 +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
Christian Göttsche 9a8221568a Rework TTY column
* Rename internal identifier from TTY_NR to just TTY
* Unify column header on platforms
* Use devname(3) on BSD derivate to show the actual terminal,
  simplifies current FreeBSD implementation.
* Use 'unsigned long int' as id type, to fit dev_t on Linux.

Only on Solaris the terminal path is not yet resolved.
2021-04-14 17:29:56 +02:00
Alexander Nedotsukov 5afb57b49e FreeBSD: improve actual processor calculation logic 2021-03-30 23:38:32 +02:00
Christian Göttsche a11d01568c Use unsigned types for CPU counts and associated variables 2021-03-19 23:30:54 +01:00
Graham Inggs ee97916fd5
Merge pull request #436 from cgzones/freebsd
FreeBSD: add support for CPU frequency and temperature
Tested on two physical systems running FreeBSD 12.1
2021-03-18 14:03:51 +02:00
Nathan Scott adaf748ab6 Fix include file ordering of generic headers 2021-03-04 13:44:40 +11:00
Nathan Scott 61ef1134d9 Move generic (shared) code into its own sub-directory
Code that is shared across some (but not all) platforms
is moved into a 'generic' home. Makefile.am cleanups to
match plus some minor alphabetic reordering/formatting.

As discussed in https://github.com/htop-dev/htop/pull/553
2021-03-04 13:40:59 +11:00
Christian Göttsche fd2a0cf421 FreeBSD: add support for CPU frequency and temperature 2021-02-05 16:32:25 +01:00
Christian Göttsche 04cf590967 FreeBSD: drop minflt and implement majflt 2021-01-30 14:21:26 +01:00
Christian Göttsche 46370231e3 FreeBSD: drop unused idle thread code 2021-01-30 14:21:26 +01:00
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 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 a5db139a0a Linux: use correct column alignment for wide fields
This affects:
- PROC_COMM, PROC_EXE and CWD on Linux
- JAIL on FreeBSD and DragonFlyBSD
- ZONE on Solaris
2021-01-11 12:02:25 +01:00
Christian Göttsche d800d7a3ce Drop usage of formatted error messages from <err.h>
They do not clean up the ncurses environment, leaving the terminal in a
broken state.

Also drop bare usage of exit(3).
2021-01-07 16:10:05 +01:00
Graham Inggs 28bc087d8a Drop redundant sys/dirent.h include
sys/dirent.h is included by dirent.h in FreeBSD, and does not exist in Debian GNU/kFreeBSD
2020-12-11 20:57:19 +01:00
Nathan Scott 75e9f9a8d9 Cull the definitions of pageSize and pageSizeKB from CRT.c
By storing the per-process m_resident and m_virt values in the form
htop wants to display them in (KB, not pages), we no longer need to
have definitions of pageSize and pageSizeKB in the common CRT code.

These variables were never really CRT (i.e. display) related in the
first place.  It turns out the darwin platform code doesn't need to
use these at all (the process values are extracted from the kernel
in bytes not pages) and the other platforms can each use their own
local pagesize variables, in more appropriate locations.

Some platforms were actually already doing this, so this change is
removing duplication of logic and variables there.
2020-12-10 11:57:48 +11:00
Nathan Scott f704baeb82 Drop unused global ProcessList memory fields
The global ProcessList structure contains a couple of unused
fields.  'sharedMem' has never been used by any Meter, since
its not been anything other than zero in Linux /proc/meminfo
for many, many years.  The freeMem field is only used in the
usedMem calculation, so it can reside on the stack like some
other memory variables used within-calculations-only and not
exposed to the user via a Meter.
2020-11-27 07:55:58 +01:00
Benny Baumann ddda739cb2 Simplify code flow by inlining declarations where they are used
Note that xStrdup always returns non-NULL, thus the one error case cannot be reached.
2020-11-22 10:07:01 +01:00
Benny Baumann 3cb96f1a36 No need to check for change when no action is required 2020-11-22 10:04:54 +01:00
Christian Göttsche 0f4e3ebc95 Simplify page size related calculations 2020-11-21 19:39:45 +01:00
Christian Göttsche fa002c0ba9 Rename virtual memory column from M_SIZE to M_VIRT
Closes: #325
2020-11-21 19:39:45 +01:00
Christian Goettsche f5c3349bdb IWYU update (FreeBSD) 2020-11-19 23:51:50 +01:00
Benny Baumann 45869513bf Embracing branches 2020-11-02 22:15:01 +01:00
Benny Baumann 61e14d4bb2 Spacing around operators 2020-11-02 22:15:01 +01:00
Benny Baumann b23f8235e2 Whitespace and indentation issues 2020-11-02 22:15:01 +01:00
Benny Baumann 374edb9ed5 Spacing after keywords (if) 2020-11-02 22:14:59 +01:00
Christian Göttsche bbf01054bf Add compat wrapper for fstatat 2020-10-29 22:21:42 +01:00
Christian Göttsche 049046c700 FreeBSD: update Process 2020-10-29 22:21:42 +01:00
Christian Göttsche 97ea45ca9a FreeBSD: update ProcessList 2020-10-29 22:21:42 +01:00
Christian Goettsche 88eec2dc00 FreeBSD: rework tty process column 2020-10-29 22:21:42 +01:00
Christian Göttsche 61bae4c9d2 Unify function argument names
Name first argument of ProcessList_goThroughEntries consistently super
Name first argument of ProcessList_new consistently userTable
2020-10-28 19:57:10 +01:00
Christian Göttsche e89b289494 Drop duplicate assignment 2020-10-27 18:00:43 +01:00
Christian Göttsche a3bb7cbe64 Hold only a const version of Settings in ProcessList 2020-10-26 19:30:38 +01:00
Christian Göttsche 4eb443926f Hold only a const version of Settings in Process 2020-10-26 19:30:38 +01:00
Daniel Lange 9f1a9ab2c2 Merge branch 'header_pause' of cgzones/htop
Continue to update generic data in paused mode
2020-10-20 10:17:58 +02:00
Christian Göttsche 96e2a4259e Continue to update generic data in paused mode
Generic data, as CPU and memory usage, are used by Meters.
In paused mode they would stop receiving updates and especially Graph
Meters would stop showing continuous data.

Improves: #214
Closes: #253
2020-10-19 14:45:39 +02:00
Christian Göttsche 361877454f Cache PAGE_SIZE
man:sysconf(3) states:
    The values obtained from these functions are system configuration constants.
    They do not change during the lifetime of a process.
2020-10-19 14:42:35 +02:00
Benny Baumann 0f5262917f Make all required includes explicit
Information as seen by IWYU 0.12 + clang 9 on Linux
2020-10-18 20:09:05 +02:00
Christian Göttsche a63cfc8b7c Refactor generating starttime string into Process class 2020-10-16 19:23:40 +02:00
Benny Baumann 4a78f4bb92 Some more locations for ARRAYSIZE 2020-10-08 15:37:03 +02:00
Christian Göttsche db472075a4 Enable -Wcast-qual compiler warning 2020-10-06 11:20:07 +02:00
Daniel Lange 079c2abf8e Update License consistently to GPLv2 as per COPYING file 2020-10-05 10:13:12 +02:00
Benny Baumann dac1e05a2c Fix FreeBSD compile issue
This issue was previously hidden as xSnprintf expanded to only one large command that didn't trigger the GCC formatting check.
2020-09-29 17:41:31 +02:00
Christian Göttsche efb971f9df Fail travis CI on compiler warnings 2020-09-18 12:28:40 +02:00