* Improve readability (uniformity, naming, includes)
* De-cluttering, new types, reduced usage of globals
* Introduce new enums, change format functions
* Change to realtime clock
* Improve performance and style, partial rewrite
This commit addresses TODO#2 by universalizing the functions handling
the zombie processes and sending `SIGCHLD` in the case where the
user did not explicitly tell the program to reap zombies (reflected
in the `terminate` member of our settings. Whenever a signal
is sent, the used signal is displayed to the user.
Some parts of old functions were put into new functions to also
improve readability.
The most substantial improvement lies in the performance aspect
of the program. The use of `nftw()` in the old code was the
biggest bottleneck, as an insane, unnecessary number of syscall
are issued for each process. Thus, the directory and file reading
part was adapted, using manual `readdir()` calls. As the `-f` flag
did not make sense to have in the program anyway (and could lead
to OOM kill), it was also dropped.
Regex was also dropped, as its use was unnecessary and complicated
things, and the parsing of `"/proc/<pid>/stat"` was rewritten.
As kernel processes were not excluded in the program before,
this commit checks for processes which should be left out
of our considerations (PID `2`, as well as its children;
`init` is also excluded).
Display widths for the output are now defined in the accompanying
header, and should be in line with the `proc(5)` documentation.
The code for the prompt was improved with respect to the handling
of invalid user input and coloring.
Finally, to completely remove the unnecessary globals, a vector
structure was defined in the header, which can dynamically grow.
As the old version of the code did not check for overflows in this
context, this is also a great improvement.
* Add newline at end of file in Dockerfile
* Adapt code in `zproc.c` to match `zps.{c,h}`
* Update manpage to match source
* Remove the `-f` flag test
* Remove unnecessary comments and update category
* Add missing newline at EOF in `CMakeLists.txt`
* Remove notions of `-f` from the READMEs
* Add a `.clang-format` file consistent with sources
* Remove the other `-f` test
* Add missing `<limits.h>` include
* Use custom signal abbreviation function
* Remove `stdlib.h.gcov` from `rm` command
* Change array to `static`
* Remove redundant print (will never happen (`proc(5)`)
* Add `const` qualifiers to be more clear
* Add even more `const` qualifiers
* Change function pre-conditions to `assert()` calls
* Bump version
Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
* Drop unused macro
* Define `NDEBUG` in `CMakeLists.txt` and `Makefile`
This will disable the pre-condition assertions in all functions,
which should never be false for releases anyway.
* Extend color functionality, refactor CLI options
This commit ...
* allows users to directly specify signals to
send to zombie parents (using common signal
numbers, abbreviations and abbreviations with
"sig" in front of them (case-insensitive)
* changes existing command-line options to simpler
ones
* places constraints on the possible combinations
of command-line options used
* adds functionality to detect if the program's
output is, for example, piped to another program
that will automatically disable ANSI color codes
* adds a `--no-color` option to manually disable
the default coloring
The manual page and READMEs would still need
to be updated.
* Update tested flags
* Update demos, READMEs and help texts
* Bump year
* Improve code clarity and remove TODOs (issues TBA)
* Disable runtime assertions for the `Dockerfile`
---------
Co-authored-by: Matthäus Wininger <matthaeus dot wininger at univie dot ac dot at>
Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>