Commit graph

50 commits

Author SHA1 Message Date
Benno Schulenberg
aa06617f6e textual: remove square brackets from around three dots
Also improve some option descriptions here and there.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-05-06 11:12:13 +02:00
Sami Kerola
d1fd774289 kill: add --verbose option to display what is killed
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 19:04:57 +01:00
Sami Kerola
3665b07cd8 kill: remove unnecessary indirection
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 18:36:40 +01:00
Sami Kerola
fe6b5e321f kill: make options --pid and --queue mutually exclusive
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-26 18:36:40 +01:00
Karel Zak
e0d4675789 kill: fix bug in --all semantic
Introduces by 2ab6683f59.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-07 11:29:09 +02:00
Karel Zak
6853d664a0 kill: add copyrights, etc.
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-07 11:12:14 +02:00
Karel Zak
a01f4d4323 kill: return 64 on partial success
Return 64 (aka SOME_OK) when more than process specified and the
operation success only for subset of the processes.

 # kill -s 0 firefox mutt xxx; echo $?
 kill: cannot find process "xxx"
 64

We already use this concept for chcpu(8) or mount(8).

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-07 11:07:00 +02:00
Karel Zak
e497557f58 kill: coding style, simplify code
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-07 10:17:23 +02:00
Karel Zak
6ca933136f kill: rename printsig() to print_signal_name()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-07 10:10:43 +02:00
Karel Zak
abc7d9bfdf kill: rename printsignals() to print_all_signalsprint_all_signals()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-07 10:03:50 +02:00
Karel Zak
dff74debed kill: reorder functions to make it more readable
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-07 09:59:51 +02:00
Sami Kerola
9e8dffd5cd kill: move sigqueue inputs to control struct
Use of global variables is messy.  The earlier implementation also
assumed queue argument never to be textual, such as 'HUP', which now
works as one might expect.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-30 21:32:36 +01:00
Sami Kerola
fd393d2a02 kill: add parse_arguments() function
Long main() is difficult to read, so moving argument parsing to separate
function should make sense.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-30 21:32:36 +01:00
Sami Kerola
d40c87b0a4 kill: tell what is wrong rather than output usage()
Getting usage as error message is not specific enough.  As a user I want
to know what is wrong, and if it is unclear after error message how to
recover then I run command with --help.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-30 21:32:36 +01:00
Sami Kerola
2ab6683f59 kill: use control structure to pass user input to functions
This should make it easier to understand how the program works.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-30 21:32:36 +01:00
Sami Kerola
c5b057b342 kill: deprecat invocation as 'pid' command name
Enabling options by renaming command is both unexpected and undocumented.
This magic is now deprecated and with remark of removal of this
functionality in future.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-30 21:32:36 +01:00
Sami Kerola
c840c5023c kill: make usage() not to return
And change the function argument to be an output stream.  Earlier the
--help option made kill exit with none-zero value, that is now corrected.

CC: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-30 21:32:36 +01:00
Sami Kerola
6e1bffa886 kill: move magic numbers in beginning of the file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-30 21:32:36 +01:00
Sami Kerola
80af5fb046 kill: flip all comparions to be in smaller - greater order
This makes code more readable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-30 21:32:35 +01:00
Sami Kerola
d4ea8636ad kill: fix coding style
The kill was deprecated at the time lot of other tools got style
unification.  Now when deprecation is lifted it is time to get kill
cleaner.  This commit does not modify code, only various spacing issues,
removal of unecessary braces, and such are dealt.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-30 21:32:35 +01:00
Karel Zak
f546276e22 kill: support --list=<signal>
The '=' is expected for optional arguments and required in procps version.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-13 16:02:55 +01:00
Sami Kerola
fda84b66ee kill: add pretty printed list output (for compatibility with procps)
* add -L, --table

References: http://www.freelists.org/post/procps/kill1-consolidation
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-13 15:47:12 +01:00
Karel Zak
f1e7f7d54e kill: use new API from lib/procutils.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-12 17:40:31 +01:00
Sami Kerola
ea72260cbe kill, procs: use pid_t for pids
Reference: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/threads.h#n30
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-12 15:24:04 +01:00
Sami Kerola
44e5fcddc0 kill: use libc error printing facilities and exit values
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-12 14:42:21 +01:00
Sami Kerola
a5618319e6 kill: align with howto-usage-function.txt
[kzak@redhad.com: - s/commandname/name/
                  - improve --all description
                  - add -h/--help]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-12 14:41:13 +01:00
Sami Kerola
daa54393bc kill: add long options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-03-12 14:31:42 +01:00
Benno Schulenberg
b50945d4ac textual: spell and encode the name of Arkadiusz Miśkiewicz correctly
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-02-06 11:15:02 +01:00
Karel Zak
e421313dc2 textual: use UTIL_LINUX_VERSION everywhere
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-25 12:05:26 +01:00
Karel Zak
eabfd72f30 kill: fix compiler warning [-Wmissing-prototypes]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-16 18:36:27 +02:00
Sami Kerola
0e9b73d3fb build: fix redundant redeclaration warnings
env.c:24:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]
su.c:81:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]

fstab.c:581:14: warning: redundant redeclaration of 'strsignal' [-Wredundant-decls]

kill.h:1:13: note: previous declaration of 'get_pids' was here
kill.c:152:13: warning: redundant redeclaration of 'get_pids' [-Wredundant-decls]

kill.c:142:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]
getopt.c:89:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]

agetty.c:536:15: warning: redundant redeclaration of 'optarg' [-Wredundant-decls]
agetty.c:537:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
script.c:161:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
wall.c:96:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]

libmount.h:362:26: note: previous declaration of 'mnt_update_get_fs' was here
libmount.h:454:26: note: previous declaration of 'mnt_context_get_fs' was here
mountP.h:383:26: warning: redundant redeclaration of 'mnt_context_get_fs' [-Wredundant-decls]
mountP.h:398:26: warning: redundant redeclaration of 'mnt_update_get_fs' [-Wredundant-decls]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-11 19:51:35 +02:00
maximilian attems
adddfd37a1 misc-utils: cleanup unused strings.h includes
Noticed on klibc building.

Signed-off-by: maximilian attems <max@stro.at>
2012-05-23 10:31:12 +02:00
Karel Zak
db41a4298f misc-utils: cleanup strtoxx_or_err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 17:44:37 +02:00
Sami Kerola
c05a80ca63 misc-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:56:48 +02:00
Karel Zak
7239b48577 kill: fix compiler warnings [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-01 12:46:25 +02:00
Karel Zak
a1504d8bf5 kill: add -q sigval to use sigqueue(2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-28 17:15:40 +01:00
Karel Zak
2713fc3ea7 kill: translate "-l <num>" to RT<n>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-28 15:09:18 +01:00
Karel Zak
ae63d823ab kill: add support for real-time signals
Newly supported syntax for RT signals:

 RT<n>  		= SIGRTMIN + n
 RTMIN+<n>		= SIGRTMIN + n
 RTMAX-<n>		= SIGRTMAX - n

the final signal number has to be in interval [SIGRTMIN,SIGRTMAX].

Note that the "SIG" prefix is also supported for RT signals of course.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=676297
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-28 13:43:28 +01:00
Karel Zak
bf969be77d kill: use c.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-16 01:28:41 +02:00
Karel Zak
8e522bb7e9 remove hardcoded package name from some utils
We have PACKAGE_STRING in config.h that includes package name and
version. It's better to use this macro that hardcoded strings.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-27 12:12:00 +02:00
Karel Zak
48d7b13a1e Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
Karel Zak
d162fcb550 Imported from util-linux-2.12j tarball. 2006-12-07 00:26:24 +01:00
Karel Zak
2cccd0ff2b Imported from util-linux-2.12d tarball. 2006-12-07 00:26:18 +01:00
Karel Zak
c07ebfa1e0 Imported from util-linux-2.11b tarball. 2006-12-07 00:25:46 +01:00
Karel Zak
22853e4a82 Imported from util-linux-2.10m tarball. 2006-12-07 00:25:43 +01:00
Karel Zak
eb63b9b8f4 Imported from util-linux-2.10f tarball. 2006-12-07 00:25:41 +01:00
Karel Zak
7eda085c41 Imported from util-linux-2.9v tarball. 2006-12-07 00:25:39 +01:00
Karel Zak
5c36a0eb7c Imported from util-linux-2.9i tarball. 2006-12-07 00:25:37 +01:00
Karel Zak
fd6b7a7ffc Imported from util-linux-2.7.1 tarball. 2006-12-07 00:25:34 +01:00
Karel Zak
6dbe3af945 Imported from util-linux-2.2 tarball. 2006-12-07 00:25:32 +01:00