#
8cd0aeeb |
| 16-May-2022 |
kre <kre@NetBSD.org> |
Alter error messages so they no longer claim that bad input is illegal.
|
#
6d57c023 |
| 30-Aug-2020 |
kre <kre@NetBSD.org> |
Every integer that fits within a pid_t is a potential "pid" arg to kill. 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
Every integer that fits within a pid_t is a potential "pid" arg to kill. 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.
show more ...
|
#
56afef20 |
| 30-Aug-2020 |
kre <kre@NetBSD.org> |
Use the POSIX specified format if POSIXLY_CORRECT is set in the environment, rather than the nicer layout that is normally used.
Note this applies to /bin/kill only, the builtin kill in sh uses its
Use the POSIX specified format if POSIXLY_CORRECT is set in the 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.
show more ...
|
#
388b7696 |
| 12-Dec-2018 |
kre <kre@NetBSD.org> |
Reverse a decision made when the printsignals() routines from 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 sh
Reverse a decision made when the printsignals() routines from 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...
show more ...
|
#
aa340f44 |
| 28-Oct-2018 |
kre <kre@NetBSD.org> |
Switch from using two printsignals() functions, one in trap.c 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
Switch from using two printsignals() functions, one in trap.c 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.
show more ...
|
#
5dfd0f60 |
| 26-Jun-2017 |
kre <kre@NetBSD.org> |
Make arg parsing in kill POSIX compatible with POSIX (XBD 2.12) by parsing the way getopt(3) would, if only it could handle the (required) -signumber and -signame options. This adds two "features" t
Make arg parsing in kill POSIX compatible with POSIX (XBD 2.12) by 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.)
show more ...
|
#
007a7cf0 |
| 29-Aug-2011 |
joerg <joerg@NetBSD.org> |
Use __dead
|
#
f1afa090 |
| 01-Oct-2009 |
spz <spz@NetBSD.org> |
Make sure that numerical signals and pids are in range for their types. Fixes PR bin/42143
|
#
2fe2731d |
| 20-Jul-2008 |
lukem <lukem@NetBSD.org> |
Remove the \n and tabs from the __COPYRIGHT() strings.
|
#
65b5013e |
| 17-Mar-2006 |
christos <christos@NetBSD.org> |
Coverity CID 2356: Remove bogus test !*argv; also cleanup string usage.
|
#
b5b29542 |
| 07-Aug-2003 |
agc <agc@NetBSD.org> |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
#
458ed234 |
| 04-Aug-2003 |
jschauma <jschauma@NetBSD.org> |
As discusses a little while back on tech-userlevel:
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-printab
As discusses a little while back on tech-userlevel:
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.
show more ...
|
#
34100a19 |
| 25-Nov-2002 |
christos <christos@NetBSD.org> |
sent cont to jobs so that they can exit without an fg when killed.
|
#
c02b3bbd |
| 24-Nov-2002 |
christos <christos@NetBSD.org> |
Fixes from David Laight: - ansification - format of output of jobs command (etc) - job identiers %+, %- etc - $? and $(...) - correct quoting of output of set, export -p and readonly -p - differentia
Fixes from David Laight: - 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...)
show more ...
|
#
ed7b508e |
| 16-Sep-2001 |
wiz <wiz@NetBSD.org> |
Use {g,s}etprogname. Patch by Petri Koistinen.
|
#
e54efb95 |
| 29-Jul-2001 |
wiz <wiz@NetBSD.org> |
ANSIfy, some style improvements. Some parts from #13593 by Petri Koistinen.
|
#
30d3c9f1 |
| 04-Nov-1998 |
christos <christos@NetBSD.org> |
unsigned char casts for is*()
|
#
ee9e50ea |
| 28-Jul-1998 |
mycroft <mycroft@NetBSD.org> |
Be more retentive about use of NOTREACHED and noreturn.
|
#
9dc385be |
| 28-Jul-1998 |
mycroft <mycroft@NetBSD.org> |
Delint.
|
#
1381f684 |
| 28-Jul-1998 |
mycroft <mycroft@NetBSD.org> |
Delint.
|
#
51e9bcec |
| 20-Jul-1997 |
christos <christos@NetBSD.org> |
Add WARNS=1
|
#
71f1354a |
| 22-Feb-1997 |
thorpej <thorpej@NetBSD.org> |
Fix a typo that caused lack of argument to be misinterpreted as "0". From Arne H. Juul <arnej@pvv.ntnu.no>, PR #3236.
|
#
f859c958 |
| 07-Sep-1995 |
jtc <jtc@NetBSD.org> |
Sync with 4.4lite2
|
#
49f0ad86 |
| 21-Mar-1995 |
cgd <cgd@NetBSD.org> |
convert to new RCS id conventions.
|
#
da08b16c |
| 17-Mar-1995 |
jtc <jtc@NetBSD.org> |
Changed to accept ``kill -0 pid'' (PR #842).
|