Age | Commit message (Collapse) | Author |
|
be fully loaded.
|
|
It is inappropriate to use the 'fd' name for 'FILE*' variables.
POSIX file descriptiors are of type 'int' and are distinguished from
ISO C stream pointers (type 'FILE*').
Rename these variables to 'fp', which is a preferred naming in POSIX.
(Note that ISO C preferred the 'stream' name for the variables.)
No code changes.
|
|
Regression from c55401b82b1bb278947f9d2a3aed13a9f0de85a9
|
|
|
|
|
|
This commit refactors the Process and ProcessList structures such
they each have a new parent - Row and Table, respectively. These
new classes handle screen updates relating to anything that could
be represented in tabular format, e.g. cgroups, filesystems, etc,
without us having to reimplement the display logic repeatedly for
each new entity.
|
|
|
|
This includes:
- Wrap function implementations
- Pointer alignment for function signatures
- Pointer alignment for variable declarations
- Whitespace after keywords
- Whitespace after comma
- Whitespace around initializers
- Whitespace around operators
- Code indentation
- Line break for single line statements
- Misleading alignment
|
|
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
|
|
The system curses library can handle terminal size changes with
SIGWINCH without asking system calls to restart, which effectively
stops system calls with -1 and EINTR. An example is ncurses on
Linux systems.
One of these system calls is waitpid. While waiting for the lsof child
to complete, a badly timed SIGWINCH can interrupt the waitpid call,
effectively never clearing the state of the child, keeping the zombie
until htop exits.
Proof of Concept:
#include <unistd.h>
int main(void) {
close(1); close(2);
sleep(5);
return 0;
}
Compile this as a replacement "lsof" and put it into your path. Make
sure that it's called instead of the real lsof.
Press "l" to list open files and resize your terminal within the next
5 seconds. You will see that a zombie process is kept by htop when the
timeout finishes.
|
|
|
|
|
|
|
|
|
|
This removes the call-sites of the removed setuid feature
|
|
|
|
|
|
|
|
|
|
Draw the FunctionBar within Panel_draw instead of manually throughout
the code.
Add an optional PanelClass function drawFunctionBar, to allow specific
panels to override the default FunctionBar_draw call.
Rework the code on color change, to really change all colors (selection
markers and panel headers).
Closes: #402
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Information as seen by IWYU 0.12 + clang 9 on Linux
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PR htop-dev/htop#70 got rid of the infrastructure for generating header
files, but it left behind some code duplication.
Some of cases are things that belong in the header file and don't need
to be repeated in the C file. Other cases are things that belong in the
C file and don't need to be in the header file.
In this commit I tried to fix all of these that I could find. When given
a choice I preferred keeping things out of the header file, unless they
were being used by someone else.
|
|
Reasoning:
- implementation was unsound -- broke down when I added a fairly
basic macro definition expanding to a struct initializer in a *.c
file.
- made it way too easy (e.g. via otherwise totally innocuous git
commands) to end up with timestamps such that it always ran
MakeHeader.py but never used its output, leading to overbuild noise
when running what should be a null 'make'.
- but mostly: it's just an awkward way of dealing with C code.
|
|
|
|
|
|
I was occasionally passing negative values to size_t.
Plus, this better reflects the intent of the variant argument.
Reported by Coverity:
https://scan8.coverity.com/reports.htm#v13253/p10402/fileInstanceId=22093891&defectInstanceId=7543346&mergedDefectId=174179&fileStart=251&fileEnd=500
|
|
Calls marked with xSnprintf shouldn't fail.
Abort program cleanly if any of them does.
|
|
|
|
This is/was necessary only on macOS, because you needed root in order
to read the process list. This was never necessary on Linux, and
it also raises security concerns, so now it needs to be enabled
explicitly at build time.
|
|
Several string pointer arrays pointed to const strings
but were not const themselves.
A few various structures and arrays were also marked const.
|
|
sys/time.h for struct timeval
|
|
In all the cases where sprintf was being used within htop, snprintf
could have been used. This patch replaces all uses of sprintf with
snprintf which makes sure that if a buffer is too small to hold the
resulting string, the string is simply cut short instead of causing
a buffer overflow which leads to undefined behaviour.
`sizeof(variable)` was used in these cases, as opposed to `sizeof
variable` which is my personal preference because `sizeof(variable)`
was already used in one way or another in other parts of the code.
|
|
Closes #483.
|
|
|
|
|
|
on Darwin, htop needs to run with root privileges to display information
about other users processes. This commit makes running htop SUID root a
bit more safe.
|