Support for 'kill -SIGNAME ...' was added in 4BSD

September 4, 2022

The Unix 'kill' command that we're familiar with (and that was standardized as POSIX kill(1)) accepts and even perhaps prefers to be invoked with a signal name, as 'kill -SIGNAME ...' (well, POSIX would like you to use 'kill -s SIGNAME'). For reasons beyond the scope of this blog entry, I was curious about when and where in Unix history this was added to kill. The somewhat surprising answer turns out to be in 4BSD.

One reason this surprised me is that I hadn't really heard much of 4BSD before this; I knew of 4.2 BSD (the famous one) and also 4.1c BSD (a sort of interim predecessor). 4BSD turns out to be more interesting than I expected, and apparently the origin of a number of things I thought as 4.2 BSD features, like job control and curses.

The V7 kill.c is quite simple, and implements 'kill -<signumber>' in basically the obvious way. The 4BSD kill.c has grown more complicated, including with a hard coded table of signal names, and the 4BSD kill.1 manual page documents its new features (which isn't always the case in BSD developments).

I wondered if this also showed up in System III, which I have a blind spot about; the answer appears to be that it didn't. The System III kill.c is larger and more formatted than the V7 version, but doesn't have any support for signaling by name. However, it also supports sending signals to process groups, which are a somewhat complicated subject in Unix history. I believe that the 4BSD kill.c doesn't support sending signals to process groups, although the underlying kill(2) system call in sys4.c does support this in an odd way (which is new since V7).

(The 4BSD kill(2) manual page doesn't document this behavior of the system call, but it's there in the source code with an explicit comment about it. Probably 4BSD wanted you to use killpg(2j) instead, which would hide the odd way this was implemented in the actual system call.)

Written on 04 September 2022.
« Our Prometheus host metrics saved us from some painful experiences
The history of sending signals to Unix process groups »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sun Sep 4 22:19:28 2022
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.