source:
patches/procps-3.2.8-ps_cgroup-1.patch@
6518850
Last change on this file since 6518850 was de18e330, checked in by , 14 years ago | |
---|---|
|
|
File size: 3.0 KB |
-
ps/output.c
Submitted By: Joe Ciccone <jciccone@gmail.com> Date: 2011-01-30 Initial Package Version: 3.2.7 Origin: Fedora Git http://pkgs.fedoraproject.org/gitweb/?p=procps.git;a=blob_plain;f=procps-3.2.7-ps-cgroup.patch;h=b638c4f9a826040099f10e9282aad0d31ec5f03f;hb=HEAD http://pkgs.fedoraproject.org/gitweb/?p=procps.git;a=blob_plain;f=procps-3.2.8-ps-cgroup-suppress-root-group.patch;h=4b192c1fb4aa7684b7e57606713ca68690d77845;hb=HEAD Upstream Status: Unknown Description: Adds the ability for ps to output process(es) cgroups. diff -Naur procps-3.2.8.orig/ps/output.c procps-3.2.8/ps/output.c
old new 1099 1099 return snprintf(outbuf, COLWID, "*"); 1100 1100 } 1101 1101 1102 static int pr_cgroup(char *restrict const outbuf, const proc_t *restrict const pp){ 1103 char filename[48]; 1104 FILE *fd; 1105 int counter = 0, last_begin = 0, slash = 0; 1106 int c; 1107 int is_cgroup = 0; 1108 1109 outbuf[0]='\0'; 1110 snprintf(filename, sizeof filename, "/proc/%d/cgroup", pp->tgid); 1111 fd = fopen(filename, "r"); 1112 if (likely(fd == NULL)) goto fail; 1113 while (( (c = fgetc(fd)) != EOF) && (counter<665)) { 1114 if (is_cgroup == 0) { 1115 if (c == ':') { 1116 is_cgroup = 1; 1117 slash = 0; 1118 if (counter>0) 1119 outbuf[counter++]=';'; 1120 } 1121 }else 1122 if ((c == '\n') || (c == '\0')){ 1123 if (slash) /* if the last char was a / this process is in the root cgroup which we should suppress */ 1124 counter = last_begin; 1125 else 1126 last_begin = counter; 1127 is_cgroup = 0; 1128 } else { 1129 slash = c == '/'; 1130 outbuf[counter++]=c; 1131 } 1132 } 1133 outbuf[counter]='\0'; 1134 close(fd); 1135 if (counter>0) 1136 return counter; 1137 fail: 1138 outbuf[0] = '-'; 1139 outbuf[1] = '\0'; 1140 return 1; 1141 } 1102 1142 1103 1143 /****************** FLASK & seLinux security stuff **********************/ 1104 1144 // move the bulk of this to libproc sometime … … 1293 1333 {"bsdtime", "TIME", pr_bsdtime, sr_nop, 6, 0, LNX, ET|RIGHT}, 1294 1334 {"c", "C", pr_c, sr_pcpu, 2, 0, SUN, ET|RIGHT}, 1295 1335 {"caught", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigcatch*/ 1336 {"cgroup", "CGROUP", pr_cgroup, sr_nop, 35, 0, LNX, PO|LEFT}, /* cgroups*/ 1296 1337 {"class", "CLS", pr_class, sr_sched, 3, 0, XXX, TO|LEFT}, 1297 1338 {"cls", "CLS", pr_class, sr_sched, 3, 0, HPU, TO|RIGHT}, /*says HPUX or RT*/ 1298 1339 {"cmaj_flt", "-", pr_nop, sr_cmaj_flt, 1, 0, LNX, AN|RIGHT}, -
procps-3.2.8
diff -Naur procps-3.2.8.orig/ps/ps.1 procps-3.2.8/ps/ps.1
old new 904 904 displayed. (alias\ \fBsig_catch\fR,\ \fBsigcatch\fR). 905 905 T} 906 906 907 cgroup CGROUP T{ 908 display control groups to which the process belonges. 909 T} 910 907 911 class CLS T{ 908 912 scheduling class of the process. (alias\ \fBpolicy\fR,\ \fBcls\fR). 909 913 Field's possible values are:
Note:
See TracBrowser
for help on using the repository browser.