From e01d8d5e1aefa7ce9166cb88ac58cf950af34542 Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Fri, 19 Sep 2025 23:06:37 +0200 Subject: [PATCH] pctl ls List procs by PID --- user/pctl/ls.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/user/pctl/ls.c b/user/pctl/ls.c index 475e60d..c0c01dd 100644 --- a/user/pctl/ls.c +++ b/user/pctl/ls.c @@ -13,10 +13,15 @@ struct { char *specificproc; -} PCTL_LS_CONFIG; + int32_t pid; +} PCTL_LS_CONFIG = { + .specificproc = NULL, + .pid = -1, +}; static Arg ARGS[] = { ARG("-proc", ARG_STRING, &PCTL_LS_CONFIG.specificproc), + ARG("-pid", ARG_INT, &PCTL_LS_CONFIG.pid), ARG_END(), }; @@ -80,6 +85,10 @@ void pctl_ls(void) { continue; } + if (PCTL_LS_CONFIG.pid != -1 && stat.pid != PCTL_LS_CONFIG.pid) { + continue; + } + string_memcpy(namebuf, stat.name, 30); namebuf[31] = namebuf[32] = namebuf[33] = '.';