Commit Graph

46 Commits

Author SHA1 Message Date
csjp
d34702f4cf Re-work r260800 to include other signals which start with 'I'
such as ILL, INFO etc..

Submitted by:	delphij
MFC after:	2 weeks
2014-01-17 04:16:39 +00:00
csjp
0728e663d0 fix a regression introduced in r237618 that would result in
killall confusing killall -INT with killall -I (interactive
confirmation) which resulted in the wrong signal (TERM)
being delivered to the process(s).

Discussed with:	delphij
MFC after:	2 weeks
2014-01-17 03:30:24 +00:00
mjg
fdd0a4cf93 killall: add -q flag to suppress error message when no processes are matched
Man-page text provided by wblock.

PR:		bin/30542
Submitted by:	Tony Finch <dot@dotat.at> (original version)
MFC after:	1 week
2013-06-30 20:27:31 +00:00
kib
5199a9a8a6 Once in a month, when the moon is full, killall mistakenly considers
living process as a zombie and refuses to kill it. The cause is that
the code masks ki_stat with SZOMB to compare with SZOMB, but ki_stat
is not a mask.

Possibly reported by:	cperciva
MFC after:	3 days
2012-06-30 16:36:22 +00:00
kib
80eade56fc killall(1) does not use libkvm.
MFC after:	3 days
2012-06-30 16:23:08 +00:00
kib
9d420f977d Only initialize array of mibs once.
MFC after:	3 days
2012-06-30 16:21:51 +00:00
kib
2398425887 Initialize procs closer to the place were it is used.
Free can properly handle NULL pointer (but keep free() call on the premise
that the code might be reused).
Show errno when realloc failed.

MFC after:	3 days
2012-06-30 16:20:01 +00:00
delphij
db1afde94a Add a -I flag which requests confirmation before action, like what is done
in pkill(1).

MFC after:	2 weeks
2012-06-27 00:50:25 +00:00
jilles
f046771b04 Simplify various code that allowed for sys_signame being lower case.
This was changed in r218285.
2011-03-06 19:50:47 +00:00
jilles
dbecc33067 Make sys_signame upper case.
This matches the constants from <signal.h> with 'SIG' removed, which POSIX
requires kill and trap to accept and 'kill -l' to write.

'kill -l', 'trap', 'trap -l' output is now upper case.

In Turkish locales, signal names with an upper case 'I' are now accepted,
while signal names with a lower case 'i' are no longer accepted, and the
output of 'killall -l' now contains proper capital 'I' without dot instead
of a dotted capital 'I'.
2011-02-04 16:40:50 +00:00
delphij
0842b7d53f Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
delphij
b963db4652 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00
jamie
7c0019fd30 Add libjail, a (somewhat) simpler interface to the jail_set and jail_get
system calls and the security.jail.param sysctls.

Approved by:	bz (mentor)
2009-06-24 18:18:35 +00:00
jamie
8dbff96dac Add support for the arbitrary named jail parameters used by jail_set(2)
and jail_get(2).  Jail(8) can now create jails using a "name=value"
format instead of just specifying a limited set of fixed parameters; it
can also modify parameters of existing jails.  Jls(8) can display all
parameters of jails, or a specified set of parameters.  The available
parameters are gathered from the kernel, and not hard-coded into these
programs.

Small patches on killall(1) and jexec(8) to support jail names with
jail_get(2).

Approved by:	bz (mentor)
2009-05-27 14:30:26 +00:00
delphij
852f970889 Use strlcpy() where appropriate. 2008-11-19 00:14:15 +00:00
ru
1a8465da88 Fix numerous bugs when parsing options and arguments. 2007-11-09 15:14:08 +00:00
maxim
f34d6d1384 The signal number has to be less than NSIG strictly.
PR:		misc/69768
Submitted by:	bronek
MFC after:	1 week
2004-07-29 18:36:35 +00:00
tjr
fccee4f3c3 Don't pass negative values into <ctype.h> functions on machines
with signed chars.
2004-07-15 07:33:56 +00:00
tjr
35c40abaac Print size_t with %zu, not %d. 2004-07-15 07:30:15 +00:00
tjr
cc381691c4 Respect locale settings from the environment. 2004-07-15 07:26:20 +00:00
dds
2f2a10fecb New -e flag, modifies the behavior of the -u uid flag to use the
effective user id, instead of the real user id.

MFC after:	2 weeks
2004-01-26 11:11:36 +00:00
cperciva
92bbd9c60a Serial murderers shouldn't commit suicide. (killall should
avoid killing itself.)

PR: bin/46107
Submitted by: stacey <stacey_@starwhack.net>
2004-01-22 20:56:06 +00:00
maxim
a8282437b8 o Sync usage() and man page synopsis with reality.
MFC after:	1 week
2004-01-18 17:49:25 +00:00
tjr
f428d37a30 Use the 3-component version of the KERN_PROC_PROC sysctl. 2003-09-27 08:14:37 +00:00
tjr
f00a5ee894 Use KERN_PROC_PROC instead of KERN_PROC_ALL when enumerating processes so
that we kill each process once, not once for every thread it owns. This
avoids "No such process" warnings when killing threaded processes.
2003-09-07 09:13:44 +00:00
imp
590fbe0225 make "killall -j" not core dump.
Submitted by: Joe Marcus Clarke in current@
2003-04-27 07:17:27 +00:00
mike
6067525913 o Add jls(8) for listing active jails.
o Add jexec(8) to execute a command in an existing jail.
o Add -j option for killall(1) to kill all processes in a specified
  jail.
o Add -i option to jail(8) to output jail ID of newly created jail.
2003-04-09 03:04:12 +00:00
charnier
dd3bdff2f6 Header was included twice. Hardcode program name in usage string. 2003-02-05 14:20:27 +00:00
obrien
bc61fc95d8 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
dd
e5bc175e13 Mark a warning as such. Without this, it isn't obvious whether
killall stopped after failing to kill one process or whether it kept
going.
2002-05-20 07:17:22 +00:00
des
61ee47c9bf Skip zombies. Add an option (-z) to revert to the historical behaviour
of trying to kill zombies (which has no effect except emit a few error
messages)
2002-04-14 22:25:57 +00:00
dwmalone
59fa66220e Use the method described in the strtol man page to check if it parsed
the entire string.  This avoids signed/unsigned comparison.
2002-03-30 16:24:03 +00:00
bde
229c3ac7c3 Compensate for "Compensate for header dethreading" by backing it out. 2001-10-10 17:48:44 +00:00
obrien
b39990d7f9 Allow -u to work with UID's also.
Submitted by:	Seth Kingsley <seth.kingsley@windriver.com>
2001-06-12 15:58:31 +00:00
phk
9c6cf1aa44 Fix an array which was too small.
PR:		27380
Submitted by:	Samuel Greear <sgreear@vsni.com>
2001-05-16 11:13:16 +00:00
markm
9f745ed9e1 Compensate for header dethreading. 2001-05-01 08:46:02 +00:00
peter
121aa22756 Work around the p_comm[] size limit. If the user supplies more than
16 characters, only check the first 16 since that is all the kernel
records.  This isn't ideal, but it is probably the best we can do.
Otherwise, "killall communicator-linux-4.76.bin" will not match
the process as the kernel only records "communicator-lin".
2001-02-14 21:56:03 +00:00
ache
fa047076b8 Make "killall -t p0" really works.
Old code works only if at least one process name additionly specified.
2001-01-21 01:03:31 +00:00
ps
aca59bd7bc Use the real user ID so non-root users can kill setuid processes
they started.

PR:		23356
Submitted by:	Maxim Konovalov <maxim@macomnet.ru>
2000-12-25 19:26:07 +00:00
jhb
a0ae816020 Catch up to the new kinfo_proc. 2000-12-12 23:31:44 +00:00
ps
0837a683d3 -U cannot be an option since some signals start with U. -u is the
documented behavior so only check for that.
2000-11-12 07:43:50 +00:00
peter
f47bf1f4e6 After positive feedback from a few folks, activate a switchover to
using killall.c instead of the perl version that depends on procfs.
The C version uses sysctl().  The program is based on a hack that was
originally written about 6 years ago and has evolved somewhat since then.
(which is why it is a superset of killall.pl, rather than being a clone.)

With apologies to: wosch
2000-08-28 22:09:38 +00:00
peter
5725601caf Try and fix up some bogus indentation leftovers from emacs several
years ago.
2000-08-27 02:12:29 +00:00
peter
b4ced62446 Sigh, today is not my day. Convert a verbose while() .. loop into a for()
loop.

Submitted by:	billf
2000-08-27 01:17:11 +00:00
peter
eb32ed6b03 *blush*. I was *sure* I compiled this after the last change..
Add the missing )

Shamed by:	billf
2000-08-27 01:10:55 +00:00
peter
44b6aa2b98 killall.c is meant to be a superset replacement of killall.pl, the
main difference is that it uses sysctl to get the process lists rather
than /proc - thereby reducing the dependency on /proc by one more tool.
2000-08-27 00:46:25 +00:00