summaryrefslogtreecommitdiff
path: root/bin/kill
AgeCommit message (Collapse)Author
2022-08-07kill(1): s/proceses/processes/andvar
2022-05-16Alter error messages so they no longer claim that bad input is illegal.kre
2021-08-15restore a bit of history.christos
2020-08-30Mark up path with Pa and use Ev for environment variable.wiz
2020-08-30Note that negative pid args are permitted (indicating to send to the pgrpkre
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.
2020-08-30Every integer that fits within a pid_t is a potential "pid" arg to kill.kre
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.
2020-08-30Use the POSIX specified format if POSIXLY_CORRECT is set in thekre
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.
2020-05-06Bump date for previous change... I frequently forget that bit.kre
2020-05-06kill is built-in to more than just csh(1).kre
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.
2018-12-12Reverse a decision made when the printsignals() routines fromkre
kill and sh were merged so that the shell (for trap -l) and kill (for kill -l) can use the same routine, and site that function in the shell, rather than in kill (use the code that is in kill as the basis for that routine). This allows access to sh internals, and in particular to the posix option, so the builtin kill can operate in posix mode where the standard requires just a single character (space of newline) between successive signal names (and we prefer nicely aligned columns instead).. In a SMALL shell, use the ancient sh printsignals routine instead, it is smaller (and very much dumber). /bin/kill still uses the routine that is in its source, and is not posix compliant. A task for some other day...
2018-10-28Switch from using two printsignals() functions, one in trap.ckre
and one in (the included from bin/kill) kill.c and use just the one in kill.c (which is amended slightly so it can work the way that trap.c needs it to work). This one is chosen as it was a much nicer implementation, and because while kill is always built into the shell, kill also exists without the shell. Leave the old implementation #if 0'd in trap.c (but updated to match the calling convention of the one in kill.c) - for now. Delete references of sys_signame[] from sh/trap.c and along with that several uses of NSIG (unfortunately, there are still more) and replace them with the newer libc functional interfaces.
2017-06-26Make arg parsing in kill POSIX compatible with POSIX (XBD 2.12) bykre
parsing the way getopt(3) would, if only it could handle the (required) -signumber and -signame options. This adds two "features" to kill, -ssigname and -lstatus now work (ie: one word with all of the '-', the option letter, and its value) and "--" also now works (kill -- -pid1 pid2 will not attempt to send the pid1 signal to pid2, but rather SIGTERM to the pid1 process group and pid2). It is still the case that (apart from --) at most 1 option is permitted (-l, -s, -signame, or -signumber.) Note that we now have an ambiguity, -sname might mean "-s name" or send the signal "sname" - if one of those turns out to be valid, that will be accepted, otherwise the error message will indicate that "sname" is not a valid signal name, not that "name" is not. Keeping the "-s" and signal name as separate words avoids this issue. Also caution: should someone be weird enough to define a new signal name (as in the part after SIG) which is almost the same name as an existing name that starts with 'S' by adding an extra 'S' prepended (eg: adding a SIGSSYS) then the ambiguity problem becomes much worse. In that case "kill -ssys" will be resolved in favour of the "-s" flag being used (the more modern syntax) and would send a SIGSYS, rather that a SIGSSYS. So don't do that. While here, switch to using signalname(3) (bye bye NSIG, et. al.), add some constipation, and show a little pride in formatting the signal names for "kill -l" (and in the usage when appropriate -- same routine.) Respect COLUMNS (POSIX XBD 8.3) as primary specification of the width (terminal width, not number of columns to print) for kill -l, a very small value for COLUMNS will cause kill -l output to list signals one per line, a very large value will cause them all to be listed on one line.) (eg: "COLUMNS=1 kill -l") TODO: the signal printing for "trap -l" and that for "kill -l" should be switched to use a common routine (for the sh builtin versions.) All changes of relevance here are to bin/kill - the (minor) changes to bin/sh are only to properly expose the builtin version of getenv(3) so the builtin version of kill can use it (ie: make its prototype available.)
2017-04-22Clarify 0christos
2017-04-22Clarify `kill -0'. Note standard exit codes.riastradh
2016-10-02kill(1) is a utility, not a function.abhinav
2016-08-11Bump datesevan
2016-08-11Earliest reference of kill in the TUHS archive is v3 AT&T UNIX.sevan
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.
2016-08-11Pp not required before Bd, picked up by mandoc lintsevan
2012-03-22Fix whitespace nits. Suggested by Bug Hunting.wiz
2011-08-29Use __deadjoerg
2009-10-01Make sure that numerical signals and pids are in range for their types.spz
Fixes PR bin/42143
2008-07-20Remove the \n and tabs from the __COPYRIGHT() strings.lukem
2007-12-28Wordo fix, noted by jmc@openbsd.wiz
2007-12-27Fix argument confusion, noted by drochner.wiz
2007-11-07Improve -l description. From jmc@openbsd.wiz
2006-03-17Coverity CID 2356: Remove bogus test !*argv; also cleanup string usage.christos
2003-08-07Move UCB-licensed code from 4-clause to 3-clause licence.agc
Patches provided by Joel Baker in PR 22249, verified by myself.
2003-08-04As discusses a little while back on tech-userlevel:jschauma
If stdout is a tty, use vis(3) to print any filenames to prevent garbage from being printed if the filename contains control- or other non-printable characters. While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.
2003-02-25.Nm does not need a dummy argument ("") before punctuation orwiz
for correct formatting of the SYNOPSIS any longer.
2002-11-25sent cont to jobs so that they can exit without an fg when killed.christos
2002-11-24Fixes from David Laight:christos
- ansification - format of output of jobs command (etc) - job identiers %+, %- etc - $? and $(...) - correct quoting of output of set, export -p and readonly -p - differentiation between nornal and 'posix special' builtins - correct behaviour (posix) for errors on builtins and special builtins - builtin printf and kill - set -o debug (if compiled with DEBUG) - cd src obj (as ksh - too useful to do without) - unset -e name, remove non-readonly variable from export list. (so I could unset -e PS1 before running the test shell...)
2002-03-04Xref pkill/pgrep.ad
2001-12-20Whitespace nits.wiz
2001-12-20Deocument the meaning of a pid value of 0 and remove the BUGS section;kleink
mostly from Jonathan Perkin in resolution of PR bin/15008.
2001-09-16Use {g,s}etprogname. Patch by Petri Koistinen.wiz
2001-07-29ANSIfy, some style improvements. Some parts from #13593 by Petri Koistinen.wiz
2000-05-13s/exit_status/signal_number/christos
1999-10-06xref signal(7)jdolecek
1999-09-18Consistancy nits.ad
1998-11-04unsigned char casts for is*()christos
1998-07-28Be more retentive about use of NOTREACHED and noreturn.mycroft
1998-07-28Delint.mycroft
1998-07-28Delint.mycroft
1997-10-20Fix .Nm usage.enami
1997-07-20Remove WARNS=1 from all the subdirectory Makefiles, and add it to Makefile.incchristos
now that all /bin has been cleaned.
1997-07-20Add WARNS=1christos
1997-02-22Fix a typo that caused lack of argument to be misinterpreted as "0".thorpej
From Arne H. Juul <arnej@pvv.ntnu.no>, PR #3236.
1996-12-26reference sigaction(2) instead of the obsolete sigvec(3); fixes PR 3058.mikel
1995-09-07Sync with 4.4lite2jtc
1995-03-21convert to new RCS id conventions.cgd