[Midnightbsd-cvs] src [11516] trunk/usr.bin/killall/killall.c: sync killall with freebsd.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Jul 7 15:19:49 EDT 2018
Revision: 11516
http://svnweb.midnightbsd.org/src/?rev=11516
Author: laffer1
Date: 2018-07-07 15:19:48 -0400 (Sat, 07 Jul 2018)
Log Message:
-----------
sync killall with freebsd.
Modified Paths:
--------------
trunk/usr.bin/killall/Makefile
trunk/usr.bin/killall/killall.1
trunk/usr.bin/killall/killall.c
Property Changed:
----------------
trunk/usr.bin/killall/killall.1
Modified: trunk/usr.bin/killall/Makefile
===================================================================
--- trunk/usr.bin/killall/Makefile 2018-07-07 19:19:32 UTC (rev 11515)
+++ trunk/usr.bin/killall/Makefile 2018-07-07 19:19:48 UTC (rev 11516)
@@ -1,4 +1,5 @@
# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/killall/Makefile 194869 2009-06-24 18:18:35Z jamie $
PROG= killall
DPADD= ${LIBJAIL}
Modified: trunk/usr.bin/killall/killall.1
===================================================================
--- trunk/usr.bin/killall/killall.1 2018-07-07 19:19:32 UTC (rev 11515)
+++ trunk/usr.bin/killall/killall.1 2018-07-07 19:19:48 UTC (rev 11516)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" Copyright (C) 1995 by Joerg Wunsch, Dresden
.\" All rights reserved.
.\"
@@ -22,9 +23,9 @@
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/killall/killall.1 252428 2013-06-30 20:27:31Z mjg $
.\"
-.Dd December 25, 2009
+.Dd June 30, 2013
.Dt KILLALL 1
.Os
.Sh NAME
@@ -34,6 +35,7 @@
.Nm
.Op Fl delmsvz
.Op Fl help
+.Op Fl I
.Op Fl j Ar jail
.Op Fl u Ar user
.Op Fl t Ar tty
@@ -71,6 +73,9 @@
option.
.It Fl help
Give a help on the command usage and exit.
+.It Fl I
+Request confirmation before attempting to signal each
+process.
.It Fl l
List the names of the available signals and exit, like in
.Xr kill 1 .
@@ -106,6 +111,8 @@
Limit potentially matching processes to those matching
the specified
.Ar procname .
+.It Fl q
+Suppress error message if no processes are matched.
.It Fl z
Do not skip zombies.
This should not have any effect except to print a few error messages
@@ -118,7 +125,7 @@
So use
.Xr kill 1
for this job (e.g.\&
-.Dq Li "kill -TERM -1
+.Dq Li "kill -TERM -1"
or as root
.Dq Li "echo kill -TERM -1 | su -m <user>" ) .
.Sh IMPLEMENTATION NOTES
Property changes on: trunk/usr.bin/killall/killall.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/killall/killall.c
===================================================================
--- trunk/usr.bin/killall/killall.c 2018-07-07 19:19:32 UTC (rev 11515)
+++ trunk/usr.bin/killall/killall.c 2018-07-07 19:19:48 UTC (rev 11516)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2000 Peter Wemm <peter at FreeBSD.org>
* Copyright (c) 2000 Paul Saab <ps at FreeBSD.org>
@@ -26,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/killall/killall.c 274471 2014-11-13 16:40:15Z smh $");
#include <sys/param.h>
#include <sys/jail.h>
@@ -53,7 +54,7 @@
usage(void)
{
- fprintf(stderr, "usage: killall [-delmsvz] [-help] [-j jail]\n");
+ fprintf(stderr, "usage: killall [-delmsqvz] [-help] [-I] [-j jail]\n");
fprintf(stderr,
" [-u user] [-t tty] [-c cmd] [-SIGNAL] [cmd]...\n");
fprintf(stderr, "At least one option or argument to specify processes must be given.\n");
@@ -90,20 +91,24 @@
int
main(int ac, char **av)
{
+ char **saved_av;
struct kinfo_proc *procs, *newprocs;
struct stat sb;
struct passwd *pw;
regex_t rgx;
regmatch_t pmatch;
- int i, j;
+ int i, j, ch;
char buf[256];
+ char first;
char *user = NULL;
char *tty = NULL;
char *cmd = NULL;
+ int qflag = 0;
int vflag = 0;
int sflag = 0;
int dflag = 0;
int eflag = 0;
+ int Iflag = 0;
int jflag = 0;
int mflag = 0;
int zflag = 0;
@@ -186,6 +191,9 @@
errx(1, "must specify procname");
cmd = *av;
break;
+ case 'q':
+ qflag++;
+ break;
case 'v':
vflag++;
break;
@@ -205,6 +213,7 @@
zflag++;
break;
default:
+ saved_av = av;
if (isalpha((unsigned char)**av)) {
if (strncasecmp(*av, "SIG", 3) == 0)
*av += 3;
@@ -214,8 +223,14 @@
sig = p - sys_signame;
break;
}
- if (!sig)
- nosig(*av);
+ if (!sig) {
+ if (**saved_av == 'I') {
+ av = saved_av;
+ Iflag = 1;
+ break;
+ } else
+ nosig(*av);
+ }
} else if (isdigit((unsigned char)**av)) {
sig = strtol(*av, &ep, 10);
if (!*av || *ep)
@@ -383,6 +398,16 @@
if (matched)
break;
}
+ if (matched != 0 && Iflag) {
+ printf("Send signal %d to %s (pid %d uid %d)? ",
+ sig, thiscmd, thispid, thisuid);
+ fflush(stdout);
+ first = ch = getchar();
+ while (ch != '\n' && ch != EOF)
+ ch = getchar();
+ if (first != 'y' && first != 'Y')
+ matched = 0;
+ }
if (matched == 0)
continue;
if (dflag)
@@ -402,8 +427,9 @@
}
}
if (killed == 0) {
- fprintf(stderr, "No matching processes %swere found\n",
- getuid() != 0 ? "belonging to you " : "");
+ if (!qflag)
+ fprintf(stderr, "No matching processes %swere found\n",
+ getuid() != 0 ? "belonging to you " : "");
errors = 1;
}
exit(errors);
More information about the Midnightbsd-cvs
mailing list