CVS commit: src/bin/kill

2021-08-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 15 10:58:04 UTC 2021

Modified Files:
src/bin/kill: kill.1

Log Message:
restore a bit of history.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/bin/kill/kill.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.33 src/bin/kill/kill.1:1.34
--- src/bin/kill/kill.1:1.33	Sun Aug 30 16:14:07 2020
+++ src/bin/kill/kill.1	Sun Aug 15 06:58:04 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.33 2020/08/30 20:14:07 wiz Exp $
+.\"	$NetBSD: kill.1,v 1.34 2021/08/15 10:58:04 christos Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	@(#)kill.1	8.2 (Berkeley) 4/28/95
 .\"
-.Dd August 30, 2020
+.Dd August 15, 2021
 .Dt KILL 1
 .Os
 .Sh NAME
@@ -192,3 +192,5 @@ A
 command appeared in
 .At v3
 in section 8 of the manual.
+The original BSD description was: 
+.Sq terminate a process with extreme prejudice .



CVS commit: src/bin/kill

2020-08-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Aug 30 20:14:07 UTC 2020

Modified Files:
src/bin/kill: kill.1

Log Message:
Mark up path with Pa and use Ev for environment variable.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/bin/kill/kill.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.32 src/bin/kill/kill.1:1.33
--- src/bin/kill/kill.1:1.32	Sun Aug 30 19:41:39 2020
+++ src/bin/kill/kill.1	Sun Aug 30 20:14:07 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.32 2020/08/30 19:41:39 kre Exp $
+.\"	$NetBSD: kill.1,v 1.33 2020/08/30 20:14:07 wiz Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -81,8 +81,10 @@ parameter
 or a signal number.
 .Pp
 If no operand is given, display the names of all the signals.
-In /bin/kill, if the variable
-.Dv POSIXLY_CORRECT
+In
+.Pa /bin/kill ,
+if the variable
+.Ev POSIXLY_CORRECT
 is set in the environment, this uses the POSIX specified format,
 otherwise a slightly more pleasing layout is used.
 .It Fl signal_name



CVS commit: src/bin/kill

2020-08-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Aug 30 19:41:39 UTC 2020

Modified Files:
src/bin/kill: kill.1

Log Message:
Note that negative pid args are permitted (indicating to send to the pgrp
abs(pid)) and indicate that -- is (strictly) needed if the first pid arg
(there often is only one) is negative - though this implementation works
without it if a signal to send has been explicitly given, but whereas
'kill 1234" is valid (send SIGTERM to pid 1234) "kill -1234" will generate
a usage error from the attempt to send signal 1234 to nothing, to send
SIGTERM to pgrp 1234 it needs to be "kill -- -1234" (or "kill -s term -1234").

While here do a couple of markup improvements, and allow for the
possibility that users might be running the builtin kill from some
shell other than csh or sh.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/kill/kill.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.31 src/bin/kill/kill.1:1.32
--- src/bin/kill/kill.1:1.31	Sun Aug 30 16:10:40 2020
+++ src/bin/kill/kill.1	Sun Aug 30 19:41:39 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.31 2020/08/30 16:10:40 kre Exp $
+.\"	$NetBSD: kill.1,v 1.32 2020/08/30 19:41:39 kre Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	@(#)kill.1	8.2 (Berkeley) 4/28/95
 .\"
-.Dd May 6, 2020
+.Dd August 30, 2020
 .Dt KILL 1
 .Os
 .Sh NAME
@@ -95,7 +95,9 @@ of the default
 .Dv TERM .
 .El
 .Pp
-The following pids have special meanings:
+The following
+.Ar pid Ns s
+have special meanings:
 .Bl -tag -width Ds -compact
 .It -1
 If superuser, broadcast the signal to all processes; otherwise broadcast
@@ -104,6 +106,24 @@ to all processes belonging to the user.
 Broadcast the signal to all processes in the current process group
 belonging to the user.
 .El
+Any other negative
+.Ar pid
+is interpreted as the negative of a process group identifier,
+and the signal is sent to all members of that group.
+.Pp
+Note that while not required by this implementation,
+if the first
+.Ar pid
+operand is negative, it should be preceded by the
+.Dq \&--
+end of options indicator, to avoid the
+.Ar pid
+being treated as yet more options.
+That is always required if no specific signal is specified
+and the first
+.Ar pid
+is negative, or that pid would be treated as the
+.Ar signal_number .
 .Pp
 Some of the more commonly used signals:
 .Bl -tag -width Ds -compact
@@ -143,9 +163,9 @@ so process id's are not as often used as
 .Nm
 arguments.
 See
-.Xr csh 1
-or
+.Xr csh 1 ,
 .Xr sh 1
+or the man page for the shell in use
 for details.
 .Sh DIAGNOSTICS
 .Ex -std



CVS commit: src/bin/kill

2020-08-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Aug 30 19:35:10 UTC 2020

Modified Files:
src/bin/kill: kill.c

Log Message:
Every integer that fits within a pid_t is a potential "pid" arg to kill.
That means we cannot use (pid_t)-1 as an error indicator, as that's a
valid pid to use (described as working in kill(1) - yet it wasn't working
in /bin/kill (nor sh's builtin kill, which is essentially the same code).
This is even required to work by POSIX.

So change processnum() (the parser/validator for the pid args) to take
a pointer to a pid_t and return the pid that way, leaving the return value
of the (now int) function to indicate just ok/error.  While here, fix
the validation a little ('' is no longer an accepted alias for 0) and in
case of an error from kill(2) have the error message indicate whether the
kill was targeted at a pid of a pgrp.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/kill/kill.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.c
diff -u src/bin/kill/kill.c:1.31 src/bin/kill/kill.c:1.32
--- src/bin/kill/kill.c:1.31	Sun Aug 30 16:10:40 2020
+++ src/bin/kill/kill.c	Sun Aug 30 19:35:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: kill.c,v 1.31 2020/08/30 16:10:40 kre Exp $ */
+/* $NetBSD: kill.c,v 1.32 2020/08/30 19:35:09 kre Exp $ */
 
 /*
  * Copyright (c) 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kill.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kill.c,v 1.31 2020/08/30 16:10:40 kre Exp $");
+__RCSID("$NetBSD: kill.c,v 1.32 2020/08/30 19:35:09 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -66,7 +66,7 @@ int killcmd(int, char *argv[]);
 __dead static void nosig(const char *);
 void printsignals(FILE *, int);
 static int signum(const char *);
-static pid_t processnum(const char *);
+static int processnum(const char *, pid_t *);
 __dead static void usage(void);
 
 int
@@ -177,6 +177,7 @@ main(int argc, char *argv[])
 	for (errors = 0; argc; argc--, argv++) {
 #ifdef SHELL
 		extern int getjobpgrp(const char *);
+
 		if (*argv[0] == '%') {
 			pid = getjobpgrp(*argv);
 			if (pid == 0) {
@@ -186,13 +187,13 @@ main(int argc, char *argv[])
 			}
 		} else 
 #endif
-			if ((pid = processnum(*argv)) == (pid_t)-1) {
+			if (processnum(*argv, &pid) != 0) {
 errors = 1;
 continue;
 			}
 
 		if (kill(pid, numsig) == -1) {
-			warn("%s", *argv);
+			warn("%s %s", pid < -1 ? "pgrp" : "pid", *argv);
 			errors = 1;
 		}
 #ifdef SHELL
@@ -226,22 +227,24 @@ signum(const char *sn)
 	return (int)n;
 }
 
-static pid_t
-processnum(const char *s)
+static int
+processnum(const char *s, pid_t *pid)
 {
 	intmax_t n;
 	char *ep;
 
+	errno = 0;
 	n = strtoimax(s, &ep, 10);
 
 	/* check for correctly parsed number */
-	if (*ep || n == INTMAX_MIN || n == INTMAX_MAX || (pid_t)n != n ||
-	n == -1) {
-		warnx("illegal process%s id: %s", (n < 0 ? " group" : ""), s);
-		n = -1;
+	if (ep == s || *ep || n == INTMAX_MIN || n == INTMAX_MAX ||
+	(pid_t)n != n || errno != 0) {
+		warnx("illegal process%s id: '%s'", (n < 0 ? " group" : ""), s);
+		return -1;
 	}
 
-	return (pid_t)n;
+	*pid = (pid_t)n;
+	return 0;
 }
 
 static void



CVS commit: src/bin/kill

2020-08-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Aug 30 16:10:40 UTC 2020

Modified Files:
src/bin/kill: kill.1 kill.c

Log Message:
Use the POSIX specified format if POSIXLY_CORRECT is set in the
environment, rather than the nicer layout that is normally used.

Note this applies to /bin/kill only, the builtin kill in sh uses its
"posix" option for the same purpose, the one in csh only ever uses
POSIX format.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/kill/kill.1 src/bin/kill/kill.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.30 src/bin/kill/kill.1:1.31
--- src/bin/kill/kill.1:1.30	Wed May  6 13:13:50 2020
+++ src/bin/kill/kill.1	Sun Aug 30 16:10:40 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.30 2020/05/06 13:13:50 kre Exp $
+.\"	$NetBSD: kill.1,v 1.31 2020/08/30 16:10:40 kre Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -81,6 +81,10 @@ parameter
 or a signal number.
 .Pp
 If no operand is given, display the names of all the signals.
+In /bin/kill, if the variable
+.Dv POSIXLY_CORRECT
+is set in the environment, this uses the POSIX specified format,
+otherwise a slightly more pleasing layout is used.
 .It Fl signal_name
 A symbolic signal name specifying the signal to be sent instead of the
 default
Index: src/bin/kill/kill.c
diff -u src/bin/kill/kill.c:1.30 src/bin/kill/kill.c:1.31
--- src/bin/kill/kill.c:1.30	Wed Dec 12 20:22:43 2018
+++ src/bin/kill/kill.c	Sun Aug 30 16:10:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: kill.c,v 1.30 2018/12/12 20:22:43 kre Exp $ */
+/* $NetBSD: kill.c,v 1.31 2020/08/30 16:10:40 kre Exp $ */
 
 /*
  * Copyright (c) 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kill.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kill.c,v 1.30 2018/12/12 20:22:43 kre Exp $");
+__RCSID("$NetBSD: kill.c,v 1.31 2020/08/30 16:10:40 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -267,7 +267,9 @@ printsignals(FILE *fp, int len)
 	int nl, pad;
 	const char *name;
 	int termwidth = 80;
+	int posix;
 
+	posix = getenv("POSIXLY_CORRECT") != 0;
 	if ((name = getenv("COLUMNS")) != 0)
 		termwidth = atoi(name);
 	else if (isatty(fileno(fp))) {
@@ -278,6 +280,8 @@ printsignals(FILE *fp, int len)
 	}
 
 	pad = (len | 7) + 1 - len;
+	if (posix && pad)
+		pad = 1;
 
 	for (sig = 0; (sig = signalnext(sig)) != 0; ) {
 		name = signalname(sig);
@@ -297,6 +301,8 @@ printsignals(FILE *fp, int len)
 
 		len += nl + pad;
 		pad = (nl | 7) + 1 - nl;
+		if (posix && pad)
+			pad = 1;
 
 		fprintf(fp, "%s", name);
 	}



CVS commit: src/bin/kill

2020-05-06 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed May  6 13:13:50 UTC 2020

Modified Files:
src/bin/kill: kill.1

Log Message:
Bump date for previous change...  I frequently forget that bit.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/kill/kill.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.29 src/bin/kill/kill.1:1.30
--- src/bin/kill/kill.1:1.29	Wed May  6 09:07:15 2020
+++ src/bin/kill/kill.1	Wed May  6 13:13:50 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.29 2020/05/06 09:07:15 kre Exp $
+.\"	$NetBSD: kill.1,v 1.30 2020/05/06 13:13:50 kre Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	@(#)kill.1	8.2 (Berkeley) 4/28/95
 .\"
-.Dd April 22, 2017
+.Dd May 6, 2020
 .Dt KILL 1
 .Os
 .Sh NAME



CVS commit: src/bin/kill

2020-05-06 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed May  6 09:07:15 UTC 2020

Modified Files:
src/bin/kill: kill.1

Log Message:
kill is built-in to more than just csh(1).
While here, add missing Xr sh 1 (which was previously needed, moreso now)
and also include STOP and CONT in the list of common signals.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/bin/kill/kill.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.28 src/bin/kill/kill.1:1.29
--- src/bin/kill/kill.1:1.28	Sat Apr 22 23:01:36 2017
+++ src/bin/kill/kill.1	Wed May  6 09:07:15 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.28 2017/04/22 23:01:36 christos Exp $
+.\"	$NetBSD: kill.1,v 1.29 2020/05/06 09:07:15 kre Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -120,10 +120,19 @@ KILL (non-catchable, non-ignorable kill)
 ALRM (alarm clock)
 .It 15
 TERM (software termination signal)
+.It 17
+STOP (non-catchable, non-ignorable, causes process to temporarily stop,
+after which it can later be resumed using
+.Dv SIGCONT )
+.It 19
+CONT (stopped proceses resume execution)
 .El
 .Pp
 .Nm
-is a built-in to
+is a built-in to most shells,
+including
+.Xr sh 1
+and
 .Xr csh 1 ;
 it allows job specifiers of the form ``%...'' as arguments
 so process id's are not as often used as
@@ -131,6 +140,8 @@ so process id's are not as often used as
 arguments.
 See
 .Xr csh 1
+or
+.Xr sh 1
 for details.
 .Sh DIAGNOSTICS
 .Ex -std
@@ -139,6 +150,7 @@ for details.
 .Xr pgrep 1 ,
 .Xr pkill 1 ,
 .Xr ps 1 ,
+.Xr sh 1 ,
 .Xr kill 2 ,
 .Xr sigaction 2 ,
 .Xr signal 7



CVS commit: src/bin/kill

2017-04-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 22 23:01:36 UTC 2017

Modified Files:
src/bin/kill: kill.1

Log Message:
Clarify 0


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/bin/kill/kill.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.27 src/bin/kill/kill.1:1.28
--- src/bin/kill/kill.1:1.27	Sat Apr 22 18:42:03 2017
+++ src/bin/kill/kill.1	Sat Apr 22 19:01:36 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.27 2017/04/22 22:42:03 riastradh Exp $
+.\"	$NetBSD: kill.1,v 1.28 2017/04/22 23:01:36 christos Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -104,7 +104,8 @@ belonging to the user.
 Some of the more commonly used signals:
 .Bl -tag -width Ds -compact
 .It 0
-do nothing, only test whether process exists
+0 (does not affect the process; can be used to test whether the
+process exists)
 .It 1
 HUP (hang up)
 .It 2



CVS commit: src/bin/kill

2017-04-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 22 22:42:03 UTC 2017

Modified Files:
src/bin/kill: kill.1

Log Message:
Clarify `kill -0'.  Note standard exit codes.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/bin/kill/kill.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.26 src/bin/kill/kill.1:1.27
--- src/bin/kill/kill.1:1.26	Sun Oct  2 21:00:54 2016
+++ src/bin/kill/kill.1	Sat Apr 22 22:42:03 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.26 2016/10/02 21:00:54 abhinav Exp $
+.\"	$NetBSD: kill.1,v 1.27 2017/04/22 22:42:03 riastradh Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	@(#)kill.1	8.2 (Berkeley) 4/28/95
 .\"
-.Dd August 11, 2016
+.Dd April 22, 2017
 .Dt KILL 1
 .Os
 .Sh NAME
@@ -103,6 +103,8 @@ belonging to the user.
 .Pp
 Some of the more commonly used signals:
 .Bl -tag -width Ds -compact
+.It 0
+do nothing, only test whether process exists
 .It 1
 HUP (hang up)
 .It 2
@@ -129,6 +131,8 @@ arguments.
 See
 .Xr csh 1
 for details.
+.Sh DIAGNOSTICS
+.Ex -std
 .Sh SEE ALSO
 .Xr csh 1 ,
 .Xr pgrep 1 ,



CVS commit: src/bin/kill

2016-10-02 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Sun Oct  2 21:00:54 UTC 2016

Modified Files:
src/bin/kill: kill.1

Log Message:
kill(1) is a utility, not a function.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/bin/kill/kill.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.25 src/bin/kill/kill.1:1.26
--- src/bin/kill/kill.1:1.25	Thu Aug 11 22:10:01 2016
+++ src/bin/kill/kill.1	Sun Oct  2 21:00:54 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.25 2016/08/11 22:10:01 sevan Exp $
+.\"	$NetBSD: kill.1,v 1.26 2016/10/02 21:00:54 abhinav Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -140,7 +140,7 @@ for details.
 .Sh STANDARDS
 The
 .Nm
-function is expected to be
+utility is expected to be
 .St -p1003.2
 compatible.
 .Sh HISTORY



CVS commit: src/bin/kill

2016-08-11 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Aug 11 22:10:01 UTC 2016

Modified Files:
src/bin/kill: kill.1

Log Message:
Bump date


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/kill/kill.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.24 src/bin/kill/kill.1:1.25
--- src/bin/kill/kill.1:1.24	Thu Aug 11 21:56:55 2016
+++ src/bin/kill/kill.1	Thu Aug 11 22:10:01 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.24 2016/08/11 21:56:55 sevan Exp $
+.\"	$NetBSD: kill.1,v 1.25 2016/08/11 22:10:01 sevan Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	@(#)kill.1	8.2 (Berkeley) 4/28/95
 .\"
-.Dd April 28, 1995
+.Dd August 11, 2016
 .Dt KILL 1
 .Os
 .Sh NAME



CVS commit: src/bin/kill

2016-08-11 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Aug 11 21:56:55 UTC 2016

Modified Files:
src/bin/kill: kill.1

Log Message:
Earliest reference of kill in the TUHS archive is v3 AT&T UNIX.
Unfortunately only the source code for the compiler is present for that
release. The v2 archive is missing the manuals & only contains a some of the
commands.
Switch to v3 and reference manual category eight.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/bin/kill/kill.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.23 src/bin/kill/kill.1:1.24
--- src/bin/kill/kill.1:1.23	Thu Aug 11 21:41:17 2016
+++ src/bin/kill/kill.1	Thu Aug 11 21:56:55 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.23 2016/08/11 21:41:17 sevan Exp $
+.\"	$NetBSD: kill.1,v 1.24 2016/08/11 21:56:55 sevan Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -147,4 +147,5 @@ compatible.
 A
 .Nm
 command appeared in
-.At v6 .
+.At v3
+in section 8 of the manual.



CVS commit: src/bin/kill

2016-08-11 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Aug 11 21:41:17 UTC 2016

Modified Files:
src/bin/kill: kill.1

Log Message:
Pp not required before Bd, picked up by mandoc lint


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/bin/kill/kill.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.1
diff -u src/bin/kill/kill.1:1.22 src/bin/kill/kill.1:1.23
--- src/bin/kill/kill.1:1.22	Thu Mar 22 07:58:17 2012
+++ src/bin/kill/kill.1	Thu Aug 11 21:41:17 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.1,v 1.22 2012/03/22 07:58:17 wiz Exp $
+.\"	$NetBSD: kill.1,v 1.23 2016/08/11 21:41:17 sevan Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -63,7 +63,6 @@ by the pid operand(s).
 Only the super-user may send signals to other users' processes.
 .Pp
 The options are as follows:
-.Pp
 .Bl -tag -width Ds
 .It Fl s Ar signal_name
 A symbolic signal name specifying the signal to be sent instead of the



CVS commit: src/bin/kill

2009-10-01 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Thu Oct  1 09:24:38 UTC 2009

Modified Files:
src/bin/kill: kill.c

Log Message:
Make sure that numerical signals and pids are in range for their types.
Fixes PR bin/42143


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/bin/kill/kill.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/kill/kill.c
diff -u src/bin/kill/kill.c:1.25 src/bin/kill/kill.c:1.26
--- src/bin/kill/kill.c:1.25	Sun Jul 20 00:52:40 2008
+++ src/bin/kill/kill.c	Thu Oct  1 09:24:38 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: kill.c,v 1.25 2008/07/20 00:52:40 lukem Exp $ */
+/* $NetBSD: kill.c,v 1.26 2009/10/01 09:24:38 spz Exp $ */
 
 /*
  * Copyright (c) 1988, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)kill.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kill.c,v 1.25 2008/07/20 00:52:40 lukem Exp $");
+__RCSID("$NetBSD: kill.c,v 1.26 2009/10/01 09:24:38 spz Exp $");
 #endif
 #endif /* not lint */
 
@@ -49,6 +49,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -69,7 +71,8 @@
 int
 main(int argc, char *argv[])
 {
-	int errors, numsig, pid;
+	int errors;
+	intmax_t numsig, pid;
 	char *ep;
 
 	setprogname(argv[0]);
@@ -87,17 +90,19 @@
 		if (argc == 1) {
 			if (isdigit((unsigned char)**argv) == 0)
 usage();
-			numsig = strtol(*argv, &ep, 10);
-			if (*ep != '\0') {
+			numsig = strtoimax(*argv, &ep, 10);
+			/* check for correctly parsed number */
+			if (*ep != '\0' || numsig == INTMAX_MIN || numsig == INTMAX_MAX) {
 errx(EXIT_FAILURE, "illegal signal number: %s",
 		*argv);
 /* NOTREACHED */
 			}
 			if (numsig >= 128)
 numsig -= 128;
+			/* and whether it fits into signals range */
 			if (numsig <= 0 || numsig >= NSIG)
 nosig(*argv);
-			printf("%s\n", sys_signame[numsig]);
+			printf("%s\n", sys_signame[(int) numsig]);
 			exit(0);
 		}
 		printsignals(stdout);
@@ -122,12 +127,14 @@
 			if ((numsig = signame_to_signum(sn)) < 0)
 nosig(sn);
 		} else if (isdigit((unsigned char)*sn)) {
-			numsig = strtol(sn, &ep, 10);
-			if (*ep) {
+			numsig = strtoimax(sn, &ep, 10);
+			/* check for correctly parsed number */
+			if (*ep || numsig == INTMAX_MIN || numsig == INTMAX_MAX ) {
 errx(EXIT_FAILURE, "illegal signal number: %s",
 		sn);
 /* NOTREACHED */
 			}
+			/* and whether it fits into signals range */
 			if (numsig < 0 || numsig >= NSIG)
 nosig(sn);
 		} else
@@ -151,14 +158,17 @@
 		} else 
 #endif
 		{
-			pid = strtol(*argv, &ep, 10);
-			if (!**argv || *ep) {
+			pid = strtoimax(*argv, &ep, 10);
+			/* make sure the pid is a number and fits into pid_t */
+			if (!**argv || *ep || pid == INTMAX_MIN ||
+pid == INTMAX_MAX || pid != (pid_t) pid) {
+
 warnx("illegal process id: %s", *argv);
 errors = 1;
 continue;
 			}
 		}
-		if (kill(pid, numsig) == -1) {
+		if (kill((pid_t) pid, (int) numsig) == -1) {
 			warn("%s", *argv);
 			errors = 1;
 		}
@@ -166,7 +176,7 @@
 		/* Wakeup the process if it was suspended, so it can
 		   exit without an explicit 'fg'. */
 		if (numsig == SIGTERM || numsig == SIGHUP)
-			kill(pid, SIGCONT);
+			kill((pid_t) pid, SIGCONT);
 #endif
 	}