Updated ps to use new cgroup interface
This commit is contained in:
parent
57031319d6
commit
8621387c77
33
ps/output.c
33
ps/output.c
@ -359,39 +359,14 @@ static int pr_args(char *restrict const outbuf, const proc_t *restrict const pp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int pr_cgroup(char *restrict const outbuf,const proc_t *restrict const pp) {
|
static int pr_cgroup(char *restrict const outbuf,const proc_t *restrict const pp) {
|
||||||
char *endp = outbuf;
|
|
||||||
int rightward = max_rightward;
|
int rightward = max_rightward;
|
||||||
|
|
||||||
if(pp->cgroup) {
|
if(pp->cgroup && *pp->cgroup) {
|
||||||
char **pcgroup = pp->cgroup;
|
escape_str(outbuf, *pp->cgroup, OUTBUF_SIZE, &rightward);
|
||||||
|
return max_rightward-rightward;
|
||||||
while(*pcgroup != NULL) {
|
|
||||||
//Skip root cgroups
|
|
||||||
if(!**pcgroup || (*pcgroup)[strlen(*pcgroup)-1] == '/') {
|
|
||||||
pcgroup++;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Skip initial cgroup number
|
|
||||||
char *ccgroup = strchr(*pcgroup, ':');
|
|
||||||
if(ccgroup == NULL)
|
|
||||||
ccgroup = *pcgroup;
|
|
||||||
else
|
else
|
||||||
ccgroup++;
|
|
||||||
|
|
||||||
if(endp != outbuf)
|
|
||||||
endp += escape_str(endp, ";", OUTBUF_SIZE, &rightward);
|
|
||||||
|
|
||||||
endp += escape_str(endp, ccgroup, OUTBUF_SIZE, &rightward);
|
|
||||||
|
|
||||||
pcgroup++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(endp == outbuf)
|
|
||||||
return pr_nop(outbuf,pp);
|
return pr_nop(outbuf,pp);
|
||||||
|
|
||||||
return (int)(endp-outbuf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "ucomm" is the same thing: short unless -f */
|
/* "ucomm" is the same thing: short unless -f */
|
||||||
@ -1292,7 +1267,7 @@ static int pr_t_left2(char *restrict const outbuf, const proc_t *restrict const
|
|||||||
#define GRP PROC_FILLGRP /* gid_t -> group names */
|
#define GRP PROC_FILLGRP /* gid_t -> group names */
|
||||||
#define WCH PROC_FILLWCHAN /* do WCHAN lookup */
|
#define WCH PROC_FILLWCHAN /* do WCHAN lookup */
|
||||||
|
|
||||||
#define CGRP PROC_FILLCGROUP /* read cgroup */
|
#define CGRP PROC_FILLCGROUP | PROC_EDITCGRPCVT /* read cgroup */
|
||||||
/* TODO
|
/* TODO
|
||||||
* pull out annoying BSD aliases into another table (to macro table?)
|
* pull out annoying BSD aliases into another table (to macro table?)
|
||||||
* add sorting functions here (to unify names)
|
* add sorting functions here (to unify names)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user