summaryrefslogtreecommitdiffstats
path: root/TraceScreen.c
AgeCommit message (Collapse)Author
9 daysFixed the issue that the process traced by strace ends and causes the CPU to ↵charles
be fully loaded.
2024-04-17Use 'fp' name for local 'FILE*' variables.Explorer09
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.
2023-12-29Fix execlp() argument without pointer castExplorer09
Regression from c55401b82b1bb278947f9d2a3aed13a9f0de85a9
2023-12-29Add support for "truss" (FreeBSD equivalent of "strace")Daniel (dmilith) Dettlaff
2023-12-26Fix code styleBenny Baumann
2023-08-30Introduce Row and Table classes for screens beyond top-processesNathan Scott
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.
2023-04-11Minor code formatting consistency fixesBenny Baumann
2022-10-24Reformat code baseBenny Baumann
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
2022-05-19Use of NULL in execlp() must have a pointer cast.Explorer09
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2022-01-11Avoid zombie processes on signal racesTobias Stoeckmann
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.
2021-09-22Update license headers to explicitly say GPLv2+Daniel Lange
2021-08-25IWYU updateChristian Göttsche
2021-05-10cleaned up includes with iwyumayurdahibhate
2021-03-02Use ATTR_UNUSED instead of void castingChristian Göttsche
2021-02-17Refactor to remove no-op callsBenny Baumann
This removes the call-sites of the removed setuid feature
2021-01-28TraceScreen: draw panel headerYoungjae Lee
2021-01-11Mark several non-modified pointer variables constChristian Göttsche
2020-12-22Merge branch 'misc' of https://github.com/cgzones/htop into cgzones-miscChristian Göttsche
2020-12-21TraceScreen: mark local class functions staticChristian Göttsche
2020-12-20Rework drawing of FunctionBarChristian Göttsche
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
2020-12-20Mark event arrays constChristian Göttsche
2020-11-24Improving Command display/sortNarendran Gopalakrishnan
2020-11-02Shorten initializerBenny Baumann
2020-11-02Embracing branchesBenny Baumann
2020-11-02Spacing around operatorsBenny Baumann
2020-11-02Spacing after keywords (if)Benny Baumann
2020-10-18Make all required includes explicitBenny Baumann
Information as seen by IWYU 0.12 + clang 9 on Linux
2020-10-18Ensure full initialization of all fieldsBenny Baumann
2020-10-18Fix various file descriptor leaksBenny Baumann
2020-10-16Rename StringUtils.[ch] to XUtils.[ch]Benny Baumann
2020-10-16Misc conversion fixesChristian Göttsche
2020-10-07Mark Object instances constChristian Göttsche
2020-10-05Update License consistently to GPLv2 as per COPYING fileDaniel Lange
2020-09-17Avoid hardcoding of buffer sizeBenny Baumann
2020-09-17Barely ever seen any 1000 digit PIDs …Benny Baumann
2020-09-12Clean up some code duplication in the header filesHugo Musso Gualandi
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.
2020-09-03Axe automated header generation.Zev Weiss
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.
2019-04-29Add timestamps to the strace screenMario Harjac
2018-03-25strace: increase string lengthHisham Muhammad
2018-02-18Replace size_t with int/void* unionHisham Muhammad
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
2017-07-27Security review: check results of snprintf.Hisham Muhammad
Calls marked with xSnprintf shouldn't fail. Abort program cleanly if any of them does.
2017-07-26Merge branch 'master' of https://github.com/hishamhm/htopHisham Muhammad
2017-07-26Security review: make privilege dropping-restoring optional.Hisham Muhammad
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.
2017-07-22Mark some things as constRichard
Several string pointer arrays pointed to const strings but were not const themselves. A few various structures and arrays were also marked const.
2017-03-25Add missing includecoypoop
sys/time.h for struct timeval
2016-12-29Replace all uses of sprintf with snprintfTomasz Kramkowski
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.
2016-05-25Silence warnings about seteuid return value.Hisham
Closes #483.
2016-02-02Check for failure in allocations.Hisham
2016-01-12refactor *Screen classes, add InfoScreen superclassHisham Muhammad
2015-12-02add some security checks when running SUID rootMichael Klein
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.