* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2009-03-15 9:57 Mike Frysinger (vapier)
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger (vapier) @ 2009-03-15 9:57 UTC (permalink / raw
To: gentoo-commits
vapier 09/03/15 09:57:31
Modified: qlop.c
Log:
discover HZ dynamically from elf notes on the stack #245393
Revision Changes Path
1.42 portage-utils/qlop.c
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.42&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.42&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?r1=1.41&r2=1.42
Index: qlop.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- qlop.c 24 May 2007 14:47:18 -0000 1.41
+++ qlop.c 15 Mar 2009 09:57:30 -0000 1.42
@@ -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.41 2007/05/24 14:47:18 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.42 2009/03/15 09:57:30 vapier Exp $
*
* Copyright 2005-2007 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2007 Mike Frysinger - <vapier@gentoo.org>
@@ -46,7 +46,7 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.41 2007/05/24 14:47:18 solar Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.42 2009/03/15 09:57:30 vapier Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
@@ -295,6 +295,27 @@
void show_current_emerge(void);
#ifdef __linux__
+#include <elf.h>
+static unsigned long hz = 0;
+static void init_hz(void)
+{
+#ifdef HZ
+ hz = HZ;
+#endif
+ /* kernel pushes elf notes onto stack */
+ unsigned long *elf_note = (unsigned long *)environ;
+ while (!*elf_note++)
+ continue;
+ while (elf_note[0]) {
+ if (elf_note[0] == AT_CLKTCK) {
+ hz = elf_note[1];
+ break;
+ }
+ elf_note += 2;
+ }
+ if (!hz)
+ hz = 100;
+}
void show_current_emerge(void)
{
DIR *proc;
@@ -312,6 +333,9 @@
return;
}
+ if (!hz)
+ init_hz();
+
while ((de = readdir(proc)) != NULL) {
if ((pid = (pid_t)atol(de->d_name)) == 0)
@@ -352,14 +376,14 @@
sscanf(bufstat, "%lf", &uptime_secs);
/* figure out when this thing started and then show it */
- start_date = time(0) - (uptime_secs - (start_time / HZ));
+ start_date = time(0) - (uptime_secs - (start_time / hz));
printf(
" %s*%s %s%s%s\n"
" started: %s%s%s\n"
" elapsed: ", /*%s%llu%s seconds\n",*/
BOLD, NORM, BLUE, p, NORM,
GREEN, chop_ctime(start_date), NORM);
- print_seconds_for_earthlings(uptime_secs - (start_time / HZ));
+ print_seconds_for_earthlings(uptime_secs - (start_time / hz));
puts(NORM);
}
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2009-03-15 10:10 Mike Frysinger (vapier)
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger (vapier) @ 2009-03-15 10:10 UTC (permalink / raw
To: gentoo-commits
vapier 09/03/15 10:10:18
Modified: qlop.c
Log:
do not stop scanning at first "completed" message since parallel builds now intermingle everything #224103 by Nico R.
Revision Changes Path
1.43 portage-utils/qlop.c
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.43&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.43&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?r1=1.42&r2=1.43
Index: qlop.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- qlop.c 15 Mar 2009 09:57:30 -0000 1.42
+++ qlop.c 15 Mar 2009 10:10:18 -0000 1.43
@@ -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.42 2009/03/15 09:57:30 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.43 2009/03/15 10:10:18 vapier Exp $
*
* Copyright 2005-2007 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2007 Mike Frysinger - <vapier@gentoo.org>
@@ -46,7 +46,7 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.42 2009/03/15 09:57:30 vapier Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.43 2009/03/15 10:10:18 vapier Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
@@ -83,6 +83,7 @@
FILE *fp;
char cat[126], buf[2][BUFSIZ];
char *pkg, *p;
+ char ep[BUFSIZ];
unsigned long count, merge_time;
time_t t[2];
depend_atom *atom;
@@ -120,6 +121,8 @@
strcpy(buf[1], p + 1);
rmspace(buf[1]);
if ((strncmp(buf[1], ">>> emerge (", 12)) == 0) {
+ snprintf(ep, BUFSIZ, "completed %s", &buf[1][4]);
+
char matched = 0;
if ((p = strchr(buf[1], ')')) == NULL)
continue;
@@ -148,9 +151,7 @@
t[1] = atol(buf[0]);
strcpy(buf[1], p + 1);
rmspace(buf[1]);
- if (*buf[1] == '*')
- break;
- if ((strncmp(buf[1], "::: completed emerge (", 22)) == 0) {
+ if ((strncmp(&buf[1][4], ep, BUFSIZ)) == 0) {
if (!average) {
strcpy(buf[1], "");
if (verbose) {
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2009-03-24 18:52 Fabian Groffen (grobian)
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen (grobian) @ 2009-03-24 18:52 UTC (permalink / raw
To: gentoo-commits
grobian 09/03/24 18:52:09
Modified: qlop.c
Log:
portage-utils-0.1.29-darwin.patch
implement show_current_emerge() for Darwin platforms
Revision Changes Path
1.44 portage-utils/qlop.c
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.44&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.44&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?r1=1.43&r2=1.44
Index: qlop.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- qlop.c 15 Mar 2009 10:10:18 -0000 1.43
+++ qlop.c 24 Mar 2009 18:52:09 -0000 1.44
@@ -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.43 2009/03/15 10:10:18 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.44 2009/03/24 18:52:09 grobian Exp $
*
* Copyright 2005-2007 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2007 Mike Frysinger - <vapier@gentoo.org>
@@ -21,6 +21,12 @@
# include <sys/time.h>
#endif
+#ifdef __MACH__
+# include <stdlib.h>
+# include <sys/types.h>
+# include <sys/sysctl.h>
+#endif
+
#define QLOP_DEFAULT_LOGFILE "/var/log/emerge.log"
#define QLOP_FLAGS "gtHluscf:" COMMON_FLAGS
@@ -46,7 +52,7 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.43 2009/03/15 10:10:18 vapier Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.44 2009/03/24 18:52:09 grobian Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
@@ -444,6 +450,107 @@
if (start_date == 0 && verbose)
puts("No emerge processes located");
}
+#elif defined(__MACH__)
+void show_current_emerge(void)
+{
+ int mib[3];
+ size_t size = 0;
+ struct kinfo_proc *ip, *raip;
+ int ret, total_processes, i;
+ char *p, *q;
+ time_t start_date = 0;
+ char args[512];
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_ALL; /* could restrict to _UID (effective uid) */
+
+ /* probe once to get the current size; estimate only, but OS tries
+ * to round up if it can predict a sudden growth, so optimise below
+ * for the optimistic case */
+ ret = sysctl(mib, 3, NULL, &size, NULL, 0);
+ ip = malloc(sizeof(struct kinfo_proc) * size);
+ if (ip == NULL) {
+ warnp("Could not allocate %d bytes for process information",
+ sizeof(struct kinfo_proc) * size);
+ return;
+ }
+ while (1) {
+ ret = sysctl(mib, 3, ip, &size, NULL, 0);
+ if (ret >= 0 && errno == ENOMEM) {
+ size += size / 10; /* may be a bit overdone... */
+ raip = realloc(ip, sizeof(struct kinfo_proc) * size);
+ if (raip == NULL) {
+ free(ip);
+ warnp("Could not extend allocated block to %d bytes for process information",
+ sizeof(struct kinfo_proc) * size);
+ return;
+ }
+ ip = raip;
+ } else if (ret < 0) {
+ free(ip);
+ warnp("Could not retrieve process information");
+ return;
+ } else {
+ break;
+ }
+ }
+
+ total_processes = size / sizeof(struct kinfo_proc);
+
+ /* initialise mib for argv retrieval calls */
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROCARGS;
+
+ for (i = 0; i < total_processes; i++) {
+ char *buf = NULL;
+ size_t argssize = sizeof(args);
+
+ if (strcmp(ip[i].kp_proc.p_comm, "sandbox") != 0)
+ continue;
+
+ mib[2] = ip[i].kp_proc.p_pid;
+ if (sysctl(mib, 3, args, &argssize, NULL, 0) != 0) {
+ free(ip);
+ return;
+ }
+
+ /* this is magic to get back up in the stack where the arguments
+ * start */
+ for (buf = args; buf < &args[argssize]; buf++)
+ if (*buf == '\0')
+ break;
+ if (buf == &args[argssize]) {
+ free(ip);
+ continue;
+ }
+ if ((buf = xstrdup(buf)) == NULL ||
+ buf[0] != '[' || (p = strchr(buf, ']')) == NULL) {
+ free(buf);
+ continue;
+ }
+
+ *p = '\0';
+ p = buf+1;
+ q = p + strlen(p) + 1;
+
+ printf(
+ " %s*%s %s%s%s\n"
+ " started: %s%s%s\n"
+ " elapsed: ", /*%s%llu%s seconds\n",*/
+ BOLD, NORM, BLUE, p, NORM,
+ GREEN, chop_ctime(ip[i].kp_proc.p_starttime.tv_sec), NORM);
+ print_seconds_for_earthlings(time(0) - ip[i].kp_proc.p_starttime.tv_sec);
+ puts(NORM);
+
+ free(buf);
+ }
+
+ free(ip);
+
+ if (start_date == 0 && verbose)
+ puts("No emerge processes located");
+}
#else
void show_current_emerge(void)
{
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2009-12-05 10:01 Mike Frysinger (vapier)
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger (vapier) @ 2009-12-05 10:01 UTC (permalink / raw
To: gentoo-commits
vapier 09/12/05 10:01:07
Modified: qlop.c
Log:
use xmalloc, not malloc as pointed out by Pinky #283934
Revision Changes Path
1.46 portage-utils/qlop.c
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.46&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.46&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?r1=1.45&r2=1.46
Index: qlop.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- qlop.c 24 Mar 2009 20:53:24 -0000 1.45
+++ qlop.c 5 Dec 2009 10:01:07 -0000 1.46
@@ -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.45 2009/03/24 20:53:24 grobian Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.46 2009/12/05 10:01:07 vapier Exp $
*
* Copyright 2005-2007 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2007 Mike Frysinger - <vapier@gentoo.org>
@@ -52,7 +52,7 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.45 2009/03/24 20:53:24 grobian Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.46 2009/12/05 10:01:07 vapier Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
@@ -469,7 +469,7 @@
* to round up if it can predict a sudden growth, so optimise below
* for the optimistic case */
ret = sysctl(mib, 3, NULL, &size, NULL, 0);
- ip = malloc(sizeof(struct kinfo_proc) * size);
+ ip = xmalloc(sizeof(*ip) * size);
if (ip == NULL) {
warnp("Could not allocate %d bytes for process information",
sizeof(struct kinfo_proc) * size);
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2009-12-26 22:33 Ned Ludd (solar)
0 siblings, 0 replies; 13+ messages in thread
From: Ned Ludd (solar) @ 2009-12-26 22:33 UTC (permalink / raw
To: gentoo-commits
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 figure 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=1.47&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.47&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?r1=1.46&r2=1.47
Index: qlop.c
===================================================================
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 2009/12/05 10:01:07 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.47 2009/12/26 22:33:47 solar Exp $
*
* Copyright 2005-2007 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2007 Mike Frysinger - <vapier@gentoo.org>
@@ -52,7 +52,7 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.46 2009/12/05 10:01:07 vapier Exp $";
+static const char qlop_rcsid[] = "$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"))
#define QLOP_LIST 0x01
@@ -323,6 +323,16 @@
if (!hz)
hz = 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 = NULL;
+ if ((p = root_readlink(pid)) != NULL)
+ printf(" root: %s%s%s\n", GREEN, p, NORM);
}
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2009-12-29 0:42 Ned Ludd (solar)
0 siblings, 0 replies; 13+ messages in thread
From: Ned Ludd (solar) @ 2009-12-29 0:42 UTC (permalink / raw
To: gentoo-commits
solar 09/12/29 00:42:19
Modified: qlop.c
Log:
chroot is more fitting for the root symlink action that takes place in proc. So the name is changed from root to chroot
Revision Changes Path
1.48 portage-utils/qlop.c
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.48&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.48&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?r1=1.47&r2=1.48
Index: qlop.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- qlop.c 26 Dec 2009 22:33:47 -0000 1.47
+++ qlop.c 29 Dec 2009 00:42:18 -0000 1.48
@@ -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.47 2009/12/26 22:33:47 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.48 2009/12/29 00:42:18 solar Exp $
*
* Copyright 2005-2007 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2007 Mike Frysinger - <vapier@gentoo.org>
@@ -52,7 +52,7 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.47 2009/12/26 22:33:47 solar Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.48 2009/12/29 00:42:18 solar Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
@@ -404,7 +404,7 @@
puts(NORM);
p = NULL;
if ((p = root_readlink(pid)) != NULL)
- printf(" root: %s%s%s\n", GREEN, p, NORM);
+ printf(" chroot: %s%s%s\n", GREEN, p, NORM);
}
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2010-01-05 3:00 Mike Frysinger (vapier)
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger (vapier) @ 2010-01-05 3:00 UTC (permalink / raw
To: gentoo-commits
vapier 10/01/05 03:00:11
Modified: qlop.c
Log:
delete NULL malloc check pointed out by Didier Barvaux #298962
Revision Changes Path
1.49 portage-utils/qlop.c
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.49&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?rev=1.49&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/portage-utils/qlop.c?r1=1.48&r2=1.49
Index: qlop.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- qlop.c 29 Dec 2009 00:42:18 -0000 1.48
+++ qlop.c 5 Jan 2010 03:00:11 -0000 1.49
@@ -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.48 2009/12/29 00:42:18 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.49 2010/01/05 03:00:11 vapier Exp $
*
* Copyright 2005-2007 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2007 Mike Frysinger - <vapier@gentoo.org>
@@ -52,7 +52,7 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.48 2009/12/29 00:42:18 solar Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.49 2010/01/05 03:00:11 vapier Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
@@ -483,11 +483,6 @@
* for the optimistic case */
ret = sysctl(mib, 3, NULL, &size, NULL, 0);
ip = xmalloc(sizeof(*ip) * size);
- if (ip == NULL) {
- warnp("Could not allocate %d bytes for process information",
- sizeof(struct kinfo_proc) * size);
- return;
- }
while (1) {
ret = sysctl(mib, 3, ip, &size, NULL, 0);
if (ret >= 0 && errno == ENOMEM) {
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2010-06-08 4:54 Mike Frysinger (vapier)
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger (vapier) @ 2010-06-08 4:54 UTC (permalink / raw
To: gentoo-commits
vapier 10/06/08 04:54:08
Modified: qlop.c
Log:
cuddle up the else branch
Revision Changes Path
1.52 portage-utils/qlop.c
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?rev=1.52&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?rev=1.52&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?r1=1.51&r2=1.52
Index: qlop.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- qlop.c 7 Apr 2010 05:58:16 -0000 1.51
+++ qlop.c 8 Jun 2010 04:54:08 -0000 1.52
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2010 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.51 2010/04/07 05:58:16 solar Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.52 2010/06/08 04:54:08 vapier Exp $
*
* Copyright 2005-2010 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org>
@@ -52,7 +52,7 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.51 2010/04/07 05:58:16 solar Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.52 2010/06/08 04:54:08 vapier Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
@@ -244,8 +244,7 @@
if ((p = strchr(q, ':')) == NULL)
continue;
q = p + 2;
- }
- else
+ } else
continue;
if (!quiet)
printf("%s %s %s%s%s\n", chop_ctime(t), (merged ? ">>>" : "<<<"), (merged ? GREEN : RED), q, NORM);
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2010-07-09 22:21 Mike Frysinger (vapier)
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger (vapier) @ 2010-07-09 22:21 UTC (permalink / raw
To: gentoo-commits
vapier 10/07/09 22:21:07
Modified: qlop.c
Log:
qlop: fix up root_readlink() usage so the return value is correct and correctly checked by the caller #327515
Revision Changes Path
1.53 portage-utils/qlop.c
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?rev=1.53&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?rev=1.53&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?r1=1.52&r2=1.53
Index: qlop.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- qlop.c 8 Jun 2010 04:54:08 -0000 1.52
+++ qlop.c 9 Jul 2010 22:21:07 -0000 1.53
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2010 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.52 2010/06/08 04:54:08 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.53 2010/07/09 22:21:07 vapier Exp $
*
* Copyright 2005-2010 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org>
@@ -52,7 +52,7 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.52 2010/06/08 04:54:08 vapier Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.53 2010/07/09 22:21:07 vapier Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
@@ -329,8 +329,10 @@
char buf[_Q_PATH_MAX];
memset(&path, 0, sizeof(path));
snprintf(buf, sizeof(buf), "/proc/%d/root", pid);
- xreadlink(buf, path, sizeof(path) - 1);
- return (char *) path;
+ if (readlink(buf, path, sizeof(path) - 1) == -1)
+ return NULL;
+ else
+ return path;
}
void show_current_emerge(void)
@@ -402,8 +404,8 @@
GREEN, chop_ctime(start_date), NORM);
print_seconds_for_earthlings(uptime_secs - (start_time / hz));
puts(NORM);
- p = NULL;
- if ((p = root_readlink(pid)) != NULL)
+ p = root_readlink(pid);
+ if (p && strcmp(p, "/"))
printf(" chroot: %s%s%s\n", GREEN, p, NORM);
}
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2010-07-19 0:29 Mike Frysinger (vapier)
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger (vapier) @ 2010-07-19 0:29 UTC (permalink / raw
To: gentoo-commits
vapier 10/07/19 00:29:58
Modified: qlop.c
Log:
qlop: improve handling of parallel emerges by Fabio Rossi #274489 by Denis Loginov
Revision Changes Path
1.54 portage-utils/qlop.c
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?rev=1.54&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?rev=1.54&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?r1=1.53&r2=1.54
Index: qlop.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- qlop.c 9 Jul 2010 22:21:07 -0000 1.53
+++ qlop.c 19 Jul 2010 00:29:58 -0000 1.54
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2010 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.53 2010/07/09 22:21:07 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.54 2010/07/19 00:29:58 vapier Exp $
*
* Copyright 2005-2010 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org>
@@ -52,7 +52,7 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.53 2010/07/09 22:21:07 vapier Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.54 2010/07/19 00:29:58 vapier Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
@@ -88,11 +88,12 @@
{
FILE *fp;
char cat[126], buf[2][BUFSIZ];
- char *pkg, *p;
+ char *pkg, *p, *q;
char ep[BUFSIZ];
unsigned long count, merge_time;
time_t t[2];
depend_atom *atom;
+ unsigned int parallel_emerge;
t[0] = t[1] = 0UL;
count = merge_time = 0;
@@ -148,6 +149,7 @@
matched = 1;
if (matched) {
+ parallel_emerge = 0;
while ((fgets(buf[0], sizeof(buf[0]), fp)) != NULL) {
if ((p = strchr(buf[0], '\n')) != NULL)
*p = 0;
@@ -157,7 +159,44 @@
t[1] = atol(buf[0]);
strcpy(buf[1], p + 1);
rmspace(buf[1]);
- if ((strncmp(&buf[1][4], ep, BUFSIZ)) == 0) {
+
+ if (strncmp(buf[1], "Started emerge on:", 18) == 0) {
+ /* a parallel emerge was launched */
+ parallel_emerge++;
+ continue;
+ }
+
+ if (strncmp(buf[1], "*** terminating.", 16) == 0) {
+ if (parallel_emerge > 0) {
+ /* a parallel emerge has finished */
+ parallel_emerge--;
+ continue;
+ } else
+ /* the main emerge was stopped */
+ break;
+ }
+
+ /*
+ * pay attention to malformed log files (when the end of an emerge process
+ * is not indicated by the line '*** terminating'). We assume than the log is
+ * malformed when we find a parallel emerge process which is trying to
+ * emerge the same package
+ */
+ if (strncmp(buf[1], ">>> emerge (", 12) == 0 && parallel_emerge > 0) {
+ p = strchr(buf[1], ')');
+ q = strchr(ep, ')');
+ if (!p || !q)
+ continue;
+
+ if (!strcmp(p, q)) {
+ parallel_emerge--;
+ /* update the main emerge reference data */
+ snprintf(ep, BUFSIZ, "completed %s", &buf[1][4]);
+ continue;
+ }
+ }
+
+ if (strncmp(&buf[1][4], ep, BUFSIZ) == 0) {
if (!average) {
strcpy(buf[1], "");
if (verbose) {
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2011-12-18 1:31 Mike Frysinger (vapier)
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger (vapier) @ 2011-12-18 1:31 UTC (permalink / raw
To: gentoo-commits
vapier 11/12/18 01:31:11
Modified: qlop.c
Log:
drop leading slash since EPREFIX has a trailing slash
Revision Changes Path
1.57 portage-utils/qlop.c
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?rev=1.57&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?rev=1.57&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?r1=1.56&r2=1.57
Index: qlop.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- qlop.c 21 Feb 2011 07:33:21 -0000 1.56
+++ qlop.c 18 Dec 2011 01:31:11 -0000 1.57
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2010 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.56 2011/02/21 07:33:21 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.57 2011/12/18 01:31:11 vapier Exp $
*
* Copyright 2005-2010 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org>
@@ -27,7 +27,7 @@
# include <sys/sysctl.h>
#endif
-#define QLOP_DEFAULT_LOGFILE EPREFIX "/var/log/emerge.log"
+#define QLOP_DEFAULT_LOGFILE EPREFIX "var/log/emerge.log"
#define QLOP_FLAGS "gtHluscf:" COMMON_FLAGS
static struct option const qlop_long_opts[] = {
@@ -52,7 +52,7 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.56 2011/02/21 07:33:21 vapier Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.57 2011/12/18 01:31:11 vapier Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2012-01-16 1:15 Mike Frysinger (vapier)
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger (vapier) @ 2012-01-16 1:15 UTC (permalink / raw
To: gentoo-commits
vapier 12/01/16 01:15:35
Modified: qlop.c
Log:
use ll with long long rather than L
Revision Changes Path
1.59 portage-utils/qlop.c
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?rev=1.59&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?rev=1.59&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?r1=1.58&r2=1.59
Index: qlop.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- qlop.c 19 Dec 2011 20:27:36 -0000 1.58
+++ qlop.c 16 Jan 2012 01:15:35 -0000 1.59
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2010 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.58 2011/12/19 20:27:36 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.59 2012/01/16 01:15:35 vapier Exp $
*
* Copyright 2005-2010 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org>
@@ -52,7 +52,7 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.58 2011/12/19 20:27:36 vapier Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.59 2012/01/16 01:15:35 vapier Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
@@ -433,7 +433,7 @@
"%*d %*d "
"%*d "
"%*d "
- "%Lu ",
+ "%llu ",
&start_time);
/* get uptime */
if (!eat_file("/proc/uptime", bufstat, sizeof(bufstat)))
^ permalink raw reply [flat|nested] 13+ messages in thread
* [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c
@ 2012-10-28 4:56 Mike Frysinger (vapier)
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger (vapier) @ 2012-10-28 4:56 UTC (permalink / raw
To: gentoo-commits
vapier 12/10/28 04:56:05
Modified: qlop.c
Log:
mark funcs as static to avoid duplicate prototypes
Revision Changes Path
1.61 portage-utils/qlop.c
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?rev=1.61&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?rev=1.61&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlop.c?r1=1.60&r2=1.61
Index: qlop.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- qlop.c 28 Oct 2012 04:16:19 -0000 1.60
+++ qlop.c 28 Oct 2012 04:56:05 -0000 1.61
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2010 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.60 2012/10/28 04:16:19 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlop.c,v 1.61 2012/10/28 04:56:05 vapier Exp $
*
* Copyright 2005-2010 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org>
@@ -52,14 +52,15 @@
"Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-static const char qlop_rcsid[] = "$Id: qlop.c,v 1.60 2012/10/28 04:16:19 vapier Exp $";
+static const char qlop_rcsid[] = "$Id: qlop.c,v 1.61 2012/10/28 04:56:05 vapier Exp $";
#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
#define QLOP_UNLIST 0x02
-void print_seconds_for_earthlings(const unsigned long t);
-void print_seconds_for_earthlings(const unsigned long t) {
+_q_static void
+print_seconds_for_earthlings(const unsigned long t)
+{
unsigned dd, hh, mm, ss;
unsigned long tt = t;
ss = tt % 60; tt /= 60;
@@ -72,8 +73,8 @@
printf("%s%u%s second%s", GREEN, ss, NORM, (ss == 1 ? "" : "s"));
}
-static const char *chop_ctime(time_t t);
-static const char *chop_ctime(time_t t)
+_q_static const char *
+chop_ctime(time_t t)
{
static char ctime_out[50];
char *p;
@@ -83,8 +84,8 @@
return ctime_out;
}
-unsigned long show_merge_times(char *package, const char *logfile, int average, char human_readable);
-unsigned long show_merge_times(char *package, const char *logfile, int average, char human_readable)
+_q_static unsigned long
+show_merge_times(char *package, const char *logfile, int average, char human_readable)
{
FILE *fp;
char cat[126], buf[2][BUFSIZ];
@@ -237,8 +238,8 @@
return 0;
}
-void show_emerge_history(char listflag, int argc, char **argv, const char *logfile);
-void show_emerge_history(char listflag, int argc, char **argv, const char *logfile)
+_q_static void
+show_emerge_history(char listflag, int argc, char **argv, const char *logfile)
{
FILE *fp;
size_t buflen;
@@ -305,8 +306,8 @@
fclose(fp);
}
-void show_sync_history(const char *logfile);
-void show_sync_history(const char *logfile)
+_q_static void
+show_sync_history(const char *logfile)
{
FILE *fp;
size_t buflen;
@@ -345,7 +346,7 @@
fclose(fp);
}
-void show_current_emerge(void);
+_q_static void show_current_emerge(void);
#ifdef __linux__
#include <elf.h>
static unsigned long hz = 0;
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-10-28 4:56 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-24 18:52 [gentoo-commits] gentoo-projects commit in portage-utils: qlop.c Fabian Groffen (grobian)
-- strict thread matches above, loose matches on Subject: below --
2012-10-28 4:56 Mike Frysinger (vapier)
2012-01-16 1:15 Mike Frysinger (vapier)
2011-12-18 1:31 Mike Frysinger (vapier)
2010-07-19 0:29 Mike Frysinger (vapier)
2010-07-09 22:21 Mike Frysinger (vapier)
2010-06-08 4:54 Mike Frysinger (vapier)
2010-01-05 3:00 Mike Frysinger (vapier)
2009-12-29 0:42 Ned Ludd (solar)
2009-12-26 22:33 Ned Ludd (solar)
2009-12-05 10:01 Mike Frysinger (vapier)
2009-03-15 10:10 Mike Frysinger (vapier)
2009-03-15 9:57 Mike Frysinger (vapier)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox