Commit Graph

1854 Commits

Author SHA1 Message Date
Christian Göttsche 1df7fa387a Misc CRT cleanup 2020-10-14 14:28:02 +02:00
Christian Göttsche 59edb2e80c Enclose macro argument in parentheses 2020-10-13 14:56:01 +02:00
Christian Göttsche 7af06659e2 Mark remaining classes const 2020-10-13 14:56:01 +02:00
Christian Göttsche 5cc20e7cb2 Settings: do not save initial cpu count
Not needed and confusing with ProcessList.cpuCount
2020-10-12 13:15:23 +02:00
Christian Göttsche 9f5b50edd7 CPUMeter: avoid crashes and leaks in case the CPU count changes
E.g. if the HT/SMT mode changes

Use separate data for sub-meters
Do not reuse drawData for maintainability
2020-10-12 13:15:23 +02:00
Christian Göttsche 0b9a001498 Meter: use explicit type for drawData 2020-10-12 13:15:23 +02:00
Christian Göttsche 25022c219d Read CPU count every cycle to avoid issues when HT/SMT mode changes 2020-10-12 13:15:23 +02:00
Benny Baumann 601480003f Centralise fault handling
This should be done as all platforms essentially did the same anyway and there was nothing platform specific.
2020-10-12 13:06:12 +02:00
Christian Göttsche b47bc667a2 Add key to pause process list updates 2020-10-12 13:04:00 +02:00
Christian Göttsche fc301b7447 Compress size of default FunctionBar 2020-10-12 13:04:00 +02:00
Benny Baumann 55eafd3b39 Add conf*/ and callgrind.out.* to list of ignored files 2020-10-11 14:21:59 +02:00
Christian Göttsche f8b9ced93f OpenFilesScreen update
- Remove local types and function from header file
- Reduce OpenFiles_Data to neccessary size
- Print file access mode (r/w/u)
- Fix memory leak on consecutive items without an intermediate file item:

    ==15257==ERROR: LeakSanitizer: detected memory leaks

    Direct leak of 120 byte(s) in 12 object(s) allocated from:
        #0 0x48c864 in strdup (htop/htop+0x48c864)
        #1 0x542f68 in xStrdup htop/XAlloc.c:71:17
        #2 0x50e225 in OpenFilesScreen_getProcessData htop/OpenFilesScreen.c:112:25
        #3 0x50cd17 in OpenFilesScreen_scan htop/OpenFilesScreen.c:141:35
        #4 0x4fd3eb in InfoScreen_run htop/InfoScreen.c:81:35
        #5 0x4d58bb in actionLsof htop/Action.c:361:4
        #6 0x501766 in MainPanel_eventHandler htop/MainPanel.c:80:19
        #7 0x5289fa in ScreenManager_run htop/ScreenManager.c:227:19
        #8 0x4f748e in main htop/htop.c:300:4
        #9 0x7ff73e0d8cc9 in __libc_start_main csu/../csu/libc-start.c:308:16

    SUMMARY: AddressSanitizer: 120 byte(s) leaked in 12 allocation(s).
2020-10-10 11:26:43 +02:00
Christian Göttsche 79ad39c718 Mark Object pointer to _display function const 2020-10-10 11:25:19 +02:00
Fynn Wulf e5fdb80c7d Fix Hashtable_put to allow storing the same pointer 2020-10-09 12:23:16 +02:00
Christian Göttsche f4439b1b60 Makefile sort correction 2020-10-09 10:40:54 +02:00
Christian Göttsche 41eea8a355 Mark process argument of Process_isThread const 2020-10-09 10:18:40 +02:00
Daniel Lange 7fa0f19ffd Merge branch 'master' of https://github.com/ryenus/htop
Closes  #223
2020-10-09 09:45:41 +02:00
ryenus 32a2caa692 use 'w' for command wrapping as 'M' is already used
since 'M' is already used for sort-by-memory, as with:

    keys['M'] = actionSortByMemory;

reorder help info about shortcut keys
2020-10-09 09:03:32 +08:00
Benny Baumann 4a78f4bb92 Some more locations for ARRAYSIZE 2020-10-08 15:37:03 +02:00
Benny Baumann 2970cae543 Handle parsing envID & VPid from process status file
Fixes #55
Fixes #192
2020-10-07 13:14:39 +02:00
Christian Göttsche ba282cfe19 Mark Object instances const 2020-10-07 13:01:53 +02:00
Christian Göttsche 08d85e6143 Mark Object classes and Object class fields const 2020-10-07 13:01:53 +02:00
Benny Baumann 164051354f Replace copy loop by memmove in Vector_insert
This is basically the same change like in Vector_take,
just in the opposite direction.
2020-10-07 12:59:55 +02:00
Benny Baumann 1704c29b90 Use memmove for Vector_take
Doing a quick check with callgrind this gives
an average reduction from 1804 cycles/call
down to 491 cycles/call on my test system.

The average was taken over about 40k calls.
2020-10-07 12:59:55 +02:00
Daniel Lange 769df604b2 Set a -dev version to bug reports show a useful version and not the last release 2020-10-07 10:35:06 +02:00
laydervus fbf6424e64 Option to set initial filter
Closes #219
2020-10-07 10:34:25 +02:00
Christian Göttsche 954d6c12f5 Simplify statm parsing and document unused fields 2020-10-06 18:59:02 +02:00
Christian Göttsche 3653ee35c5 Drop redundant cast to same type 2020-10-06 11:46:41 +02:00
Christian Göttsche db159e7580 Enclose CLAMP macro arguments in parentheses 2020-10-06 11:46:41 +02:00
Christian Göttsche db472075a4 Enable -Wcast-qual compiler warning 2020-10-06 11:20:07 +02:00
Christian Göttsche ad3acfc847 Handle Panel_getSelected() returning NULL
Found by compiling with LTO:

    ColumnsPanel.c: In function ‘ColumnsPanel_eventHandler’:
    ColumnsPanel.c:46:59: error: potential null pointer dereference [-Werror=null-dereference]
       46 |             ((ListItem*)Panel_getSelected(super))->moving = this->moving;
          |                                                           ^
    AvailableColumnsPanel.c: In function ‘AvailableColumnsPanel_eventHandler’:
    AvailableColumnsPanel.c:31:8: error: potential null pointer dereference [-Werror=null-dereference]
       31 |    int key = ((ListItem*) Panel_getSelected(super))->key;
          |        ^
    AvailableMetersPanel.c: In function ‘AvailableMetersPanel_eventHandler’:
    AvailableMetersPanel.c:40:24: error: potential null pointer dereference [-Werror=null-dereference]
       40 |    int param = selected->key & 0xff;
          |                        ^
    linux/IOPriorityPanel.c: In function ‘IOPriorityPanel_getIOPriority’:
    linux/IOPriorityPanel.c:37:11: error: potential null pointer dereference [-Werror=null-dereference]
       37 |    return (IOPriority) ( ((ListItem*) Panel_getSelected(this))->key );
          |           ^
2020-10-06 11:17:23 +02:00
Nathan Scott e9fa290019 Merge branch 'update-license-and-copyright-info' 2020-10-06 10:27:38 +11:00
Christian Göttsche dc6523bf60 DateMeter followup 2020-10-05 13:59:05 +02:00
Michael F. Schönitzer d93cac12be
Add a date and datetime meter (#159)
Add a date meter and sort header and source files in Makefile

Change the lists of header and source files sorted alphabetical and one
file per line. This way diffs become better readable and merges easier.
2020-10-05 13:52:58 +02:00
Christian Göttsche ffd90c28ab Mention platform for platform specific configure options 2020-10-05 12:48:23 +02:00
Christian Göttsche 577984d875 Mark argument in Object_isA const 2020-10-05 12:47:56 +02:00
Christian Göttsche cdd3913647 Merge identical declarations 2020-10-05 12:47:56 +02:00
Christian Göttsche 49bb1b57f8 Assert that low value is lower than the high value in CLAMP 2020-10-05 12:47:56 +02:00
Daniel Lange 7758774890 Add Copyright statement to --help (needed as it has the license info) 2020-10-05 12:31:24 +02:00
ryenus ff455b0004 limit max screen title length to window width
Applies screen title truncating to all InfoScreen classes.
2020-10-05 12:18:05 +02:00
Daniel Lange 079c2abf8e Update License consistently to GPLv2 as per COPYING file 2020-10-05 10:13:12 +02:00
Daniel Lange 90d16b6630 Update copyright statement 2020-10-05 09:47:49 +02:00
Nathan Scott 72613a38f4 Merge branch '0000/int-sizes/00' of https://github.com/mfwitten/htop into mfwitten-0000/int-sizes/00 2020-10-05 16:19:58 +11:00
Nathan Scott c953257de6
Merge pull request #205 from cgzones/arraysize
Introduce ARRAYSIZE
2020-10-05 16:10:02 +11:00
Nathan Scott 576b82f86a Merge branch 'attr-nonnull' of https://github.com/BenBE/htop into BenBE-attr-nonnull 2020-10-05 15:57:52 +11:00
Christian Göttsche 42946ec113 Introduce ARRAYSIZE 2020-10-03 19:05:40 +02:00
Christian Göttsche b82a13c6ba Add clang analyzer CI job 2020-10-03 19:04:27 +02:00
Christian Göttsche d69585b82a Resolve DEBUG compilation issues
Use NDEBUG conditional instead of DEBUG.

Do not call static functions in extern inline ones.
    Vector.c:67:11: error: static function 'Vector_isConsistent' is used in an inline function with external linkage [-Werror,-Wstatic-in-inline]
2020-10-03 19:04:27 +02:00
Christian Göttsche b7f63292e5 Add --enable-debug configure option to enable asserts
asserts are still disabled by default.
2020-10-03 19:04:27 +02:00
Christian Göttsche e518459981 Add DiskIOMeter for IO read/write usage 2020-10-03 19:01:38 +02:00