Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-3]: src/usr.bin/pkill Pull up following revision(s) (requested by...
details: https://anonhg.NetBSD.org/src/rev/b2861a04ed93
branches: netbsd-3
changeset: 577358:b2861a04ed93
user: riz <riz%NetBSD.org@localhost>
date: Sat Oct 15 16:33:46 2005 +0000
description:
Pull up following revision(s) (requested by kleink in ticket #890):
usr.bin/pkill/pkill.c: revision 1.13
>From discussion on tech-userlevel, change the comment formatting in the
changes applied in revision 1.10. At the same time, expand the comments
a bit to make the code slightly clearer. No code changes.
diffstat:
usr.bin/pkill/pkill.c | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
diffs (60 lines):
diff -r 5fb0a11713b8 -r b2861a04ed93 usr.bin/pkill/pkill.c
--- a/usr.bin/pkill/pkill.c Sat Oct 15 16:33:15 2005 +0000
+++ b/usr.bin/pkill/pkill.c Sat Oct 15 16:33:46 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pkill.c,v 1.9.2.3 2005/10/15 16:33:15 riz Exp $ */
+/* $NetBSD: pkill.c,v 1.9.2.4 2005/10/15 16:33:46 riz Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: pkill.c,v 1.9.2.3 2005/10/15 16:33:15 riz Exp $");
+__RCSID("$NetBSD: pkill.c,v 1.9.2.4 2005/10/15 16:33:46 riz Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -432,13 +432,15 @@
killact(struct kinfo_proc2 *kp)
{
if (kill(kp->p_pid, signum) == -1) {
+
+ /*
+ * Check for ESRCH, which indicates that the process
+ * disappeared between us matching it and us
+ * signalling it. Return 0 to indicate that the
+ * process should not be considered a match, since we
+ * didn't actually get to signal it.
+ */
if (errno == ESRCH)
- /*
- * The process disappeared between us matching
- * it and us signalling it. Return 0 to
- * indicate that the process should not be
- * considered a match.
- */
return 0;
err(STATUS_ERROR, "signalling pid %d", (int)kp->p_pid);
@@ -453,12 +455,14 @@
char **argv;
if (longfmt && matchargs) {
+
+ /*
+ * If kvm_getargv2() failed the process has probably
+ * disappeared. Return 0 to indicate that the process
+ * should not be considered a match, since we are no
+ * longer in a position to output it as a match.
+ */
if ((argv = kvm_getargv2(kd, kp, 0)) == NULL)
- /*
- * The process disappeared? Return 0 to
- * indicate that the process should not be
- * considered a match.
- */
return 0;
(void)printf("%d ", (int)kp->p_pid);
Home |
Main Index |
Thread Index |
Old Index