Question
Explain kill() and its possible return values.

Answers

There are four possible results from this call:
‘kill()’ returns 0. This implies that a process exists with the given PID, and the system would allow you to send signals to it. It is system-dependent whether the process could be a zombie.
‘kill()’ returns -1, ‘errno == ESRCH’ either no process exists with the given PID, or security enhancements
are causing the system to deny its existence. (On some systems, the process could be a zombie.)
‘kill()’ returns -1, ‘errno == EPERM’ the system would not allow you to kill the specified process. This means
that either the process exists (again, it could be a zombie) or draconian security enhancements are present
(e.g. your process is not allowed to send signals to *anybody*).
‘kill()’ returns -1, with some other value of ‘errno’ you are in trouble! The most-used technique is to assume
that success or failure with ‘EPERM’ implies that the process exists, and any other error implies that it
doesn't.
An alternative exists, if you are writing specifically for a system (or all those systems) that provide a ‘/proc’
filesystem: checking for the existence of ‘/proc/PID’ may work.   Your Comment






Search
Can you Answer!!
  • Q What is the difference between end to end testing and system testing?
  • Q What is the more common name of Sildenafil Citrate
  • Q Mention what is the best usage of nginx server?
  • Q List of some best tools that can be useful for data-analysis?
  • Q What other stream ciphers are there?
  • Q India’s 1st solar powered boat___?
  • Q Explain what is the difference between powerplay transformer and power play reports?
  • Q What does "part-time duty" mean?
  • Q What are the provisions regarding the taxability of per diem allowances received during the stay in the usa?
  • Q What are Facelets Templates?
  • Q What is the function of the OSI Session Layer?