What are the possible return values of kill()?
The kill() method on execution can yield the following possible results:
- ‘0’ returned: Means that the process exists with the specified PID. It will allow the user to send signals to this process.
- ‘-1’ returned, ‘errno==ESRCH’: This means that the process with the specified PID does not exist or some security enhancements is denying its existence.
- ‘-1’ returned, ‘errno==EPERM’: This means that the system would not permit the process to be killed.
The EPERM process is used to detect if a process exists or not. Any other error would specify that the process does not exist.
Post a Comment