pctl ls List procs by PID
This commit is contained in:
@ -13,10 +13,15 @@
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
char *specificproc;
|
char *specificproc;
|
||||||
} PCTL_LS_CONFIG;
|
int32_t pid;
|
||||||
|
} PCTL_LS_CONFIG = {
|
||||||
|
.specificproc = NULL,
|
||||||
|
.pid = -1,
|
||||||
|
};
|
||||||
|
|
||||||
static Arg ARGS[] = {
|
static Arg ARGS[] = {
|
||||||
ARG("-proc", ARG_STRING, &PCTL_LS_CONFIG.specificproc),
|
ARG("-proc", ARG_STRING, &PCTL_LS_CONFIG.specificproc),
|
||||||
|
ARG("-pid", ARG_INT, &PCTL_LS_CONFIG.pid),
|
||||||
ARG_END(),
|
ARG_END(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -80,6 +85,10 @@ void pctl_ls(void) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PCTL_LS_CONFIG.pid != -1 && stat.pid != PCTL_LS_CONFIG.pid) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
string_memcpy(namebuf, stat.name, 30);
|
string_memcpy(namebuf, stat.name, 30);
|
||||||
namebuf[31] = namebuf[32] = namebuf[33] = '.';
|
namebuf[31] = namebuf[32] = namebuf[33] = '.';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user