diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2013-08-12 10:22:24 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-13 23:06:03 +0100 |
commit | 08aabd47b2d2f641066ee99530320226bc98b90f (patch) | |
tree | 81b37718726f9e3e2dea9f91ab87ec919e156d7a /meta/recipes-extended/procps/procps-3.2.8 | |
parent | 9bb0b1c28578128a861dccf053ed611cd1c4b8bb (diff) | |
download | poky-08aabd47b2d2f641066ee99530320226bc98b90f.tar.gz |
procps: Add cgroup support
(From OE-Core rev: 767383ac80bd52a51d52655f95bb503cd0bb827b)
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/procps/procps-3.2.8')
-rw-r--r-- | meta/recipes-extended/procps/procps-3.2.8/procps-3.2.8-ps-cgroup.patch | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/meta/recipes-extended/procps/procps-3.2.8/procps-3.2.8-ps-cgroup.patch b/meta/recipes-extended/procps/procps-3.2.8/procps-3.2.8-ps-cgroup.patch new file mode 100644 index 0000000000..1a294142f5 --- /dev/null +++ b/meta/recipes-extended/procps/procps-3.2.8/procps-3.2.8-ps-cgroup.patch | |||
@@ -0,0 +1,82 @@ | |||
1 | From e529ce0b53f6b73d8b760cd37b23e0397720cede Mon Sep 17 00:00:00 2001 | ||
2 | From: Daniel Novotny <dnovotny@fedoraproject.org> | ||
3 | Date: Mon, 16 Feb 2009 12:22:20 +0000 | ||
4 | Subject: add cgroup support | ||
5 | |||
6 | Rebased for 3.2.8: Andrei Gherzan <andrei.gherzan@windriver.com> | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | |||
10 | The patch was imported from the meta-ivi repository | ||
11 | (git://git.yoctoproject.org/meta-ivi) as of commit id | ||
12 | 74b9624fe94b2b90810717a13d481b0db9d2d95a | ||
13 | |||
14 | Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> | ||
15 | |||
16 | Index: procps-3.2.8/ps/output.c | ||
17 | =================================================================== | ||
18 | --- procps-3.2.8.orig/ps/output.c 2012-11-15 17:44:05.501337741 +0200 | ||
19 | +++ procps-3.2.8/ps/output.c 2012-11-15 17:48:31.585328231 +0200 | ||
20 | @@ -1099,6 +1099,39 @@ | ||
21 | return snprintf(outbuf, COLWID, "*"); | ||
22 | } | ||
23 | |||
24 | +static int pr_cgroup(char *restrict const outbuf, const proc_t *restrict const pp){ | ||
25 | + char filename[48]; | ||
26 | + FILE *fd; | ||
27 | + int counter = 0; | ||
28 | + int c; | ||
29 | + int is_cgroup = 0; | ||
30 | + | ||
31 | + outbuf[0]='\0'; | ||
32 | + snprintf(filename, sizeof filename, "/proc/%d/cgroup", pp->tgid); | ||
33 | + fd = fopen(filename, "r"); | ||
34 | + if (likely(fd == NULL)) goto fail; | ||
35 | + while (( (c = fgetc(fd)) != EOF) && (counter<665)) { | ||
36 | + if (is_cgroup == 0) { | ||
37 | + if (c == ':') { | ||
38 | + is_cgroup = 1; | ||
39 | + if (counter>0) | ||
40 | + outbuf[counter++]=';'; | ||
41 | + } | ||
42 | + }else | ||
43 | + if ((c == '\n') || (c == '\0')) | ||
44 | + is_cgroup = 0; | ||
45 | + else | ||
46 | + outbuf[counter++]=c; | ||
47 | + } | ||
48 | + outbuf[counter]='\0'; | ||
49 | + close(fd); | ||
50 | + if (counter>0) | ||
51 | + return counter; | ||
52 | +fail: | ||
53 | + outbuf[0] = '-'; | ||
54 | + outbuf[1] = '\0'; | ||
55 | + return 1; | ||
56 | +} | ||
57 | |||
58 | /****************** FLASK & seLinux security stuff **********************/ | ||
59 | // move the bulk of this to libproc sometime | ||
60 | @@ -1293,6 +1326,7 @@ | ||
61 | {"bsdtime", "TIME", pr_bsdtime, sr_nop, 6, 0, LNX, ET|RIGHT}, | ||
62 | {"c", "C", pr_c, sr_pcpu, 2, 0, SUN, ET|RIGHT}, | ||
63 | {"caught", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigcatch*/ | ||
64 | +{"cgroup", "CGROUP", pr_cgroup, sr_nop, 35, 0, LNX, PO|LEFT}, /* cgroups*/ | ||
65 | {"class", "CLS", pr_class, sr_sched, 3, 0, XXX, TO|LEFT}, | ||
66 | {"cls", "CLS", pr_class, sr_sched, 3, 0, HPU, TO|RIGHT}, /*says HPUX or RT*/ | ||
67 | {"cmaj_flt", "-", pr_nop, sr_cmaj_flt, 1, 0, LNX, AN|RIGHT}, | ||
68 | Index: procps-3.2.8/ps/ps.1 | ||
69 | =================================================================== | ||
70 | --- procps-3.2.8.orig/ps/ps.1 2012-11-15 17:44:50.845336117 +0200 | ||
71 | +++ procps-3.2.8/ps/ps.1 2012-11-15 17:49:09.621326859 +0200 | ||
72 | @@ -904,6 +904,10 @@ | ||
73 | displayed. (alias\ \fBsig_catch\fR,\ \fBsigcatch\fR). | ||
74 | T} | ||
75 | |||
76 | +cgroup CGROUP T{ | ||
77 | +display control groups to which the process belonges. | ||
78 | +t} | ||
79 | + | ||
80 | class CLS T{ | ||
81 | scheduling class of the process. (alias\ \fBpolicy\fR,\ \fBcls\fR). | ||
82 | Field's possible values are: | ||