kill [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation
MPE/iX Developer's Kit Reference Manual Volume I
kill
Sends a signal to a process or a process group.
Syntax
#include <sys/types.h>
#include <signal.h>
int kill (pid_t pid, int sig);
Parameters
pid A value indicating the process or process group to receive the
signal specified in sig. Following are valid values and their
meanings:
>0 A process whose process ID is equal to pid.
0 All processes whose process group ID is equal to the
caller's process group ID.
<-1 All processes whose process group ID is equal to the
absolute value of pid.
If -1 is passed in pid, kill() fails and sets errno to EINVAL.
sig A value indicating the signal to be sent. Following are valid
values and their meanings:
>0 The signal number of the signal to send. Refer to
Table 3-5 for a list of supported signals and
their symbolic constants.
0 Test for existence of specified process or process
group. (0 is equivalent to the null signal.)
Return Values
0 Success. The kill() function had permission to send the
signal to at least one of the processes specified in pid.
-1 An error occurred. No signal is sent, and errno is set to
indicate the error condition.
Description
The kill() function sends a signal specified by sig to a process or group
of processes specified by pid. If sig is 0 (the null signal), no signal
is sent, but error checking is performed. Use the null signal to check
for the validity of pid.
The signal is sent only if the caller has permission to send it to the
target process(es). The calling process has permission to send a signal
to a target process if one of the following conditions is true:
* The user associated with the calling process has appropriate
privileges, defined to be one of the following:
* A user whose GID matches the GID of the file and who has
the MPE/iX account manager (AM) user capability.
* A user who has the MPE/iX system manager (SM) user
capability.
* The signal is SIGCONT and the caller's session ID matches the
target's session ID.
* The caller's real UID matches either the target's real UID or its
saved set-user-ID.
* The caller's effective UID matches either the target's real user
ID or its saved set-user-ID.
* The target's UID has been modified by a call to one of the exec()
functions.
A target process that is blocking a signal does not receive that signal
until it unblocks it. (Refer to the sigaction() function.) A target
process can ignore a signal or install a handler for it. The calling
process should not assume that the target process will take the default
(or any other) action for the signal.
If the value of pid causes sig to be generated for the calling process,
and if sig is not blocked, either sig or at least one pending and
unblocked signal is delivered to the calling process before the kill()
function returns.
Implementation Considerations
Job control is not supported.
The {POSIX_SAVED_IDS} constant is always defined.
Use the kill() function to send SIGCONT to a process to continue it after
SIGSTOP has stopped it. The system never generates SIGCONT and SIGSTOP
for a process.
A sending process cannot rely on the target process acting upon a signal
in a timely manner if the target process is executing operating system
code. The target process is not interrupted until it returns from
operating system code.
Refer to Table 3-5 for implementation considerations associated with
signals.
Errors
If an error occurs, errno is set to one of the following values:
EINVAL CAUSE The signal sig is not a valid signal number, or pid
is -1.
ACTION Refer to Table 3-5 for descriptions of valid
signal numbers, or set pid to a valid value.
EPERM CAUSE One of the following:
* The calling process does not have the MPE/iX
process handling (PH) capability.
* The calling process has outstanding switches
to CM code, has set critical mode, has
outstanding NOWAITIO, or is holding an
operating system internal resource, or the
calling process is in a Procedure Exit
handler.
ACTION One of the following:
* Link the program file with the MPE/iX PH
capability.
* Do not execute execl() when the calling
process has outstanding switches to CM code,
has set critical mode, has outstanding
NOWAITIO, or is holding an operating system
internal resource, or in a Procedure Exit
handler.
ESRCH CAUSE No process or process group matches pid.
ACTION No action required.
See Also
getpid(), sigaction(), <signal.h>, POSIX.1 (Section 3.3.2).
MPE/iX 5.0 Documentation