[Ilugc] kill

  • From: girishvenkatachalam@xxxxxxxxx (Girish Venkatachalam)
  • Date: Wed, 18 Jul 2012 12:25:45 +0530

kill is a word we normally use to mean murder. ;)

In the UNIX world we often use it to destroy wayward processes.

We also use it to send signals like SIGINFO.

$ pkill -INFO dd

$ kill -l
 1    HUP Hangup                        17   STOP Suspended (signal)
 2    INT Interrupt                     18   TSTP Suspended
 3   QUIT Quit                          19   CONT Continued
 4    ILL Illegal instruction           20   CHLD Child exited
 5   TRAP Trace/BPT trap                21   TTIN Stopped (tty input)
 6   ABRT Abort trap                    22   TTOU Stopped (tty output)
 7    EMT EMT trap                      23     IO I/O possible
 8    FPE Floating point exception      24   XCPU Cputime limit exceeded
 9   KILL Killed                        25   XFSZ Filesize limit exceeded
10    BUS Bus error                     26 VTALRM Virtual timer expired
11   SEGV Segmentation fault            27   PROF Profiling timer expired
12    SYS Bad system call               28  WINCH Window size changes
13   PIPE Broken pipe                   29   INFO Information request
14   ALRM Alarm clock                   30   USR1 User defined signal 1
15   TERM Terminated                    31   USR2 User defined signal 2
16    URG Urgent I/O condition          32    THR Thread AST
$

The signals are reported by the shell but they are not in the shell.

The signals are defined by kernel, libc and so on.

If you want to reboot your machine you can kill the init process or
the pid -1 or something.

I think this differs between UNIXes.

Also you can go to single user mode with kill.

I don't do those things.

Being able to stop a process or re read the config file with a

$ pkill -HUP inetd

is good enough.

I find that many processes do not like the pgrep pkill style.

They want this.

$ kill -9 23433

after doing a grep

$ ps ax|grep <foobar>


If you want a process to dump core for you again kill can do it.

In networking C code we normally ignore the SIGHUP signal.

signal(SIGHUP, SIG_IGN);

Signals are one of the IPC mechanisms but they only signal events as they
 do not carry any payload.

We have to do that some other way.

-Girish

-- 
Gayatri Hitech
http://gayatri-hitech.com

Other related posts: