描述
此功能将信号发送到进程列表。返回成功发出信号的进程数。
如果SIGNAL为零,则没有信号发送到该进程。这是检查子进程是否仍在运行且未更改其UID的有用方法。支持的信号的精确列表完全取决于系统实现-
Name Effect SIGABRT Aborts the process SIGARLM Alarm signal SIGFPE Arithmetic exception SIGHUP Hang up. SIGILL Illegal instruction SIGINT Interrupt SIGKILL Termination signal SIGPIPE Write to a pipe with no readers. SIGQUIT Quit signal. SIGSEGV Segmentation fault SIGTERM Termination signal SIGUSER1 Application-defined signal 1 SIGUSER2 Application-defined signal 2
语法
以下是此函数的简单语法-
kill EXPR, LIST
返回值
此函数返回成功发出信号的进程数。
例
以下是显示其基本用法的示例代码-
#!/usr/bin/perl $cnt = kill 0, getppid(), getpgrp(), 2000; print "Signal sent to $cnt process\n";
执行上述代码后,将产生以下输出-
Signal sent to 2 process