📄 kill.2
字号:
.\" SCCSID: @(#)kill.2 2.1 3/10/87.TH kill 2.SH Namekill \- send signal to a process.SH Syntax.nf#include <sys/types.h>#include <signal.h>.PP kill(\fIpid, sig\fP).brpid_t \fIpid\fP;int \fIsig\fP;.fi.SH Description.NXR "kill system call".NXA "kill system call" "pause subroutine".NXR "process" "signaling"The system call.PN killsends the signal \fIsig\fPto a process specified by the process number.IR pid .The.I sigcan be a signal specified in a.PN sigvec call or it can be 0. If the.I sigis 0, error checking is performed, but a signalis not sent. This call can be used to check the validity of.IR pid ..PPThe sending and receiving processes musthave the same effective user ID, otherwisethis call is restricted to the superuser with the exceptionof the signal SIGCONT. The signal SIGCONT can always besent to a child or grandchild of the current process..PPIf the process number is 0,the signal is sent to all other processes in thesender's process group..PPIf the process number is negative but not \-1,the signalis sent to all processes whose process-group-id is equal to the absolute value of the process number..PPThe above two options are variants of .PN killpg ..PPIf the process number is \-1, and the user is the superuser,the signal is broadcast for all processesexcept to system processesand the process sending the signal..PPProcesses may send signals to themselves..SH EnvironmentSystem Five.brPOSIX.PPWhen your program is compiled in the System V or POSIX environment,a signal is sent if either the real or effective uid of the sending processmatches the real or saved-set-uid (as described in .MS execve 2 )of the receiving process. In addition, any process can use a.IR pidof \-1, and the signal is sent to all processes subject to these permission checks..PPIn POSIX mode, the.I pidargument is of type .I pid_t..SH Return ValuesUpon successful completion, a value of 0 is returned.Otherwise, a value of \-1 is returned, and.PN errnois set to indicate the error..SH DiagnosticsThe.PN killsystem call fails under the following conditions:.TP 15[EINVAL]The \fIsig\fP is not a valid signal number..TP 15[EPERM]The sending process is not the superuser, and its effectiveuser ID does not match the effective user ID of the receiving process..TP 15[ESRCH]No process can be found corresponding to that specified by \fIpid\fP..SH See Alsoexecve(2), getpgrp(2), getpid(2), killpg(2), sigvec(2), pause(3)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -