Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://jet.sao.ru/hq/sts/linux/book/c_marshall/subsubsection2_18_4_3_1.html
Дата изменения: Unknown Дата индексирования: Tue Oct 2 09:33:05 2012 Кодировка: Поисковые слова: antarctica |
int kill(int pid, int signal) - send a signal to a process, pid. If pid is greater than zero, the signal is sent to the process whose process ID is equal to pid. If pid is 0, the signal is sent to all processes, except system processes.
kill() returns 0 for a successful call, -1 otherwise and sets errno accordingly.
There is also a UNIX command called kill - see man pages.
NOTE: that unless caught or ignored, the kill signal terminates the process. Therefore protection is built into the system.
Only processes with certain access privileges can be killed off.
Basic rule: only processes that have the same user can send/receive messages.
The SIGKILL signal cannot be caught or ignored and will always terminate a process.
For examplekill(getpid(),SIGINT); would send the interrupt signal to the id of the calling process.
This would have a similar effect to exit() command. Also ctrl-c typed from the command sends a SIGINT to the process currently being.
unsigned int alarm(unsigned int seconds) - sends the signal SIGALRM to the invoking process after seconds seconds.