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] = '.';