Sponsored Content
Full Discussion: Kill Command
Top Forums UNIX for Dummies Questions & Answers Kill Command Post 302101552 by matrixmadhan on Wednesday 3rd of January 2007 02:30:03 AM
Old 01-03-2007
Quote:
Originally Posted by makki
'kill' sends a SIGTERM signal to the process so it can exit cleanly(close file ptr, flush buffers, etc, and exit), 'kill -9' asks the OS to close the process. That's the only signal that is not delivered to the process,. so it can not handle.
if it is not delivered the process, how is the kernel able to terminate the process forcefully?

It is delivered.

signal handlers for -9 cannot be registered.

Along with -9 there is one more
SIGSTOP which stops the process and cannot be handled.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

kill command

what is the kill command? (1 Reply)
Discussion started by: Rush
1 Replies

2. Programming

the kill command

is it possible to implement the kill command using C? (2 Replies)
Discussion started by: kelogs1347
2 Replies

3. Shell Programming and Scripting

Kill a process without using kill command

Sorry, posted the question in other forum. (0 Replies)
Discussion started by: sudhamacs
0 Replies

4. Linux

Kill a process without using kill command

I want to Kill a process without using kill command as i don't have privileges to kill the process. I know the pid and i am using Linux 2.6.9 OS. (6 Replies)
Discussion started by: sudhamacs
6 Replies

5. Shell Programming and Scripting

kill command issues

xxxxxx (8 Replies)
Discussion started by: kitty123
8 Replies

6. Solaris

Help with Kill Command

I am running Solaris 9. I have a problem with kill command. I'm sort of teaching myself so this might be a really stupid thing. I logged in as a normal user, lets say ABC, and then did "su" to root. After becoming root, I tried to kill the process started by ABC by saying kill -9 "pid of ABC" ... (3 Replies)
Discussion started by: the_red_dove
3 Replies

7. Shell Programming and Scripting

kill command

Good way to kill the process, if the process having it's child (3 Replies)
Discussion started by: pritish.sas
3 Replies

8. Shell Programming and Scripting

kill command in linux OS

How to undo the kill command in Linux OS? (9 Replies)
Discussion started by: poonam.gaigole
9 Replies

9. Shell Programming and Scripting

kill using the ps command

hello, can anyone help me with a script that checks the status of processes and "kills" the process that's hanging? I mean I'm aware of the commands but I'm confused on how to put them all together... thanks! :) (4 Replies)
Discussion started by: dude911
4 Replies

10. UNIX for Dummies Questions & Answers

Kill command

what is the difference between kill 5 and kill %5? the first one is to kill a process with PID 5 but what does the % mean in the second one? (3 Replies)
Discussion started by: chinababy
3 Replies
KILL(2) 						     Linux Programmer's Manual							   KILL(2)

NAME
kill - send signal to a process SYNOPSIS
#include <sys/types.h> #include <signal.h> int kill(pid_t pid, int sig); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): kill(): _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE DESCRIPTION
The kill() system call can be used to send any signal to any process group or process. If pid is positive, then signal sig is sent to the process with the ID specified by pid. If pid equals 0, then sig is sent to every process in the process group of the calling process. If pid equals -1, then sig is sent to every process for which the calling process has permission to send signals, except for process 1 (init), but see below. If pid is less than -1, then sig is sent to every process in the process group whose ID is -pid. If sig is 0, then no signal is sent, but error checking is still performed; this can be used to check for the existence of a process ID or process group ID. For a process to have permission to send a signal it must either be privileged (under Linux: have the CAP_KILL capability), or the real or effective user ID of the sending process must equal the real or saved set-user-ID of the target process. In the case of SIGCONT it suf- fices when the sending and receiving processes belong to the same session. RETURN VALUE
On success (at least one signal was sent), zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EINVAL An invalid signal was specified. EPERM The process does not have permission to send the signal to any of the target processes. ESRCH The pid or process group does not exist. Note that an existing process might be a zombie, a process which already committed termi- nation, but has not yet been wait(2)ed for. CONFORMING TO
SVr4, 4.3BSD, POSIX.1-2001. NOTES
The only signals that can be sent to process ID 1, the init process, are those for which init has explicitly installed signal handlers. This is done to assure the system is not brought down accidentally. POSIX.1-2001 requires that kill(-1,sig) send sig to all processes that the calling process may send signals to, except possibly for some implementation-defined system processes. Linux allows a process to signal itself, but on Linux the call kill(-1,sig) does not signal the calling process. POSIX.1-2001 requires that if a process sends a signal to itself, and the sending thread does not have the signal blocked, and no other thread has it unblocked or is waiting for it in sigwait(3), at least one unblocked signal must be delivered to the sending thread before the kill() returns. Linux Notes Across different kernel versions, Linux has enforced different rules for the permissions required for an unprivileged process to send a signal to another process. In kernels 1.0 to 1.2.2, a signal could be sent if the effective user ID of the sender matched that of the receiver, or the real user ID of the sender matched that of the receiver. From kernel 1.2.3 until 1.3.77, a signal could be sent if the effective user ID of the sender matched either the real or effective user ID of the receiver. The current rules, which conform to POSIX.1-2001, were adopted in kernel 1.3.78. BUGS
In 2.6 kernels up to and including 2.6.7, there was a bug that meant that when sending signals to a process group, kill() failed with the error EPERM if the caller did have permission to send the signal to any (rather than all) of the members of the process group. Notwith- standing this error return, the signal was still delivered to all of the processes for which the caller had permission to signal. SEE ALSO
_exit(2), killpg(2), signal(2), sigqueue(2), tkill(2), exit(3), capabilities(7), credentials(7), signal(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2009-09-15 KILL(2)
All times are GMT -4. The time now is 08:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy