diff options
author | Jan Görig <jgorig@redhat.com> | 2011-05-05 12:20:30 +0200 |
---|---|---|
committer | Jan Görig <jgorig@redhat.com> | 2011-05-05 12:20:30 +0200 |
commit | 8621387c774df2cac53090f59de6b109d1af9786 (patch) | |
tree | 94fe52dd76fff39f5c25cf86f75317e7b5438f53 /ps/output.c | |
parent | 57031319d6da55055b422a079f980cb1297d31ce (diff) | |
download | procps-ng-8621387c774df2cac53090f59de6b109d1af9786.tar.gz |
Updated ps to use new cgroup interface
Diffstat (limited to 'ps/output.c')
-rw-r--r-- | ps/output.c | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/ps/output.c b/ps/output.c index 8fbc488..e216914 100644 --- a/ps/output.c +++ b/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) { - char *endp = outbuf; int rightward = max_rightward; - if(pp->cgroup) { - char **pcgroup = pp->cgroup; - - 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 - ccgroup++; - - if(endp != outbuf) - endp += escape_str(endp, ";", OUTBUF_SIZE, &rightward); - - endp += escape_str(endp, ccgroup, OUTBUF_SIZE, &rightward); - - pcgroup++; - } + if(pp->cgroup && *pp->cgroup) { + escape_str(outbuf, *pp->cgroup, OUTBUF_SIZE, &rightward); + return max_rightward-rightward; } - - if(endp == outbuf) + else return pr_nop(outbuf,pp); - - return (int)(endp-outbuf); } /* "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 WCH PROC_FILLWCHAN /* do WCHAN lookup */ -#define CGRP PROC_FILLCGROUP /* read cgroup */ +#define CGRP PROC_FILLCGROUP | PROC_EDITCGRPCVT /* read cgroup */ /* TODO * pull out annoying BSD aliases into another table (to macro table?) * add sorting functions here (to unify names) |