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.
Showing posts with label kill command. Show all posts
Showing posts with label kill command. Show all posts
What is 'ps' command for?How would you kill a process?
What is 'ps' command for?How would you kill a process?
Question1 :What is 'ps' command for?
Answer :The ps command prints the process status for some or all of the running processes. The information given are the process identification number (PID),the amount of time that the process has taken to execute so far etc.
Question 2:How would you kill a process?
Answer :The kill command takes the PID as one argument; this identifies which process to terminate. The PID of a process can be got using 'ps' command. -9 is the option given
Answer :The ps command prints the process status for some or all of the running processes. The information given are the process identification number (PID),the amount of time that the process has taken to execute so far etc.
Question 2:How would you kill a process?
Answer :The kill command takes the PID as one argument; this identifies which process to terminate. The PID of a process can be got using 'ps' command. -9 is the option given
Keywords:
ps -ef command output
ps aux command in linux
ps -ef command explanation
ps -ef command example
ps command in unix
what is tty in ps command
kill command in linux
force kill process linux command line
kill process linux by name
linux kill process by pid
force kill process linux terminal
force kill process linux pid
linux kill all processes by user
kill program linux command line
kill all process in linux
Subscribe to:
Posts (Atom)