procps: sync latest stable from upstream Gentoo

We're seeing some HZ warnings on ARM platforms due to a bug in the
internal procps init sequence.  This has already been fixed in the
upstream Gentoo ebuild, so pull down the latest stable from there.

BUG=chromium-os:20777
TEST=`emerge procps` works
TEST=`emerge-amd64-generic procps` works
TEST=`emerge-arm-generic procps` works
TEST=`emerge-x86-generic procps` works
TEST=`cbuildbot arm-generic-full` works
TEST=`cbuildbot x86-generic-full` works

Change-Id: If635416e7e28ede1b60cf8067aa4f77aabb4a4d8
Reviewed-on: https://gerrit.chromium.org/gerrit/12000
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2011-11-21 17:19:19 -05:00 committed by Gerrit
parent c8ba560e58
commit 2374aa31e0
6 changed files with 210 additions and 0 deletions

View File

@ -0,0 +1,15 @@
If /proc isnt mounted, `top` will cause screen corruption ...
--- procps-3.2.3/top.c
+++ procps-3.2.3/top.c
@@ -3201,6 +3201,10 @@
{
(void)dont_care_argc;
before(*argv);
+
+ if (access("/proc/stat", F_OK))
+ std_err("/proc is not mounted, required for output data");
+
// +-------------+
windows_stage1(); // top (sic) slice
configs_read(); // > spread etc, <

View File

@ -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"

View File

@ -0,0 +1,42 @@
avoid gcc warnings like:
ps/output.c:341:6: warning: the address of forest_prefix will always evaluate as true
--- a/ps/output.c
+++ b/ps/output.c
@@ -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;
@@ -405,7 +405,7 @@ static int pr_cgroup(char *restrict cons
if(pp->cgroup && *pp->cgroup) {
char *endp = outbuf;
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;

View File

@ -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);
}

View File

@ -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 <asm/page.h> /* 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

View File

@ -0,0 +1,90 @@
# Copyright 1999-2011 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_p11.ebuild,v 1.5 2011/11/13 21:09:29 maekke Exp $
EAPI="2"
inherit flag-o-matic eutils toolchain-funcs multilib
DEB_VER=${PV#*_p}
MY_PV=${PV%_p*}
MY_P="${PN}-${MY_PV}"
DESCRIPTION="Standard informational utilities and process-handling tools"
HOMEPAGE="http://procps.sourceforge.net/"
SRC_URI="http://procps.sourceforge.net/${MY_P}.tar.gz
mirror://debian/pool/main/p/procps/${PN}_${MY_PV}-${DEB_VER}.debian.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
IUSE="unicode"
RDEPEND=">=sys-libs/ncurses-5.2-r2[unicode?]"
S=${WORKDIR}/${MY_P}
src_prepare() {
local p d="${WORKDIR}"/debian/patches
pushd "${d}" >/dev/null
# makefile_dev_null: this bug is actually in gcc and is already fixed
for p in $(use unicode || echo watch_{unicode,ansi_colour}) makefile_dev_null ; do
rm ${p}.patch || die
sed -i "/^${p}/d" series || die
done
popd >/dev/null
EPATCH_SOURCE="${d}" \
epatch $(<"${d}"/series)
# fixup debian watch_exec_beep.patch
sed -i '1i#include <sys/wait.h>' watch.c || die
epatch "${FILESDIR}"/${PN}-3.2.7-proc-mount.patch
epatch "${FILESDIR}"/${PN}-3.2.3-noproc.patch
epatch "${FILESDIR}"/${PN}-3.2.8-toprc-fixup.patch
epatch "${FILESDIR}"/${PN}-3.2.8-r1-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
}
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
dodoc sysctl.conf BUGS NEWS TODO ps/HACKING
# compat symlink so people who shouldnt be using libproc can #170077
dosym libproc-${MY_PV}.so /$(get_libdir)/libproc.so || die
}