From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1NOfCq-0007CM-Dh for garchives@archives.gentoo.org; Sat, 26 Dec 2009 22:33:52 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 530BAE05A4; Sat, 26 Dec 2009 22:33:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 2F199E05A4 for ; Sat, 26 Dec 2009 22:33:49 +0000 (UTC) Received: from stork.gentoo.org (stork.gentoo.org [64.127.104.133]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id BC18267DDC for ; Sat, 26 Dec 2009 22:33:48 +0000 (UTC) Received: from solar by stork.gentoo.org with local (Exim 4.69) (envelope-from ) id 1NOfCm-0007JB-0p for gentoo-commits@lists.gentoo.org; Sat, 26 Dec 2009 22:33:48 +0000 From: "Ned Ludd (solar)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, solar@gentoo.org Subject: [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c X-VCS-Repository: gentoo-projects X-VCS-Files: qlop.c X-VCS-Directories: portage-utils X-VCS-Committer: solar X-VCS-Committer-Name: Ned Ludd Content-Type: text/plain; charset=utf8 Message-Id: Sender: Ned Ludd Date: Sat, 26 Dec 2009 22:33:48 +0000 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: b73f6039-80e3-490e-873f-884c84b47f58 X-Archives-Hash: 8d27460308d44daa89dfd89462fab221 solar 09/12/26 22:33:48 Modified: qlop.c Log: - make qlop print the root path for linux hosts as best as it can figur= e out. useful when you have lots of chroots building Revision Changes Path 1.47 portage-utils/qlop.c file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils= /qlop.c?rev=3D1.47&view=3Dmarkup plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils= /qlop.c?rev=3D1.47&content-type=3Dtext/plain diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils= /qlop.c?r1=3D1.46&r2=3D1.47 Index: qlop.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- qlop.c 5 Dec 2009 10:01:07 -0000 1.46 +++ qlop.c 26 Dec 2009 22:33:47 -0000 1.47 @@ -1,7 +1,7 @@ /* * Copyright 2005-2007 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.46 200= 9/12/05 10:01:07 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.47 200= 9/12/26 22:33:47 solar Exp $ * * Copyright 2005-2007 Ned Ludd - * Copyright 2005-2007 Mike Frysinger - @@ -52,7 +52,7 @@ "Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE, COMMON_OPTS_HELP }; -static const char qlop_rcsid[] =3D "$Id: qlop.c,v 1.46 2009/12/05 10:01:= 07 vapier Exp $"; +static const char qlop_rcsid[] =3D "$Id: qlop.c,v 1.47 2009/12/26 22:33:= 47 solar Exp $"; #define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts= _help, lookup_applet_idx("qlop")) =20 #define QLOP_LIST 0x01 @@ -323,6 +323,16 @@ if (!hz) hz =3D 100; } + +static char *root_readlink(const int pid) { + static char path[_Q_PATH_MAX]; + char buf[_Q_PATH_MAX]; + memset(&path, 0, sizeof(path)); + snprintf(buf, sizeof(buf), "/proc/%d/root", pid); + readlink(buf, path, sizeof(path)); + return (char *) path; +} + void show_current_emerge(void) { DIR *proc; @@ -392,6 +402,9 @@ GREEN, chop_ctime(start_date), NORM); print_seconds_for_earthlings(uptime_secs - (start_time / hz)); puts(NORM); + p =3D NULL; + if ((p =3D root_readlink(pid)) !=3D NULL) + printf(" root: %s%s%s\n", GREEN, p, NORM); } } =20