Method kill
kill(int, int)
Sends a signal to a process or a group of processes.
public static extern int kill(int pid, int sig)
Parameters
pidintThe process ID or process group ID to which the signal is sent. If positive, the signal is sent to the process with the specified ID. If zero, the signal is sent to all processes in the caller's process group. If negative, the signal is sent to all processes in the process group with the absolute value of
pid.sigintThe signal to be sent. This is typically one of the signal constants defined in the operating system.
Returns
- int
Returns 0 on success. On failure, returns -1 and sets the last error, which can be retrieved.
Remarks
This method is a direct wrapper for the POSIX kill function.
It is used to send signals to processes for purposes such as
termination or custom signal handling.