logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

kill.1p (12314B)


  1. '\" et
  2. .TH KILL "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. kill
  12. \(em terminate or signal processes
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. kill -s \fIsignal_name pid\fR...
  17. .P
  18. kill -l \fB[\fIexit_status\fB]\fR
  19. .P
  20. kill \fB[\fR-\fIsignal_name\fB] \fIpid\fR...
  21. .P
  22. kill \fB[\fR-\fIsignal_number\fB] \fIpid\fR...
  23. .fi
  24. .SH DESCRIPTION
  25. The
  26. .IR kill
  27. utility shall send a signal to the process or processes specified by
  28. each
  29. .IR pid
  30. operand.
  31. .P
  32. For each
  33. .IR pid
  34. operand, the
  35. .IR kill
  36. utility shall perform actions equivalent to the
  37. \fIkill\fR()
  38. function defined in the System Interfaces volume of POSIX.1\(hy2017 called with the following arguments:
  39. .IP " *" 4
  40. The value of the
  41. .IR pid
  42. operand shall be used as the
  43. .IR pid
  44. argument.
  45. .IP " *" 4
  46. The
  47. .IR sig
  48. argument is the value specified by the
  49. .BR \-s
  50. option,
  51. .BR \- \c
  52. .IR signal_number
  53. option, or the
  54. .BR \- \c
  55. .IR signal_name
  56. option, or by SIGTERM, if none of these options is specified.
  57. .SH OPTIONS
  58. The
  59. .IR kill
  60. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  61. .IR "Section 12.2" ", " "Utility Syntax Guidelines",
  62. except that in the last two SYNOPSIS forms, the
  63. .BR \- \c
  64. .IR signal_number
  65. and
  66. .BR \- \c
  67. .IR signal_name
  68. options are usually more than a single character.
  69. .P
  70. The following options shall be supported:
  71. .IP "\fB\-l\fP" 10
  72. (The letter ell.) Write all values of
  73. .IR signal_name
  74. supported by the implementation, if no operand is given. If an
  75. .IR exit_status
  76. operand is given and it is a value of the
  77. .BR '?'
  78. shell special parameter (see
  79. .IR "Section 2.5.2" ", " "Special Parameters"
  80. and
  81. .IR wait )
  82. corresponding to a process that was terminated by a signal, the
  83. .IR signal_name
  84. corresponding to the signal that terminated the process shall be
  85. written. If an
  86. .IR exit_status
  87. operand is given and it is the unsigned decimal integer value of a
  88. signal number, the
  89. .IR signal_name
  90. (the symbolic constant name without the
  91. .BR SIG
  92. prefix defined in the Base Definitions volume of POSIX.1\(hy2017) corresponding to that signal shall be
  93. written. Otherwise, the results are unspecified.
  94. .IP "\fB\-s\ \fIsignal_name\fR" 10
  95. .br
  96. Specify the signal to send, using one of the symbolic names defined in
  97. the
  98. .IR <signal.h>
  99. header. Values of
  100. .IR signal_name
  101. shall be recognized in a case-independent fashion, without the
  102. .BR SIG
  103. prefix. In addition, the symbolic name 0 shall be recognized,
  104. representing the signal value zero. The corresponding signal shall be
  105. sent instead of SIGTERM.
  106. .IP "\fB\-\fIsignal_name\fR" 10
  107. .br
  108. Equivalent to
  109. .BR \-s
  110. .IR signal_name .
  111. .IP "\fB\-\fIsignal_number\fR" 10
  112. .br
  113. Specify a non-negative decimal integer,
  114. .IR signal_number ,
  115. representing the signal to be used instead of SIGTERM, as the
  116. .IR sig
  117. argument in the effective call to
  118. \fIkill\fR().
  119. The correspondence between integer values and the
  120. .IR sig
  121. value used is shown in the following list.
  122. .RS 10
  123. .P
  124. The effects of specifying any
  125. .IR signal_number
  126. other than those listed below are undefined.
  127. .IP 0 6
  128. 0
  129. .IP 1 6
  130. SIGHUP
  131. .IP 2 6
  132. SIGINT
  133. .IP 3 6
  134. SIGQUIT
  135. .IP 6 6
  136. SIGABRT
  137. .IP 9 6
  138. SIGKILL
  139. .IP 14 6
  140. SIGALRM
  141. .IP 15 6
  142. SIGTERM
  143. .P
  144. If the first argument is a negative integer, it shall be interpreted as a
  145. .BR \- \c
  146. .IR signal_number
  147. option, not as a negative
  148. .IR pid
  149. operand specifying a process group.
  150. .RE
  151. .SH OPERANDS
  152. The following operands shall be supported:
  153. .IP "\fIpid\fR" 10
  154. One of the following:
  155. .RS 10
  156. .IP " 1." 4
  157. A decimal integer specifying a process or process group to be signaled.
  158. The process or processes selected by positive, negative, and zero
  159. values of the
  160. .IR pid
  161. operand shall be as described for the
  162. \fIkill\fR()
  163. function. If process number 0 is specified, all processes in the
  164. current process group shall be signaled. For the effects of negative
  165. .IR pid
  166. numbers, see the
  167. \fIkill\fR()
  168. function defined in the System Interfaces volume of POSIX.1\(hy2017. If the first
  169. .IR pid
  170. operand is negative, it should be preceded by
  171. .BR \(dq--\(dq
  172. to keep it from being interpreted as an option.
  173. .IP " 2." 4
  174. A job control job ID (see the Base Definitions volume of POSIX.1\(hy2017,
  175. .IR "Section 3.204" ", " "Job Control Job ID")
  176. that identifies a background process group to be signaled. The job
  177. control job ID notation is applicable only for invocations of
  178. .IR kill
  179. in the current shell execution environment; see
  180. .IR "Section 2.12" ", " "Shell Execution Environment".
  181. .RE
  182. .IP "\fIexit_status\fR" 10
  183. A decimal integer specifying a signal number or the exit status of a
  184. process terminated by a signal.
  185. .SH STDIN
  186. Not used.
  187. .SH "INPUT FILES"
  188. None.
  189. .SH "ENVIRONMENT VARIABLES"
  190. The following environment variables shall affect the execution of
  191. .IR kill :
  192. .IP "\fILANG\fP" 10
  193. Provide a default value for the internationalization variables that are
  194. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  195. .IR "Section 8.2" ", " "Internationalization Variables"
  196. for the precedence of internationalization variables used to determine
  197. the values of locale categories.)
  198. .IP "\fILC_ALL\fP" 10
  199. If set to a non-empty string value, override the values of all the
  200. other internationalization variables.
  201. .IP "\fILC_CTYPE\fP" 10
  202. Determine the locale for the interpretation of sequences of bytes of
  203. text data as characters (for example, single-byte as opposed to
  204. multi-byte characters in arguments).
  205. .IP "\fILC_MESSAGES\fP" 10
  206. .br
  207. Determine the locale that should be used to affect the format and
  208. contents of diagnostic messages written to standard error.
  209. .IP "\fINLSPATH\fP" 10
  210. Determine the location of message catalogs for the processing of
  211. .IR LC_MESSAGES .
  212. .SH "ASYNCHRONOUS EVENTS"
  213. Default.
  214. .SH STDOUT
  215. When the
  216. .BR \-l
  217. option is not specified, the standard output shall not be used.
  218. .P
  219. When the
  220. .BR \-l
  221. option is specified, the symbolic name of each signal shall be written
  222. in the following format:
  223. .sp
  224. .RS 4
  225. .nf
  226. "%s%c", <\fIsignal_name\fR>, <\fIseparator\fR>
  227. .fi
  228. .P
  229. .RE
  230. .P
  231. where the <\fIsignal_name\fP> is in uppercase, without the
  232. .BR SIG
  233. prefix, and the <\fIseparator\fP> shall be either a
  234. <newline>
  235. or a
  236. <space>.
  237. For the last signal written, <\fIseparator\fP> shall be a
  238. <newline>.
  239. .P
  240. When both the
  241. .BR \-l
  242. option and
  243. .IR exit_status
  244. operand are specified, the symbolic name of the corresponding signal
  245. shall be written in the following format:
  246. .sp
  247. .RS 4
  248. .nf
  249. "%s\en", <\fIsignal_name\fR>
  250. .fi
  251. .P
  252. .RE
  253. .SH STDERR
  254. The standard error shall be used only for diagnostic messages.
  255. .SH "OUTPUT FILES"
  256. None.
  257. .SH "EXTENDED DESCRIPTION"
  258. None.
  259. .SH "EXIT STATUS"
  260. The following exit values shall be returned:
  261. .IP "\00" 6
  262. At least one matching process was found for each
  263. .IR pid
  264. operand, and the specified signal was successfully processed for at
  265. least one matching process.
  266. .IP >0 6
  267. An error occurred.
  268. .SH "CONSEQUENCES OF ERRORS"
  269. Default.
  270. .LP
  271. .IR "The following sections are informative."
  272. .SH "APPLICATION USAGE"
  273. Process numbers can be found by using
  274. .IR ps .
  275. .P
  276. The job control job ID notation is not required to work as expected
  277. when
  278. .IR kill
  279. is operating in its own utility execution environment. In either of
  280. the following examples:
  281. .sp
  282. .RS 4
  283. .nf
  284. nohup kill %1 &
  285. system("kill %1");
  286. .fi
  287. .P
  288. .RE
  289. .P
  290. the
  291. .IR kill
  292. operates in a different environment and does not share the shell's
  293. understanding of job numbers.
  294. .SH EXAMPLES
  295. Any of the commands:
  296. .sp
  297. .RS 4
  298. .nf
  299. kill -9 100 -165
  300. kill -s kill 100 -165
  301. kill -s KILL 100 -165
  302. .fi
  303. .P
  304. .RE
  305. .P
  306. sends the SIGKILL signal to the process whose process ID is 100 and to
  307. all processes whose process group ID is 165, assuming the sending
  308. process has permission to send that signal to the specified processes,
  309. and that they exist.
  310. .P
  311. The System Interfaces volume of POSIX.1\(hy2017 and this volume of POSIX.1\(hy2017 do not require specific signal numbers for any
  312. .IR signal_names .
  313. Even the
  314. .BR \- \c
  315. .IR signal_number
  316. option provides symbolic (although numeric) names for signals. If a
  317. process is terminated by a signal, its exit status indicates the signal
  318. that killed it, but the exact values are not specified. The
  319. .IR kill
  320. .BR \-l
  321. option, however, can be used to map decimal signal numbers and exit
  322. status values into the name of a signal. The following example reports
  323. the status of a terminated job:
  324. .sp
  325. .RS 4
  326. .nf
  327. job
  328. stat=$?
  329. if [ $stat -eq 0 ]
  330. then
  331. echo job completed successfully.
  332. elif [ $stat -gt 128 ]
  333. then
  334. echo job terminated by signal SIG$(kill -l $stat).
  335. else
  336. echo job terminated with error code $stat.
  337. fi
  338. .fi
  339. .P
  340. .RE
  341. .P
  342. To send the default signal to a process group (say 123), an application
  343. should use a command similar to one of the following:
  344. .sp
  345. .RS 4
  346. .nf
  347. kill -TERM -123
  348. kill -- -123
  349. .fi
  350. .P
  351. .RE
  352. .SH RATIONALE
  353. The
  354. .BR \-l
  355. option originated from the C shell, and is also implemented in the
  356. KornShell. The C shell output can consist of multiple output lines
  357. because the signal names do not always fit on a single line on some
  358. terminal screens. The KornShell output also included the
  359. implementation-defined signal numbers and was considered by the
  360. standard developers to be too difficult for scripts to parse
  361. conveniently. The specified output format is intended not only to
  362. accommodate the historical C shell output, but also to permit an
  363. entirely vertical or entirely horizontal listing on systems for which
  364. this is appropriate.
  365. .P
  366. An early proposal invented the name SIGNULL as a
  367. .IR signal_name
  368. for signal 0 (used by the System Interfaces volume of POSIX.1\(hy2017 to test for the existence of a process
  369. without sending it a signal). Since the
  370. .IR signal_name
  371. 0 can be used in this case unambiguously, SIGNULL has been removed.
  372. .P
  373. An early proposal also required symbolic
  374. .IR signal_name s
  375. to be recognized with or without the
  376. .BR SIG
  377. prefix. Historical versions of
  378. .IR kill
  379. have not written the
  380. .BR SIG
  381. prefix for the
  382. .BR \-l
  383. option and have not recognized the
  384. .BR SIG
  385. prefix on
  386. .IR signal_name s.
  387. Since neither applications portability nor ease-of-use would be improved
  388. by requiring this extension, it is no longer required.
  389. .P
  390. To avoid an ambiguity of an initial negative number argument specifying
  391. either a signal number or a process group, POSIX.1\(hy2008 mandates that it is
  392. always considered the former by implementations that support the XSI
  393. option. It also requires that conforming applications always use the
  394. .BR \(dq--\(dq
  395. options terminator argument when specifying a process group, unless an
  396. option is also specified.
  397. .P
  398. The
  399. .BR \-s
  400. option was added in response to international interest in providing
  401. some form of
  402. .IR kill
  403. that meets the Utility Syntax Guidelines.
  404. .P
  405. The job control job ID notation is not required to work as expected
  406. when
  407. .IR kill
  408. is operating in its own utility execution environment. In either of
  409. the following examples:
  410. .sp
  411. .RS 4
  412. .nf
  413. nohup kill %1 &
  414. system("kill %1");
  415. .fi
  416. .P
  417. .RE
  418. .P
  419. the
  420. .IR kill
  421. operates in a different environment and does not understand how the
  422. shell has managed its job numbers.
  423. .SH "FUTURE DIRECTIONS"
  424. None.
  425. .SH "SEE ALSO"
  426. .IR "Chapter 2" ", " "Shell Command Language",
  427. .IR "\fIps\fR\^",
  428. .IR "\fIwait\fR\^"
  429. .P
  430. The Base Definitions volume of POSIX.1\(hy2017,
  431. .IR "Section 3.204" ", " "Job Control Job ID",
  432. .IR "Chapter 8" ", " "Environment Variables",
  433. .IR "Section 12.2" ", " "Utility Syntax Guidelines",
  434. .IR "\fB<signal.h>\fP"
  435. .P
  436. The System Interfaces volume of POSIX.1\(hy2017,
  437. .IR "\fIkill\fR\^(\|)"
  438. .\"
  439. .SH COPYRIGHT
  440. Portions of this text are reprinted and reproduced in electronic form
  441. from IEEE Std 1003.1-2017, Standard for Information Technology
  442. -- Portable Operating System Interface (POSIX), The Open Group Base
  443. Specifications Issue 7, 2018 Edition,
  444. Copyright (C) 2018 by the Institute of
  445. Electrical and Electronics Engineers, Inc and The Open Group.
  446. In the event of any discrepancy between this version and the original IEEE and
  447. The Open Group Standard, the original IEEE and The Open Group Standard
  448. is the referee document. The original Standard can be obtained online at
  449. http://www.opengroup.org/unix/online.html .
  450. .PP
  451. Any typographical or formatting errors that appear
  452. in this page are most likely
  453. to have been introduced during the conversion of the source files to
  454. man page format. To report such errors, see
  455. https://www.kernel.org/doc/man-pages/reporting_bugs.html .