Commit Graph

1470 Commits

Author SHA1 Message Date
Benny Baumann
3e5bc034e5 Ensure full initialization of all fields 2020-10-18 17:35:32 +02:00
Benny Baumann
4dfedd3930 Fix various file descriptor leaks 2020-10-18 17:35:32 +02:00
Benny Baumann
c138d14897 Release old memory on error
Avoids leaking memory upon realloc failure.
2020-10-17 20:54:14 +02:00
Benny Baumann
5e4b182616 Combine XAlloc.[ch] into XUtils.[ch] 2020-10-17 20:54:14 +02:00
Benny Baumann
872e542f4e Rename StringUtils.[ch] to XUtils.[ch] 2020-10-16 20:30:21 +02:00
Benny Baumann
c6f04a9c5d Move xAsprintf, xSnprintf and xStrdup to StringUtils.h 2020-10-16 20:29:45 +02:00
Christian Göttsche
7cd093ce95 Add NetworkIOMeter 2020-10-16 20:00:14 +02:00
Christian Göttsche
a802961286 Generalize Meter value colors for IO 2020-10-16 20:00:14 +02:00
Christian Göttsche
e9246abff8 Misc Vector updates
- Move swap() macro to source file and implement as function
- Implement Vector_get() and Vector_size() as inline functions
  to make them type safe and avoid lhs usage
- Comment comparison statistics, they are only needed for performance
  testing
2020-10-16 19:47:34 +02:00
Christian Göttsche
a63cfc8b7c Refactor generating starttime string into Process class 2020-10-16 19:23:40 +02:00
Christian Göttsche
783be7711d Do not use extra starttime process field on Linux 2020-10-16 19:23:40 +02:00
Christian Göttsche
d744dac7ee Add SELinuxMeter 2020-10-16 19:20:07 +02:00
Christian Göttsche
af4f58d013 Misc conversion fixes 2020-10-16 19:16:53 +02:00
Christian Göttsche
1d00893110 Automatically detect if backtrace(3) needs -lexecinfo 2020-10-16 10:58:14 +02:00
Christian Göttsche
846fe8a71f Mark Vector parameter const for non-modifying functions 2020-10-15 20:45:39 +02:00
Christian Göttsche
3c08fa3c63 Keep building on errors
Doing so allows for more than one error to be detected in builds
2020-10-15 20:45:39 +02:00
Christian Göttsche
bfa7d1fbe2 Mark search parameter in Vector_indexOf const 2020-10-15 20:45:39 +02:00
Benny Baumann
2f9381d867 Keep building on errors
Doing so allows for more than one error to be detected in builds
2020-10-15 20:31:56 +02:00
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