Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/bin/ps pull up revs 1.45-1.46 from trunk (requested by ...
details: https://anonhg.NetBSD.org/src/rev/5f99c7985981
branches: netbsd-1-4
changeset: 469676:5f99c7985981
user: cgd <cgd%NetBSD.org@localhost>
date: Mon Nov 08 06:40:14 1999 +0000
description:
pull up revs 1.45-1.46 from trunk (requested by jdolecek):
When using the procfs for extracting process information, extract process
start time, arguments, and session leadership status. Also, fall back to
procfs when kvm_openfiles() completely fails (e.g. when /dev/mem is not
readable). Fixes PR#7772.
diffstat:
bin/ps/print.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diffs (78 lines):
diff -r be7991e23f69 -r 5f99c7985981 bin/ps/print.c
--- a/bin/ps/print.c Mon Nov 08 06:40:09 1999 +0000
+++ b/bin/ps/print.c Mon Nov 08 06:40:14 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.39.2.1 1999/10/12 21:42:41 he Exp $ */
+/* $NetBSD: print.c,v 1.39.2.2 1999/11/08 06:40:14 cgd Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#else
-__RCSID("$NetBSD: print.c,v 1.39.2.1 1999/10/12 21:42:41 he Exp $");
+__RCSID("$NetBSD: print.c,v 1.39.2.2 1999/11/08 06:40:14 cgd Exp $");
#endif
#endif /* not lint */
@@ -68,7 +68,7 @@
#include "ps.h"
extern kvm_t *kd;
-extern int needenv, needcomm, commandonly;
+extern int needenv, needcomm, commandonly, dontuseprocfs, use_procfs;
static char *cmdpart __P((char *));
static void printval __P((char *, VAR *));
@@ -156,7 +156,7 @@
left = v->width;
} else
left = -1;
- if (needenv) {
+ if (needenv && kd) {
argv = kvm_getenvv(kd, ki->ki_p, termwidth);
if ((p = argv) != NULL) {
while (*p) {
@@ -169,7 +169,11 @@
if (needcomm) {
name = KI_PROC(ki)->p_comm;
if (!commandonly) {
- argv = kvm_getargv(kd, ki->ki_p, termwidth);
+ argv = NULL;
+ if (!use_procfs)
+ argv = kvm_getargv(kd, ki->ki_p, termwidth);
+ else
+ argv = procfs_getargv(ki->ki_p, termwidth);
if ((p = argv) != NULL) {
while (*p) {
fmt_puts(*p, &left);
@@ -182,6 +186,10 @@
fmt_puts(name, &left);
fmt_putc(')', &left);
}
+ if (use_procfs && argv) {
+ free(argv[0]);
+ free(argv);
+ }
} else {
fmt_puts(name, &left);
}
@@ -548,7 +556,7 @@
static int failure;
if (!nlistread)
- failure = donlist();
+ failure = (kd) ? donlist() : 1;
if (failure)
return (0.0);
@@ -587,7 +595,7 @@
int szptudot;
if (!nlistread)
- failure = donlist();
+ failure = (kd) ? donlist() : 1;
if (failure)
return (0.0);
Home |
Main Index |
Thread Index |
Old Index