1<assertions> 2 <assertion id="1" tag="ref:XSH6:21977:21978 pt:CX"> 3The kill function sends a signal (sig) to a process or group of processes 4(pid). 5 </assertion> 6 <assertion id="2" tag="ref:XSH6:21978:21980 pt:CX"> 7If sig is 0 (null signal), only error checking (such as to check the validity 8of pid) is performed. No signal is sent. 9 </assertion> 10 <assertion id="3" tag="ref:XSH6:21981:21983::22010:22011 pt:CX"> 11If the real or effective user ID of the sending process does not match the real 12or saved set-user-ID of the receiving process (pid), the kill function 13will fail with errno set to EPERM. 14 </assertion> 15 <assertion id="4" tag="ref:XSH6:21984:21984 pt:CX"> 16For pid > 0, sig is sent to process ID pid. 17 </assertion> 18 <assertion id="5" tag="ref:XSH6:21985:21987 pt:CX"> 19For pid == 0, sig is sent to all processes (except an unspecified 20set of system processes) where process group ID == process group ID of sender. 21The sending process must also have permission to send a signal to the 22receiving process. 23 </assertion> 24 <assertion id="6" tag="ref:XSH6:21988:21989 pt:CX"> 25For pid == -1, sig is sent to all processes (except an unspecified 26set of system processes). The sending process must have permission 27to send signal sig to the receiving process. 28 </assertion> 29 <assertion id="7" tag="ref:XSH6:21990:21992 pt:CX"> 30For pid below 0 and != -1, sig is sent to all processes (except 31an unspecified set of system processes) where process group ID == absolute 32value of pid. The sending process must have permission to send signal 33sig to the receiving process. 34 </assertion> 35 <assertion id="8" tag="ref:XSH6:21993:21996 pt:CX"> 36If it turns out that sig should be sent to the sending process (based on 37pid's value), then it (or at least one pending unblocked signal) 38will be sent to the sending thread before the kill() returns. However, 39if one of these is the case: 40- sig is blocked for the calling thread 41- another thread has sign unblocked 42- another thread is waiting in a sigwait() function for sig 43it will not be sent. 44 </assertion> 45 <assertion id="9" tag="ref:XSH6:21997:21998 pt:CX"> 46If SIGCONT is being sent to a process that happens to be a member of the 47same session as the sending process, then the user ID tests described in 48assertion 3 won't be applied. 49 </assertion> 50 <assertion id="10" tag="ref:XSH6:21999:22001 pt:CX"> 51It is allowed for an implementation to impose further restrictions on the 52sending of signals (for extended security controls), including restrictions 53on the null signal. A particular example is to deny the existence of some 54or all of the processes specified by the pid parameter. 55 </assertion> 56 <assertion id="11" tag="ref:XSH6:22002:22003::22005:22005 pt:CX"> 57If the process has permission to sent sig to at least one of the processes 58specified by pid, then kill() is successful. When kill() is successful, 59it returns 0. 60 </assertion> 61 <assertion id="12" tag="ref:XSH6:22005:22006 pt:CX"> 62When kill() is not successful, it returns -1 and sets errno to indicate 63the type of error. 64 </assertion> 65 <assertion id="13" tag="ref:XSH6:22009:22010 pt:CX"> 66The kill() function sets errno to EINVAL if the value of the sig argument 67is an invalid or unsupported signal number. 68 </assertion> 69 <assertion id="14" tag="ref:XSH6:22010:22011 pt:CX"> 70The kill() function sets errno to EPERM if the process does not have 71permission to send the signal to at least one receiving process. 72 </assertion> 73 <assertion id="15" tag="ref:XSH6:22012:22013 pt:CX"> 74The kill() function sets errno to ESRCH if not one process or process group 75can be found corresponding to the pid parameter. 76 </assertion> 77</assertions> 78 79