Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rtp47.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!mcnc!rti-sel!rtp47!wood From: wood@rtp47.UUCP (Tom Wood) Newsgroups: net.unix-wizards Subject: Re: fork timing hole ???... Message-ID: <158@rtp47.UUCP> Date: Fri, 23-Aug-85 09:01:15 EDT Article-I.D.: rtp47.158 Posted: Fri Aug 23 09:01:15 1985 Date-Received: Sun, 25-Aug-85 13:39:25 EDT References: <541@unisoft.UUCP> Distribution: net Organization: Data General, RTP, NC Lines: 45 > Finally, my question ..... Is this a bug?? > And the next, as yet unanswered question .... Should children inherit pending > signals?? .... Will it do any harm?? Yes, all UNIX implementations I've seen do suffer from an incorrect implementation of sending signals to a process group. The manual for kill is quite correct though: when killing a process group, the signal will be sent to all members of the process group. Simply stated, *one* signal sent to a process group should be received by *all* its members. The problem with the implementation is that the typical UNIX mind-set takes hold. Killing a process group is simply killing each process which is a member of the group, and everyone knows that killing a process is just a matter of setting a bit. This can be solved by the following implementation. First, all signals sent to a process are differentiated by the manner in which they were sent. Suppose then, that we have two bit arrays: incomming_signals_for_pid and incomming_signals_for_pgrp. At the time a fork operation is performed, the latter should be inherited by the child, while the former should not. This means that signals sent to a specific process are not inherited, while those sent to a process group are. Furthermore, only those signals that have not yet been processed are subject to being inherited. In support of this change, I won't stand too long on the fact that this is entirely consistent with what is (not) stated in the manual for fork! All UNIX implementations I've seen clear the pending signal vector in the child process. However, I believe this change is consistent with the intent of kill (and killpg), and behaves reasonably when one considers the ability to block signals (as in BSD 4.2). So I think a child should inherit incomming signals (those that have not been processed) which were sent to the parent's process group as a natural course of inheriting the parent's process group. The child should not inherit incomming signals which were sent specifically to the parent. The incomming_signals_for_pgrp vector would also suffice for sending signals to a group of process's based on other selection criteria such as Ken Lalonde's "kill by real user-id". -- Tom Wood Data General, Research Triangle Park, NC {the known world}!mcnc!rti-sel!rtp47!wood