endif
free_SOURCES = free.c lib/strutils.c lib/fileutils.c
-pgrep_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c ps/global.c
-pkill_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c ps/global.c
+pgrep_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c
+pkill_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c
pmap_SOURCES = pmap.c lib/fileutils.c
if !CYGWIN
pwdx_SOURCES = pwdx.c lib/fileutils.c
#include "proc/sig.h"
#include "proc/devname.h"
#include "proc/sysinfo.h"
-#include "ps/common.h"
#define grow_size(x) do { \
if ((x) < 0 || (size_t)(x) >= INT_MAX / 5 / sizeof(struct el)) \
char *cmdoutput = xmalloc(cmdlen);
proc_t ns_task;
time_t now;
+ double uptime_secs, idle_secs;
+
ptp = do_openproc();
preg = do_regcomp();
now = time(NULL);
+ if (uptime(&uptime_secs, &idle_secs) == 0)
+ xerrx(EXIT_FAILURE, "uptime");
+
if (opt_newest) saved_start_time = 0ULL;
else saved_start_time = ~0ULL;
if (opt_newest) saved_pid = 0;
if (opt_oldest) saved_pid = INT_MAX;
- if (opt_older) reset_global();
if (opt_ns_pid && ns_read(opt_ns_pid, &ns_task)) {
fputs(_("Error reading reference namespace information\n"),
stderr);
memset(&task, 0, sizeof (task));
memset(&subtask, 0, sizeof (subtask));
while(readproc(ptp, &task)) {
- /* printf( "Process state %c\n", task.state ); */
int match = 1;
if (task.XXXID == myself)
}
}
else if (opt_older)
- if(now - seconds_since_boot + (task.start_time / Hertz) + opt_older > now) match = 0;
+ if(now - uptime_secs + (task.start_time / Hertz) + opt_older > now) match = 0;
else if (opt_runstates) {
match = 0;
if (strchr(opt_runstates, task.state)) match = 1;