From 069c858829180f5a462d5a6b57061ddefc4c54f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Canek=20Pel=C3=A1ez=20Vald=C3=A9s?= Date: Sat, 4 Dec 2010 12:56:39 -0600 Subject: [PATCH] Procps ebuild with cgroups use flag to output cgroups information. Patches originally from Fedora. --- sys-process/procps/Manifest | 13 +++ sys-process/procps/files/3.2.5-top-sort.patch | 39 ++++++++ sys-process/procps/files/procps-3.2.3-noproc.patch | 22 +++++ ...-3.2.6-mips-n32_isnt_usable_on_mips64_yet.patch | 11 +++ .../procps/files/procps-3.2.7-proc-mount.patch | 18 ++++ .../procps/files/procps-3.2.7-ps-cgroup.patch | 65 ++++++++++++++ .../procps/files/procps-3.2.8+gmake-3.82.patch | 15 +++ .../procps/files/procps-3.2.8-forest-prefix.patch | 38 ++++++++ .../procps/files/procps-3.2.8-linux-ver-init.patch | 23 +++++ ...rocps-3.2.8-ps-cgroup-suppress-root-group.patch | 36 ++++++++ .../procps/files/procps-3.2.8-toprc-fixup.patch | 16 ++++ .../procps/files/procps-mips-define-pagesize.patch | 29 ++++++ sys-process/procps/procps-3.2.8-r2.ebuild | 93 ++++++++++++++++++++ 13 files changed, 418 insertions(+), 0 deletions(-) create mode 100644 sys-process/procps/Manifest create mode 100644 sys-process/procps/files/3.2.5-top-sort.patch create mode 100644 sys-process/procps/files/procps-3.2.3-noproc.patch create mode 100644 sys-process/procps/files/procps-3.2.6-mips-n32_isnt_usable_on_mips64_yet.patch create mode 100644 sys-process/procps/files/procps-3.2.7-proc-mount.patch create mode 100644 sys-process/procps/files/procps-3.2.7-ps-cgroup.patch create mode 100644 sys-process/procps/files/procps-3.2.8+gmake-3.82.patch create mode 100644 sys-process/procps/files/procps-3.2.8-forest-prefix.patch create mode 100644 sys-process/procps/files/procps-3.2.8-linux-ver-init.patch create mode 100644 sys-process/procps/files/procps-3.2.8-ps-cgroup-suppress-root-group.patch create mode 100644 sys-process/procps/files/procps-3.2.8-toprc-fixup.patch create mode 100644 sys-process/procps/files/procps-mips-define-pagesize.patch create mode 100644 sys-process/procps/procps-3.2.8-r2.ebuild diff --git a/sys-process/procps/Manifest b/sys-process/procps/Manifest new file mode 100644 index 0000000..ff4605e --- /dev/null +++ b/sys-process/procps/Manifest @@ -0,0 +1,13 @@ +AUX 3.2.5-top-sort.patch 1384 RMD160 7ab964b4dd310d5032826abe64a46b8b6e968a80 SHA1 ad7782f3f4d118fa67c667d611a1eb2f4c736808 SHA256 bd52bdde8f43e9f1428d18efa13691abd83a25ea2f99d8c44fabccd7f2ba902b +AUX procps-3.2.3-noproc.patch 911 RMD160 0c6714c16424a31cde28f8e667f05a46e71402d1 SHA1 6cc1c4fc8f7e39347619f4c9f1432dfc6d0164a1 SHA256 e3897fe3e8df43750f514e8fc84a82f5e00c0bc2245bbd21ad2d8ff9789087f1 +AUX procps-3.2.6-mips-n32_isnt_usable_on_mips64_yet.patch 380 RMD160 1f0796a5e1745d32ac12786e712823ae0359c986 SHA1 145e81079f980913327f3a2680e87d1ebba87f4f SHA256 7fa2c0891f8c96072e0cd6578228b122ca69602e89416e7a73c370895d93a267 +AUX procps-3.2.7-proc-mount.patch 657 RMD160 90d0dae26d4a514ef0dbcb3c90ba167d0890d14e SHA1 07bdfb5484189daad7beb18fd5e2f280e3de3cad SHA256 17194621e6f5307c1712fab15a13a7da0e10315cf8b45b34403b54c70013b2ba +AUX procps-3.2.7-ps-cgroup.patch 2271 RMD160 5c26d1e318801f74a60a5ec29d6982073d6b593d SHA1 0d81f7e530a0aa556afbca1d66bc4134abba4eb3 SHA256 aa3485d50a405d83cbad547398b5af83e7471591885e36347760cfa0e7375f4f +AUX procps-3.2.8+gmake-3.82.patch 366 RMD160 8de2f12ffcf2dee2b1074ab16f37c8b664e8d268 SHA1 c1f5e83507dbcbfaf3328accdb9cf9b2d3fe4c1b SHA256 8b74a3ee39ab8535a414931f86b85320a38ef3dc39d65c75ed51fa6d7c041cdb +AUX procps-3.2.8-forest-prefix.patch 1129 RMD160 b3f7d39cfab5fcf7bc4740a392d9471be1a54c7a SHA1 7974f857634698650953d40a38ed9cdbcaad613b SHA256 4773f42d2c9bd2dafe14431b2b1e41d79bfbf9b567b4003b2a383ed6c65cd930 +AUX procps-3.2.8-linux-ver-init.patch 823 RMD160 e029ee04df0be7ca11878c3bb4e3c544602dc329 SHA1 171d5352940200c209e0c2d43c17f01c02173a66 SHA256 48da9b481af5cbf1beb11f1828c8142b3b77d62c387d8af79e8b0de2c36e6aa8 +AUX procps-3.2.8-ps-cgroup-suppress-root-group.patch 1039 RMD160 bade52a4a6277b48634aed0432d83b59033d6558 SHA1 e9970d940f99b10a721422d5f166a0afe8ff797f SHA256 222fe32aeac89de50f57701e0303043435e73b13103d6ba13e121a19970c71c5 +AUX procps-3.2.8-toprc-fixup.patch 647 RMD160 68ced4f43bcf86f61f4e66baecd60832fbcd8693 SHA1 e81c7dd3f836078bcb9b1d25ef2a161a48c5dce4 SHA256 da07ed67e5d1405ca673075459070f2fee985692ff930124ed484dacfe4db588 +AUX procps-mips-define-pagesize.patch 1028 RMD160 aa0cb4fdf76d50bae983683e0de0a06daba52361 SHA1 7658c35e40c4c565bd4f4124b09c43ec474da0bd SHA256 9000966beaa7ae9e8261dfc691b7b7bec08857e8404de60f30b10bbe6e702d8e +DIST procps-3.2.8.tar.gz 285758 RMD160 ad63601fb6bf4692108484d9ed362f510cbcf505 SHA1 a0c86790569dec26b5d9037e8868ca907acc9829 SHA256 11ed68d8a4433b91cd833deb714a3aa849c02aea738c42e6b4557982419c1535 +EBUILD procps-3.2.8-r2.ebuild 2854 RMD160 447025a69e34f6c23ea527f1d049c5bb4a5bd329 SHA1 d9b3cd27810aad6e15e71c20854d6a65d5c1924b SHA256 ef41f4a04d7c0566df0e421255fc681289bcef3aa44fceb37f3bc9ea0438cc0e diff --git a/sys-process/procps/files/3.2.5-top-sort.patch b/sys-process/procps/files/3.2.5-top-sort.patch new file mode 100644 index 0000000..b160bcc --- /dev/null +++ b/sys-process/procps/files/3.2.5-top-sort.patch @@ -0,0 +1,39 @@ +Under certain conditions, top's display can break. +This patch is by Curtis Doty, updated by Andreas Kling for 3.2.5. + +To reproduce bug: + - run top + - turn on color mode ('z') + - highlight sort column ('x') + - move sort column all the way to the left ('<') + - get drunk + +procps e-mail: http://sourceforge.net/mailarchive/forum.php?thread_id=6042978&forum_id=12454 +Redhat bug: http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=140975 +Gentoo bug: http://bugs.gentoo.org/show_bug.cgi?id=80296 + +--- procps-3.2.5/top.c~ 2005-01-26 06:15:18.000000000 +0100 ++++ procps-3.2.5/top.c 2005-02-01 09:23:35.000000000 +0100 +@@ -2952,12 +2952,10 @@ + for (x = 0; x < q->maxpflgs; x++) { + char cbuf[ROWBUFSIZ], _z[ROWBUFSIZ]; + FLG_t i = q->procflags[x]; // support for our field/column +- const char *f = Fieldstab[i].fmts; // macro AND sometimes the fmt ++ const char *f = Fieldstab[i].fmts + ((x==0) && !Rc.mode_altscr); + unsigned s = Fieldstab[i].scale; // string must be altered ! + unsigned w = Fieldstab[i].width; + +- int advance = (x==0) && !Rc.mode_altscr; +- + switch (i) { + case P_CMD: + { char tmp[ROWBUFSIZ]; +@@ -3069,7 +3067,7 @@ + + } /* end: switch 'procflag' */ + +- rp = scat(rp, cbuf+advance); ++ rp = scat(rp, cbuf); + } /* end: for 'maxpflgs' */ + + PUFF( diff --git a/sys-process/procps/files/procps-3.2.3-noproc.patch b/sys-process/procps/files/procps-3.2.3-noproc.patch new file mode 100644 index 0000000..f581cf4 --- /dev/null +++ b/sys-process/procps/files/procps-3.2.3-noproc.patch @@ -0,0 +1,22 @@ +Ripped from Fedora + +If /proc isnt mounted, `top` will cause screen corruption ... + +--- procps-3.2.3/top.c ++++ procps-3.2.3/top.c +@@ -3201,12 +3201,15 @@ + + int main (int dont_care_argc, char *argv[]) + { ++ struct stat isproc; + (void)dont_care_argc; + before(*argv); + // +-------------+ + windows_stage1(); // top (sic) slice + configs_read(); // > spread etc, < + parse_args(&argv[1]); // > lean stuff, < ++ if (stat("/proc/self", &isproc)==-1) ++ std_err("/proc is not mounted, required for output data"); + whack_terminal(); // > onions etc. < + windows_stage2(); // as bottom slice + // +-------------+ diff --git a/sys-process/procps/files/procps-3.2.6-mips-n32_isnt_usable_on_mips64_yet.patch b/sys-process/procps/files/procps-3.2.6-mips-n32_isnt_usable_on_mips64_yet.patch new file mode 100644 index 0000000..25e0f1b --- /dev/null +++ b/sys-process/procps/files/procps-3.2.6-mips-n32_isnt_usable_on_mips64_yet.patch @@ -0,0 +1,11 @@ +--- proc/procps.h.orig 2005-12-21 19:12:11.000000000 -0500 ++++ proc/procps.h 2005-12-21 19:12:17.000000000 -0500 +@@ -31,7 +31,7 @@ + // + // Unknown: PA-RISC and zSeries + // +-#if defined(k64test) || (defined(_ABIN32) && _MIPS_SIM == _ABIN32) ++#if defined(k64test) + #define KLONG long long // not typedef; want "unsigned KLONG" to work + #define KLF "L" + #define STRTOUKL strtoull diff --git a/sys-process/procps/files/procps-3.2.7-proc-mount.patch b/sys-process/procps/files/procps-3.2.7-proc-mount.patch new file mode 100644 index 0000000..386dada --- /dev/null +++ b/sys-process/procps/files/procps-3.2.7-proc-mount.patch @@ -0,0 +1,18 @@ +Slightly prettier error message + +--- proc/readproc.c ++++ proc/readproc.c +@@ -907,3 +907,3 @@ + if(file2str("/proc/self", "stat", sbuf, sizeof sbuf) == -1){ +- fprintf(stderr, "Error, do this: mount -t proc none /proc\n"); ++ fprintf(stderr, "Error, do this: mount -t proc proc /proc\n"); + _exit(47); +--- proc/sysinfo.c ++++ proc/sysinfo.c +@@ -31,4 +31,4 @@ + " To mount /proc at boot you need an /etc/fstab line like:\n" \ +-" /proc /proc proc defaults\n" \ +-" In the meantime, run \"mount /proc /proc -t proc\"\n" ++" proc /proc proc defaults\n" \ ++" In the meantime, run \"mount proc /proc -t proc\"\n" + diff --git a/sys-process/procps/files/procps-3.2.7-ps-cgroup.patch b/sys-process/procps/files/procps-3.2.7-ps-cgroup.patch new file mode 100644 index 0000000..de5c6b2 --- /dev/null +++ b/sys-process/procps/files/procps-3.2.7-ps-cgroup.patch @@ -0,0 +1,65 @@ +diff -burN procps-3.2.8/ps/output.c procps-3.2.8.cgroups/ps/output.c +--- procps-3.2.8/ps/output.c 2009-05-10 14:24:50.000000000 -0500 ++++ procps-3.2.8.cgroups/ps/output.c 2010-12-04 12:35:56.000000000 -0600 +@@ -1099,6 +1099,39 @@ + return snprintf(outbuf, COLWID, "*"); + } + ++static int pr_cgroup(char *restrict const outbuf, const proc_t *restrict const pp){ ++ char filename[48]; ++ FILE *fd; ++ int counter = 0; ++ int c; ++ int is_cgroup = 0; ++ ++ outbuf[0]='\0'; ++ snprintf(filename, sizeof filename, "/proc/%d/cgroup", pp->tgid); ++ fd = fopen(filename, "r"); ++ if (likely(fd == NULL)) goto fail; ++ while (( (c = fgetc(fd)) != EOF) && (counter<665)) { ++ if (is_cgroup == 0) { ++ if (c == ':') { ++ is_cgroup = 1; ++ if (counter>0) ++ outbuf[counter++]=';'; ++ } ++ }else ++ if ((c == '\n') || (c == '\0')) ++ is_cgroup = 0; ++ else ++ outbuf[counter++]=c; ++ } ++ outbuf[counter]='\0'; ++ close(fd); ++ if (counter>0) ++ return counter; ++fail: ++ outbuf[0] = '-'; ++ outbuf[1] = '\0'; ++ return 1; ++} + + /****************** FLASK & seLinux security stuff **********************/ + // move the bulk of this to libproc sometime +@@ -1293,6 +1326,7 @@ + {"bsdtime", "TIME", pr_bsdtime, sr_nop, 6, 0, LNX, ET|RIGHT}, + {"c", "C", pr_c, sr_pcpu, 2, 0, SUN, ET|RIGHT}, + {"caught", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigcatch*/ ++{"cgroup", "CGROUP", pr_cgroup, sr_nop, 35, 0, LNX, PO|LEFT}, /* cgroups*/ + {"class", "CLS", pr_class, sr_sched, 3, 0, XXX, TO|LEFT}, + {"cls", "CLS", pr_class, sr_sched, 3, 0, HPU, TO|RIGHT}, /*says HPUX or RT*/ + {"cmaj_flt", "-", pr_nop, sr_cmaj_flt, 1, 0, LNX, AN|RIGHT}, +diff -burN procps-3.2.8/ps/ps.1 procps-3.2.8.cgroups/ps/ps.1 +--- procps-3.2.8/ps/ps.1 2009-05-10 14:38:17.000000000 -0500 ++++ procps-3.2.8.cgroups/ps/ps.1 2010-12-04 12:43:12.000000000 -0600 +@@ -904,6 +904,10 @@ + displayed. (alias\ \fBsig_catch\fR,\ \fBsigcatch\fR). + T} + ++cgroup CGROUP T{ ++display control groups to which the process belongs. ++T} ++ + class CLS T{ + scheduling class of the process. (alias\ \fBpolicy\fR,\ \fBcls\fR). + Field's possible values are: diff --git a/sys-process/procps/files/procps-3.2.8+gmake-3.82.patch b/sys-process/procps/files/procps-3.2.8+gmake-3.82.patch new file mode 100644 index 0000000..b66945c --- /dev/null +++ b/sys-process/procps/files/procps-3.2.8+gmake-3.82.patch @@ -0,0 +1,15 @@ +ps/module.mk depends on vars set up in proc/module.mk, so make sure we always +include the .mk files in the right order + +--- procps-3.2.8/Makefile ++++ procps-3.2.8/Makefile +@@ -174,7 +174,8 @@ + # want this rule first, use := on ALL, and ALL not filled in yet + all: do_all + +--include */module.mk ++-include proc/module.mk ++-include ps/module.mk + + do_all: $(ALL) + diff --git a/sys-process/procps/files/procps-3.2.8-forest-prefix.patch b/sys-process/procps/files/procps-3.2.8-forest-prefix.patch new file mode 100644 index 0000000..915be67 --- /dev/null +++ b/sys-process/procps/files/procps-3.2.8-forest-prefix.patch @@ -0,0 +1,38 @@ +avoid gcc warnings like: + +ps/output.c:341:6: warning: the address of ‘forest_prefix’ will always evaluate as ‘true’ + +Index: ps/output.c +=================================================================== +RCS file: /cvsroot/procps/procps/ps/output.c,v +retrieving revision 1.63 +diff -u -p -r1.63 output.c +--- ps/output.c 3 May 2009 06:39:33 -0000 1.63 ++++ ps/output.c 14 Nov 2010 00:24:56 -0000 +@@ -338,7 +338,7 @@ static int pr_args(char *restrict const + unsigned flags; + int rightward=max_rightward; + +- if(forest_prefix){ ++ if(/*forest_prefix*/1){ + int fh = forest_helper(outbuf); + endp += fh; + rightward -= fh; +@@ -365,7 +365,7 @@ static int pr_comm(char *restrict const + unsigned flags; + int rightward=max_rightward; + +- if(forest_prefix){ ++ if(/*forest_prefix*/1){ + int fh = forest_helper(outbuf); + endp += fh; + rightward -= fh; +@@ -390,7 +390,7 @@ static int pr_fname(char *restrict const + char *endp = outbuf; + int rightward = max_rightward; + +- if(forest_prefix){ ++ if(/*forest_prefix*/1){ + int fh = forest_helper(outbuf); + endp += fh; + rightward -= fh; diff --git a/sys-process/procps/files/procps-3.2.8-linux-ver-init.patch b/sys-process/procps/files/procps-3.2.8-linux-ver-init.patch new file mode 100644 index 0000000..6d4039c --- /dev/null +++ b/sys-process/procps/files/procps-3.2.8-linux-ver-init.patch @@ -0,0 +1,23 @@ +https://bugs.gentoo.org/303120 + +make sure the linux version constructor runs before the libproc constructor +since the latter uses variables setup by the former + +fix by Chris Coleman + +Index: proc/version.c +=================================================================== +RCS file: /cvsroot/procps/procps/proc/version.c,v +retrieving revision 1.7 +diff -u -p -r1.7 version.c +--- proc/version.c 9 Feb 2003 07:27:16 -0000 1.7 ++++ proc/version.c 14 Nov 2010 00:22:44 -0000 +@@ -33,7 +33,7 @@ void display_version(void) { + + int linux_version_code; + +-static void init_Linux_version(void) __attribute__((constructor)); ++static void init_Linux_version(void) __attribute__((constructor(100))); + static void init_Linux_version(void) { + static struct utsname uts; + int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */ diff --git a/sys-process/procps/files/procps-3.2.8-ps-cgroup-suppress-root-group.patch b/sys-process/procps/files/procps-3.2.8-ps-cgroup-suppress-root-group.patch new file mode 100644 index 0000000..4b192c1 --- /dev/null +++ b/sys-process/procps/files/procps-3.2.8-ps-cgroup-suppress-root-group.patch @@ -0,0 +1,36 @@ +--- procps-3.2.8/ps/output.c 2010-05-18 06:00:18.000000000 +0200 ++++ procps-3.2.8.lennart/ps/output.c 2010-05-18 05:59:46.000000000 +0200 +@@ -1109,7 +1109,7 @@ + static int pr_cgroup(char *restrict const outbuf, const proc_t *restrict const pp){ + char filename[48]; + FILE *fd; +- int counter = 0; ++ int counter = 0, last_begin = 0, slash = 0; + int c; + int is_cgroup = 0; + +@@ -1121,15 +1121,22 @@ + if (is_cgroup == 0) { + if (c == ':') { + is_cgroup = 1; ++ slash = 0; + if (counter>0) + outbuf[counter++]=';'; + } + }else +- if ((c == '\n') || (c == '\0')) +- is_cgroup = 0; ++ if ((c == '\n') || (c == '\0')){ ++ if (slash) /* if the last char was a / this process is in the root cgroup which we should suppress */ ++ counter = last_begin; + else ++ last_begin = counter; ++ is_cgroup = 0; ++ } else { ++ slash = c == '/'; + outbuf[counter++]=c; + } ++ } + outbuf[counter]='\0'; + close(fd); + if (counter>0) diff --git a/sys-process/procps/files/procps-3.2.8-toprc-fixup.patch b/sys-process/procps/files/procps-3.2.8-toprc-fixup.patch new file mode 100644 index 0000000..24890b0 --- /dev/null +++ b/sys-process/procps/files/procps-3.2.8-toprc-fixup.patch @@ -0,0 +1,16 @@ +X-Gentoo-Bug: 279819 +Upstream-Patch: http://procps.cvs.sourceforge.net/viewvc/procps/procps/top.c?r1=1.132&r2=1.134 +--- top.c 2008/03/24 04:41:26 1.132 ++++ top.c 2009/12/10 11:37:48 1.134 +@@ -2190,7 +2190,10 @@ + // Value a window's name and make the associated group name. + static void win_names (WIN_t *q, const char *name) + { +- sprintf(q->rc.winname, "%.*s", WINNAMSIZ -1, name); ++ // Note that src==dst is illegal in sprintf. ++ // Failure: amd64, glibc 2.9-20081201, gcc 4.3.4 ++ if(q->rc.winname != name) ++ sprintf(q->rc.winname, "%.*s", WINNAMSIZ -1, name); + sprintf(q->grpname, "%d:%.*s", q->winnum, WINNAMSIZ -1, name); + } + diff --git a/sys-process/procps/files/procps-mips-define-pagesize.patch b/sys-process/procps/files/procps-mips-define-pagesize.patch new file mode 100644 index 0000000..3802f4c --- /dev/null +++ b/sys-process/procps/files/procps-mips-define-pagesize.patch @@ -0,0 +1,29 @@ +diff -Naurp procps-3.2.3.orig/minimal.c procps-3.2.3/minimal.c +--- procps-3.2.3.orig/minimal.c 2004-05-04 20:26:14.000000000 -0400 ++++ procps-3.2.3/minimal.c 2004-08-20 02:01:35.868100752 -0400 +@@ -68,8 +68,8 @@ + /////////////////////////////////////////////////////////// + + #ifndef PAGE_SIZE +-#warning PAGE_SIZE not defined, assuming it is 4096 +-#define PAGE_SIZE 4096 ++#warning PAGE_SIZE not defined, using sysconf() to determine correct value ++#define PAGE_SIZE (sysconf(_SC_PAGESIZE)) + #endif + + +diff -Naurp procps-3.2.3.orig/ps/common.h procps-3.2.3/ps/common.h +--- procps-3.2.3.orig/ps/common.h 2004-04-25 17:03:18.000000000 -0400 ++++ procps-3.2.3/ps/common.h 2004-08-20 02:00:59.228670792 -0400 +@@ -16,6 +16,11 @@ + #include "../proc/readproc.h" + #include /* looks safe for glibc, we need PAGE_SIZE */ + ++#ifndef PAGE_SIZE ++#warning PAGE_SIZE not defined, using sysconf() to determine correct value ++#define PAGE_SIZE (sysconf(_SC_PAGESIZE)) ++#endif ++ + #if 0 + #define trace(args...) printf(## args) + #else diff --git a/sys-process/procps/procps-3.2.8-r2.ebuild b/sys-process/procps/procps-3.2.8-r2.ebuild new file mode 100644 index 0000000..aa00168 --- /dev/null +++ b/sys-process/procps/procps-3.2.8-r2.ebuild @@ -0,0 +1,93 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-process/procps/procps-3.2.8-r2.ebuild,v 1.1 2010/11/21 20:16:28 vapier Exp $ + +inherit flag-o-matic eutils toolchain-funcs multilib + +DESCRIPTION="Standard informational utilities and process-handling tools" +HOMEPAGE="http://procps.sourceforge.net/" +SRC_URI="http://procps.sourceforge.net/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="n32 unicode cgroups" + +RDEPEND=">=sys-libs/ncurses-5.2-r2" + +src_unpack() { + unpack ${A} + cd "${S}" + + if use cgroups ; then + epatch "${FILESDIR}"/${PN}-3.2.7-ps-cgroup.patch + epatch "${FILESDIR}"/${PN}-3.2.8-ps-cgroup-suppress-root-group.patch + fi + + epatch "${FILESDIR}"/3.2.5-top-sort.patch + epatch "${FILESDIR}"/procps-3.2.7-proc-mount.patch + epatch "${FILESDIR}"/procps-3.2.3-noproc.patch + epatch "${FILESDIR}"/procps-3.2.8-toprc-fixup.patch + epatch "${FILESDIR}"/procps-3.2.8+gmake-3.82.patch + epatch "${FILESDIR}"/procps-3.2.8-linux-ver-init.patch #303120 + epatch "${FILESDIR}"/procps-3.2.8-forest-prefix.patch + + # Clean up the makefile + # - we do stripping ourselves + # - punt fugly gcc flags + sed -i \ + -e '/install/s: --strip : :' \ + -e '/ALL_CFLAGS += $(call check_gcc,-fweb,)/d' \ + -e '/ALL_CFLAGS += $(call check_gcc,-Wstrict-aliasing=2,)/s,=2,,' \ + -e "/^lib64/s:=.*:=$(get_libdir):" \ + -e 's:-m64::g' \ + Makefile || die "sed Makefile" + + # mips 2.4.23 headers (and 2.6.x) don't allow PAGE_SIZE to be defined in + # userspace anymore, so this patch instructs procps to get the + # value from sysconf(). + epatch "${FILESDIR}"/${PN}-mips-define-pagesize.patch + + # lame unicode stuff checks glibc defines + sed -i "s:__GNU_LIBRARY__ >= 6:0 == $(use unicode; echo $?):" proc/escape.c || die + + # n32 isn't completly reliable of an ABI on mips64 at the current + # time. Eventually, it will be, but for now, we need to make sure + # procps doesn't try to force it on us. + if ! use n32 ; then + epatch "${FILESDIR}"/${PN}-3.2.6-mips-n32_isnt_usable_on_mips64_yet.patch + fi +} + +src_compile() { + replace-flags -O3 -O2 + emake \ + CC="$(tc-getCC)" \ + CPPFLAGS="${CPPFLAGS}" \ + CFLAGS="${CFLAGS}" \ + LDFLAGS="${LDFLAGS}" \ + || die "make failed" +} + +src_install() { + emake \ + ln_f="ln -sf" \ + ldconfig="true" \ + DESTDIR="${D}" \ + install \ + || die "install failed" + + insinto /usr/include/proc + doins proc/*.h || die "doins include" + + dodoc sysctl.conf BUGS NEWS TODO ps/HACKING + + # compat symlink so people who shouldnt be using libproc can #170077 + dosym libproc-${PV}.so /$(get_libdir)/libproc.so +} + +pkg_postinst() { + einfo "NOTE: With NPTL \"ps\" and \"top\" no longer" + einfo "show threads. You can use any of: -m m -L -T H" + einfo "in ps or the H key in top to show them" +} -- 1.7.2.2