Commit graph

17 commits

Author SHA1 Message Date
Tim Ledbetter
b863332415 pgrep: Add -O option to filter processes by age
This option allows the user to specify a number of seconds. Only
processes older than the given number of seconds are selected.
2023-06-10 07:13:25 +02:00
Tim Ledbetter
d03aaddb55 pgrep: Add -o option to display the oldest matching process only 2023-06-10 07:13:25 +02:00
Tim Ledbetter
47b530fa71 pgrep: Add -n option to display the newest matching process only 2023-06-10 07:13:25 +02:00
Tim Ledbetter
f5da6d61b4 pgrep: Add -x option to only select exact matches 2023-05-31 06:04:48 +02:00
Tim Ledbetter
821bf5e071 pgrep: Add -U option to filter matches by UID or login name 2023-05-31 06:04:48 +02:00
Tim Ledbetter
cb6a2d60d3 pgrep: Add -l option to list the process name as well as its pid 2023-05-31 06:04:48 +02:00
Tim Ledbetter
ad851706ab pgrep: Add -c option to show the number of matches 2023-05-31 06:04:48 +02:00
Tim Ledbetter
f95e6ee849 pgrep: Add --ignore-case as an alias for the -i option 2023-05-31 06:04:48 +02:00
Tim Ledbetter
8706c88370 pgrep: Return 1 rather than 0 if there are no matches
This matches the behavior of `pgrep` on Linux.
2023-05-31 06:04:48 +02:00
Tim Ledbetter
5a9a27cea0 pgrep: Add -d option to specify a pid delimiter
This is useful for commands which expect a comma-separated list of
pids.
2023-05-16 12:49:15 +02:00
Ali Mohammad Pur
500044906d LibCore+Everywhere: Remove ArgsParser::add*(char const*&)
This is not guaranteed to always work correctly as ArgsParser deals in
StringViews and might have a non-properly-null-terminated string as a
value. As a bonus, using StringView (and DeprecatedString where
necessary) leads to nicer looking code too :^)
2023-03-01 10:47:19 +01:00
Tim Schumacher
8940f2da7f LibCore: Use Core::Stream for ProcessStatisticsReader 2022-12-10 11:49:24 +00:00
Liav A
9d1ba0e6ad Utilities: Use new global variables at /sys/kernel/ directory 2022-10-25 15:33:34 -06:00
Riccardo Arena
a9b387a1bf pgrep: Port to LibMain
Use unveil to allow access only to required paths. 
Switch to new pledge format.
2022-02-10 14:10:58 +00:00
Andreas Kling
a54be656ae LibRegex: Don't push LibRegex's "Error" into the global namespace 2021-11-08 00:35:27 +01:00
Tom
7e77a2ec40 Everywhere: Improve CPU usage calculation
As threads come and go, we can't simply account for how many time
slices the threads at any given point may have been using. We need to
also account for threads that have since disappeared. This means we
also need to track how many time slices we have expired globally.

However, because this doesn't account for context switches outside of
the system timer tick values may still be under-reported. To solve this
we will need to track more accurate time information on each context
switch.

This also fixes top's cpu usage calculation which was still based on
the number of context switches.

Fixes #6473
2021-07-18 22:08:26 +02:00
Aziz Berkay Yesilyurt
11ff3c11f4 Userland: Add pgrep 2021-07-04 14:27:47 +02:00