summaryrefslogtreecommitdiffstats
path: root/misc-utils/kill.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-5/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/signames: remove signame array from header fileKarel Zak2017-10-231-12/+11Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* kill: Extract signal names into signames.h/signames.cNiklas Hambüchen2017-10-141-127/+1Star
|
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: cosmetics, remove argument from usage(FILE*)Ruediger Meier2017-06-261-3/+4
| | | | | | | | | | | | | | This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: add static keyword to where needed [smatch scan]Sami Kerola2017-02-201-1/+1
| | | | | | | text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* kill: remove pid command-name to option aliasSami Kerola2016-08-141-4/+0Star
| | | | | | | | | Removal was promised to happen in March 2016 and the time has come to get rid of this unexpected feature. Reference: c5b057b3422504a671ee588fa66574ae876521f1 Reviewed-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: Fix various typosSebastian Rasmussen2016-05-311-2/+2
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* lib/tty: Pass default width to get_terminal_width()Boris Egorov2016-01-061-5/+1Star
| | | | | | | | | | Almost any code calling get_terminal_width() checks returned width for non-positive values and sets it to some default value (say, 80). So, let's pass this default value directly to the function. [kzak@redhat.com: - get_terminal_width() refactoring] Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+3
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: fix some typos and inconsistencies in various messagesBenno Schulenberg2014-07-231-1/+1
| | | | | | | | Fixing plain typos, miswordings, inconsistent periods, some missing angular brackets, and a proper pluralization (even when it involves a constant, because for some languages the precise value matters). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: fix the usage message of killBenno Schulenberg2014-07-141-10/+10
| | | | | | | | Using angular brackets around each individual argument, indenting a continuation line, not using a space before =, improving some wordings, and the argument of --queue is a value (a piece of data), not a signal. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* kill: use --queue option argument as sigval integer valueSami Kerola2014-07-141-3/+1Star
| | | | | | | | | | | | | The sigqueue(3) takes two values, signal and sigval. Contents of the signal can be altered with --signal option argument, so the --queue argument should be reserved to affect sigval_int. This is regression fix introduced by commit 9e8dffd5cd29f03029b1ac99eecb129532ca5c0f. Reference: http://man7.org/linux/man-pages/man3/sigqueue.3.html Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: remove square brackets from around three dotsBenno Schulenberg2014-05-061-1/+1
| | | | | | Also improve some option descriptions here and there. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* kill: add --verbose option to display what is killedSami Kerola2014-04-261-2/+9
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* kill: remove unnecessary indirectionSami Kerola2014-04-261-3/+1Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* kill: make options --pid and --queue mutually exclusiveSami Kerola2014-04-261-0/+6
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* kill: fix bug in --all semanticKarel Zak2014-04-071-1/+1
| | | | | | Introduces by 2ab6683f59cd3371b1c3ac8b5c248d5104ed4d41. Signed-off-by: Karel Zak <kzak@redhat.com>
* kill: add copyrights, etc.Karel Zak2014-04-071-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* kill: return 64 on partial successKarel Zak2014-04-071-23/+37
| | | | | | | | | | | | | 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>
* kill: coding style, simplify codeKarel Zak2014-04-071-15/+13Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* kill: rename printsig() to print_signal_name()Karel Zak2014-04-071-7/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* kill: rename printsignals() to print_all_signalsprint_all_signals()Karel Zak2014-04-071-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* kill: reorder functions to make it more readableKarel Zak2014-04-071-199/+195Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* kill: move sigqueue inputs to control structSami Kerola2014-03-301-12/+17
| | | | | | | | 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>
* kill: add parse_arguments() functionSami Kerola2014-03-301-53/+60
| | | | | | | Long main() is difficult to read, so moving argument parsing to separate function should make sense. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* kill: tell what is wrong rather than output usage()Sami Kerola2014-03-301-8/+8
| | | | | | | | 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>
* kill: use control structure to pass user input to functionsSami Kerola2014-03-301-50/+59
| | | | | | This should make it easier to understand how the program works. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* kill: deprecat invocation as 'pid' command nameSami Kerola2014-03-301-0/+2
| | | | | | | | 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>
* kill: make usage() not to returnSami Kerola2014-03-301-14/+12Star
| | | | | | | | 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>
* kill: move magic numbers in beginning of the fileSami Kerola2014-03-301-5/+9
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* kill: flip all comparions to be in smaller - greater orderSami Kerola2014-03-301-7/+7
| | | | | | This makes code more readable. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* kill: fix coding styleSami Kerola2014-03-301-277/+259Star
| | | | | | | | | 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>
* kill: support --list=<signal>Karel Zak2013-03-131-9/+16
| | | | | | The '=' is expected for optional arguments and required in procps version. Signed-off-by: Karel Zak <kzak@redhat.com>
* kill: add pretty printed list output (for compatibility with procps)Sami Kerola2013-03-131-48/+85
| | | | | | | | * 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>
* kill: use new API from lib/procutils.cKarel Zak2013-03-121-14/+23
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* kill, procs: use pid_t for pidsSami Kerola2013-03-121-3/+3
| | | | | | 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>
* kill: use libc error printing facilities and exit valuesSami Kerola2013-03-121-32/+24Star
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* kill: align with howto-usage-function.txtSami Kerola2013-03-121-7/+21
| | | | | | | | | [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>
* kill: add long optionsSami Kerola2013-03-121-5/+5
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: spell and encode the name of Arkadiusz Miśkiewicz correctlyBenno Schulenberg2013-02-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: use UTIL_LINUX_VERSION everywhereKarel Zak2013-01-251-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* kill: fix compiler warning [-Wmissing-prototypes]Karel Zak2012-07-161-16/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build: fix redundant redeclaration warningsSami Kerola2012-06-111-3/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* misc-utils: cleanup unused strings.h includesmaximilian attems2012-05-231-1/+0Star
| | | | | | Noticed on klibc building. Signed-off-by: maximilian attems <max@stro.at>
* misc-utils: cleanup strtoxx_or_err()Karel Zak2012-05-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* kill: fix compiler warnings [-Wsign-compare]Karel Zak2011-08-011-4/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* kill: add -q sigval to use sigqueue(2)Karel Zak2011-02-281-1/+27
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>