1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:37:34 +00:00

ps: Don't assert when coming across a zombie process

Fixes #1278.
This commit is contained in:
Andreas Kling 2020-02-27 10:37:07 +01:00
parent 72cbbd5297
commit 9632388bed

View file

@ -65,15 +65,18 @@ int main(int argc, char** argv)
else else
tty = "n/a"; tty = "n/a";
auto* state = proc.threads.is_empty() ? "Zombie" : proc.threads.first().state.characters();
auto times_scheduled = proc.threads.is_empty() ? 0 : proc.threads.first().times_scheduled;
printf("%-3u %-3u %-3u %-3u %-3u %-11s %-3u %-9u %-3u %-5s %s\n", printf("%-3u %-3u %-3u %-3u %-3u %-11s %-3u %-9u %-3u %-5s %s\n",
proc.pid, proc.pid,
proc.pgid, proc.pgid,
proc.pgp, proc.pgp,
proc.sid, proc.sid,
proc.uid, proc.uid,
proc.threads.first().state.characters(), state,
proc.ppid, proc.ppid,
proc.threads.first().times_scheduled, times_scheduled,
proc.nfds, proc.nfds,
tty.characters(), tty.characters(),
proc.name.characters()); proc.name.characters());