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