pctl ls List procs by PID

This commit is contained in:
2025-09-19 23:06:37 +02:00
parent 44b5aa305c
commit e01d8d5e1a

View File

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