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

signal.h.0p (18133B)


  1. '\" et
  2. .TH signal.h "0P" 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. signal.h
  12. \(em signals
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <signal.h>
  17. .fi
  18. .SH DESCRIPTION
  19. Some of the functionality described on this reference page extends the
  20. ISO\ C standard. Applications shall define the appropriate feature test macro
  21. (see the System Interfaces volume of POSIX.1\(hy2017,
  22. .IR "Section 2.2" ", " "The Compilation Environment")
  23. to enable the visibility of these symbols in this header.
  24. .P
  25. The
  26. .IR <signal.h>
  27. header shall define the following macros, which shall expand to constant
  28. expressions with distinct values that have a type compatible with the
  29. second argument to, and the return value of, the
  30. \fIsignal\fR()
  31. function, and whose values shall compare unequal to the address of any
  32. declarable function.
  33. .IP SIG_DFL 14
  34. Request for default signal handling.
  35. .IP SIG_ERR 14
  36. Return value from
  37. \fIsignal\fR()
  38. in case of error.
  39. .IP SIG_HOLD 14
  40. Request that signal be held.
  41. .IP SIG_IGN 14
  42. Request that signal be ignored.
  43. .P
  44. The
  45. .IR <signal.h>
  46. header shall define the
  47. .BR pthread_t ,
  48. .BR size_t ,
  49. and
  50. .BR uid_t
  51. types as described in
  52. .IR <sys/types.h> .
  53. .P
  54. The
  55. .IR <signal.h>
  56. header shall define the
  57. .BR timespec
  58. structure as described in
  59. .IR <time.h> .
  60. .P
  61. The
  62. .IR <signal.h>
  63. header shall define the following data types:
  64. .IP "\fBsig_atomic_t\fP" 14
  65. Possibly volatile-qualified integer type of an object that can be
  66. accessed as an atomic entity, even in the presence of asynchronous
  67. interrupts.
  68. .IP "\fBsigset_t\fP" 14
  69. Integer or structure type of an object used to represent sets of
  70. signals.
  71. .IP "\fBpid_t\fP" 14
  72. As described in
  73. .IR <sys/types.h> .
  74. .P
  75. The
  76. .IR <signal.h>
  77. header shall define the
  78. .BR pthread_attr_t
  79. type as described in
  80. .IR <sys/types.h> .
  81. .P
  82. The
  83. .IR <signal.h>
  84. header shall define the
  85. .BR sigevent
  86. structure, which shall include at least the following members:
  87. .sp
  88. .RS 4
  89. .nf
  90. int sigev_notify \fRNotification type.\fP
  91. int sigev_signo \fRSignal number.\fP
  92. union sigval sigev_value \fRSignal value.\fP
  93. void (*sigev_notify_function)(union sigval)
  94. \fRNotification function.\fP
  95. pthread_attr_t *sigev_notify_attributes \fRNotification attributes.\fP
  96. .fi
  97. .P
  98. .RE
  99. .P
  100. The
  101. .IR <signal.h>
  102. header shall define the following symbolic constants for the values of
  103. .IR sigev_notify :
  104. .IP SIGEV_NONE 14
  105. No asynchronous notification is delivered when the event of interest
  106. occurs.
  107. .IP SIGEV_SIGNAL 14
  108. A queued signal, with an application-defined value, is generated when
  109. the event of interest occurs.
  110. .IP SIGEV_THREAD 14
  111. A notification function is called to perform notification.
  112. .br
  113. .P
  114. The
  115. .BR sigval
  116. union shall be defined as:
  117. .sp
  118. .RS 4
  119. .nf
  120. int sival_int \fRInteger signal value.\fP
  121. void *sival_ptr \fRPointer signal value.\fP
  122. .fi
  123. .P
  124. .RE
  125. .P
  126. The
  127. .IR <signal.h>
  128. header shall declare the SIGRTMIN and SIGRTMAX macros,
  129. which shall expand to positive integer expressions with type
  130. .BR int ,
  131. but which need not be constant expressions. These macros specify a
  132. range of signal numbers that are reserved for application use and for
  133. which the realtime signal behavior specified in this volume of POSIX.1\(hy2017 is supported. The
  134. signal numbers in this range do not overlap any of the signals specified
  135. in the following table.
  136. .P
  137. The range SIGRTMIN through SIGRTMAX inclusive shall include at least
  138. {RTSIG_MAX}
  139. signal numbers.
  140. .P
  141. It is implementation-defined whether realtime signal behavior is
  142. supported for other signals.
  143. .P
  144. The
  145. .IR <signal.h>
  146. header shall define the following macros that are used to refer to the
  147. signals that occur in the system. Signals defined here begin with the
  148. letters SIG followed by an uppercase letter. The macros shall expand to
  149. positive integer constant expressions with type
  150. .BR int
  151. and distinct values. The value 0 is reserved for use as the null signal
  152. (see
  153. \fIkill\fR()).
  154. Additional implementation-defined signals may occur in the system.
  155. .P
  156. The ISO\ C standard only requires the signal names SIGABRT, SIGFPE, SIGILL,
  157. SIGINT, SIGSEGV, and SIGTERM to be defined. An implementation need
  158. not generate any of these six signals, except as a result of
  159. explicit use of interfaces that generate signals, such as
  160. \fIraise\fR(),
  161. \fIkill\fR(),
  162. the General Terminal Interface (see
  163. .IR "Section 11.1.9" ", " "Special Characters"),
  164. and the
  165. .IR kill
  166. utility, unless otherwise stated (see, for example, the System Interfaces volume of POSIX.1\(hy2017,
  167. .IR "Section 2.8.3.3" ", " "Memory Protection").
  168. .P
  169. The following signals shall be supported on all implementations
  170. (default actions are explained below the table):
  171. .TS
  172. box center tab(!);
  173. cB | cB | cB
  174. l | n | lw(3.6i).
  175. Signal!Default Action!Description
  176. _
  177. SIGABRT!A!Process abort signal.
  178. SIGALRM!T!Alarm clock.
  179. SIGBUS!A!Access to an undefined portion of a memory object.
  180. SIGCHLD!I!Child process terminated, stopped,
  181. !!or continued.
  182. SIGCONT!C!Continue executing, if stopped.
  183. SIGFPE!A!Erroneous arithmetic operation.
  184. SIGHUP!T!Hangup.
  185. SIGILL!A!Illegal instruction.
  186. SIGINT!T!Terminal interrupt signal.
  187. SIGKILL!T!Kill (cannot be caught or ignored).
  188. SIGPIPE!T!Write on a pipe with no one to read it.
  189. SIGQUIT!A!Terminal quit signal.
  190. SIGSEGV!A!Invalid memory reference.
  191. SIGSTOP!S!Stop executing (cannot be caught or ignored).
  192. SIGTERM!T!Termination signal.
  193. SIGTSTP!S!Terminal stop signal.
  194. SIGTTIN!S!Background process attempting read.
  195. SIGTTOU!S!Background process attempting write.
  196. SIGUSR1!T!User-defined signal 1.
  197. SIGUSR2!T!User-defined signal 2.
  198. SIGPOLL!T!Pollable event.
  199. SIGPROF!T!Profiling timer expired.
  200. SIGSYS!A!Bad system call.
  201. SIGTRAP!A!Trace/breakpoint trap.
  202. SIGURG!I!High bandwidth data is available at a socket.
  203. SIGVTALRM!T!Virtual timer expired.
  204. SIGXCPU!A!CPU time limit exceeded.
  205. SIGXFSZ!A!File size limit exceeded.
  206. .sp
  207. .TE
  208. .br
  209. .P
  210. The default actions are as follows:
  211. .IP T 6
  212. Abnormal termination of the process.
  213. .IP A 6
  214. Abnormal termination of the process
  215. with additional actions.
  216. .IP I 6
  217. Ignore the signal.
  218. .IP S 6
  219. Stop the process.
  220. .IP C 6
  221. Continue the process, if it is stopped; otherwise, ignore the signal.
  222. .P
  223. The effects on the process in each case are described in the System Interfaces volume of POSIX.1\(hy2017,
  224. .IR "Section 2.4.3" ", " "Signal Actions".
  225. .P
  226. The
  227. .IR <signal.h>
  228. header shall declare the
  229. .BR sigaction
  230. structure, which shall include at least the following members:
  231. .sp
  232. .RS 4
  233. .nf
  234. void (*sa_handler)(int) \fRPointer to a signal-catching function\fR
  235. \fRor one of the SIG_IGN or SIG_DFL.\fR
  236. sigset_t sa_mask \fRSet of signals to be blocked during execution\fR
  237. \fRof the signal handling function.\fR
  238. int sa_flags \fRSpecial flags.\fR
  239. void (*sa_sigaction)(int, siginfo_t *, void *)
  240. \fRPointer to a signal-catching function.\fR
  241. .fi
  242. .P
  243. .RE
  244. .P
  245. The storage occupied by
  246. .IR sa_handler
  247. and
  248. .IR sa_sigaction
  249. may overlap, and a conforming application shall not use both
  250. simultaneously.
  251. .P
  252. The
  253. .IR <signal.h>
  254. header shall define the following macros which shall expand to
  255. integer constant expressions that need not be usable in
  256. .BR #if
  257. preprocessing directives:
  258. .IP SIG_BLOCK 14
  259. The resulting set is the union of the current set and the signal set
  260. pointed to by the argument
  261. .IR set .
  262. .IP SIG_UNBLOCK 14
  263. The resulting set is the intersection of the current set and the
  264. complement of the signal set pointed to by the argument
  265. .IR set .
  266. .IP SIG_SETMASK 14
  267. The resulting set is the signal set pointed to by the argument
  268. .IR set .
  269. .P
  270. The
  271. .IR <signal.h>
  272. header shall also define the following symbolic constants:
  273. .IP SA_NOCLDSTOP 14
  274. Do not generate SIGCHLD when children stop
  275. .br
  276. or stopped children continue.
  277. .IP SA_ONSTACK 14
  278. Causes signal delivery to occur on an alternate stack.
  279. .IP SA_RESETHAND 14
  280. Causes signal dispositions to be set to SIG_DFL on entry to signal
  281. handlers.
  282. .IP SA_RESTART 14
  283. Causes certain functions to become restartable.
  284. .IP SA_SIGINFO 14
  285. Causes extra information to be passed to signal handlers at the time of
  286. receipt of a signal.
  287. .IP SA_NOCLDWAIT 14
  288. Causes implementations not to create zombie processes or status
  289. information on child termination. See
  290. .IR "\fIsigaction\fR\^(\|)".
  291. .IP SA_NODEFER 14
  292. Causes signal not to be automatically blocked on entry to signal handler.
  293. .IP SS_ONSTACK 14
  294. Process is executing on an alternate signal stack.
  295. .IP SS_DISABLE 14
  296. Alternate signal stack is disabled.
  297. .IP MINSIGSTKSZ 14
  298. Minimum stack size for a signal handler.
  299. .IP SIGSTKSZ 14
  300. Default size in bytes for the alternate signal stack.
  301. .P
  302. The
  303. .IR <signal.h>
  304. header shall define the
  305. .BR mcontext_t
  306. type through
  307. .BR typedef .
  308. .P
  309. The
  310. .IR <signal.h>
  311. header shall define the
  312. .BR ucontext_t
  313. type as a structure that shall include at least the following members:
  314. .sp
  315. .RS 4
  316. .nf
  317. ucontext_t *uc_link \fRPointer to the context that is resumed\fR
  318. \fRwhen this context returns.\fR
  319. sigset_t uc_sigmask \fRThe set of signals that are blocked when this\fR
  320. \fRcontext is active.\fR
  321. stack_t uc_stack \fRThe stack used by this context.\fR
  322. mcontext_t uc_mcontext \fRA machine-specific representation of the saved\fR
  323. \fRcontext.\fR
  324. .fi
  325. .P
  326. .RE
  327. .P
  328. The
  329. .IR <signal.h>
  330. header shall define the
  331. .BR stack_t
  332. type as a structure, which shall include at least the following members:
  333. .sp
  334. .RS 4
  335. .nf
  336. void *ss_sp \fRStack base or pointer.\fR
  337. size_t ss_size \fRStack size.\fR
  338. int ss_flags \fRFlags.\fR
  339. .fi
  340. .P
  341. .RE
  342. .P
  343. The
  344. .IR <signal.h>
  345. header shall define the
  346. .BR siginfo_t
  347. type as a structure, which shall include at least the following members:
  348. .sp
  349. .RS 4
  350. .nf
  351. int si_signo \fRSignal number.\fR
  352. int si_code \fRSignal code.\fR
  353. int si_errno \fRIf non-zero, an \fIerrno\fR value associated with\fR
  354. \fRthis signal, as described in \fB<errno.h>\fR.\fR
  355. pid_t si_pid \fRSending process ID.\fR
  356. uid_t si_uid \fRReal user ID of sending process.\fR
  357. void *si_addr \fRAddress of faulting instruction.\fR
  358. int si_status \fRExit value or signal.\fR
  359. long si_band \fRBand event for SIGPOLL.\fR
  360. union sigval si_value \fRSignal value.\fR
  361. .fi
  362. .P
  363. .RE
  364. .P
  365. The
  366. .IR <signal.h>
  367. header shall define the symbolic constants in the
  368. .BR Code
  369. column of the following table for use as values of
  370. .IR si_code
  371. that are signal-specific or non-signal-specific reasons why the
  372. signal was generated.
  373. .TS
  374. box center tab(!);
  375. cB | cB | cB
  376. l1 | l1 | l.
  377. Signal!Code!Reason
  378. _
  379. SIGILL!ILL_ILLOPC!Illegal opcode.
  380. !ILL_ILLOPN!Illegal operand.
  381. !ILL_ILLADR!Illegal addressing mode.
  382. !ILL_ILLTRP!Illegal trap.
  383. !ILL_PRVOPC!Privileged opcode.
  384. !ILL_PRVREG!Privileged register.
  385. !ILL_COPROC!Coprocessor error.
  386. !ILL_BADSTK!Internal stack error.
  387. _
  388. SIGFPE!FPE_INTDIV!Integer divide by zero.
  389. !FPE_INTOVF!Integer overflow.
  390. !FPE_FLTDIV!Floating-point divide by zero.
  391. !FPE_FLTOVF!Floating-point overflow.
  392. !FPE_FLTUND!Floating-point underflow.
  393. !FPE_FLTRES!Floating-point inexact result.
  394. !FPE_FLTINV!Invalid floating-point operation.
  395. !FPE_FLTSUB!Subscript out of range.
  396. _
  397. SIGSEGV!SEGV_MAPERR!Address not mapped to object.
  398. !SEGV_ACCERR!Invalid permissions for mapped object.
  399. _
  400. SIGBUS!BUS_ADRALN!Invalid address alignment.
  401. !BUS_ADRERR!Nonexistent physical address.
  402. !BUS_OBJERR!Object-specific hardware error.
  403. _
  404. SIGTRAP!TRAP_BRKPT!Process breakpoint.
  405. !TRAP_TRACE!Process trace trap.
  406. _
  407. SIGCHLD!CLD_EXITED!Child has exited.
  408. !CLD_KILLED!Child has terminated abnormally and did not create a \fBcore\fP file.
  409. !CLD_DUMPED!Child has terminated abnormally and created a \fBcore\fP file.
  410. !CLD_TRAPPED!Traced child has trapped.
  411. !CLD_STOPPED!Child has stopped.
  412. !CLD_CONTINUED!Stopped child has continued.
  413. _
  414. SIGPOLL!POLL_IN!Data input available.
  415. !POLL_OUT!Output buffers available.
  416. !POLL_MSG!Input message available.
  417. !POLL_ERR!I/O error.
  418. !POLL_PRI!High priority input available.
  419. !POLL_HUP!Device disconnected.
  420. _
  421. Any!SI_USER!Signal sent by \fIkill\fP\^(\|).
  422. !SI_QUEUE!Signal sent by \fIsigqueue\fP\^(\|).
  423. !SI_TIMER!Signal generated by expiration of a timer set by \fItimer_settime\fP\^(\|).
  424. !SI_ASYNCIO!Signal generated by completion of an asynchronous I/O
  425. !!request.
  426. !SI_MESGQ!Signal generated by arrival of a message on an empty message
  427. !!queue.
  428. .TE
  429. .P
  430. Implementations may support additional
  431. .IR si_code
  432. values not included in this list, may generate values included in this
  433. list under circumstances other than those described in this list, and
  434. may contain extensions or limitations that prevent some values from
  435. being generated. Implementations do not generate a different value from
  436. the ones described in this list for circumstances described in this
  437. list.
  438. .br
  439. .P
  440. In addition, the following signal-specific information shall be
  441. available:
  442. .TS
  443. box center tab(!);
  444. cB | cB | cB
  445. l | lB | lw(3.9i).
  446. Signal!Member!Value
  447. _
  448. SIGILL!void * \fIsi_addr\fP!Address of faulting instruction.
  449. SIGFPE
  450. _
  451. SIGSEGV!void * \fIsi_addr\fP!Address of faulting memory reference.
  452. SIGBUS
  453. _
  454. SIGCHLD!pid_t \fIsi_pid\fP!Child process ID.
  455. !int \fIsi_status\fP!T{
  456. If
  457. .IR si_code
  458. is equal to CLD_EXITED, then
  459. .IR si_status
  460. holds the exit value of the process; otherwise, it is equal to the
  461. signal that caused the process to change state. The exit value in
  462. .IR si_status
  463. shall be equal to the full exit value (that is, the value passed to
  464. \fI_exit\fR(),
  465. \fI_Exit\fR(),
  466. or
  467. \fIexit\fR(),
  468. or returned from
  469. \fImain\fR());
  470. it shall not be limited to the least significant eight bits of the value.
  471. T}
  472. !uid_t \fIsi_uid\fP!Real user ID of the process that sent the signal.
  473. _
  474. SIGPOLL!long \fIsi_band\fP!Band event for POLL_IN, POLL_OUT, or POLL_MSG.
  475. .TE
  476. .P
  477. For some implementations, the value of \fIsi_addr\fR may be inaccurate.
  478. .P
  479. The following shall be declared as functions and may also be defined as
  480. macros. Function prototypes shall be provided.
  481. .sp
  482. .RS 4
  483. .nf
  484. int kill(pid_t, int);
  485. int killpg(pid_t, int);
  486. void psiginfo(const siginfo_t *, const char *);
  487. void psignal(int, const char *);
  488. int pthread_kill(pthread_t, int);
  489. int pthread_sigmask(int, const sigset_t *restrict,
  490. sigset_t *restrict);
  491. int raise(int);
  492. int sigaction(int, const struct sigaction *restrict,
  493. struct sigaction *restrict);
  494. int sigaddset(sigset_t *, int);
  495. int sigaltstack(const stack_t *restrict, stack_t *restrict);
  496. int sigdelset(sigset_t *, int);
  497. int sigemptyset(sigset_t *);
  498. int sigfillset(sigset_t *);
  499. int sighold(int);
  500. int sigignore(int);
  501. int siginterrupt(int, int);
  502. int sigismember(const sigset_t *, int);
  503. void (*signal(int, void (*)(int)))(int);
  504. int sigpause(int);
  505. int sigpending(sigset_t *);
  506. int sigprocmask(int, const sigset_t *restrict, sigset_t *restrict);
  507. int sigqueue(pid_t, int, union sigval);
  508. int sigrelse(int);
  509. void (*sigset(int, void (*)(int)))(int);
  510. int sigsuspend(const sigset_t *);
  511. int sigtimedwait(const sigset_t *restrict, siginfo_t *restrict,
  512. const struct timespec *restrict);
  513. int sigwait(const sigset_t *restrict, int *restrict);
  514. int sigwaitinfo(const sigset_t *restrict, siginfo_t *restrict);
  515. .fi
  516. .P
  517. .RE
  518. .P
  519. Inclusion of the
  520. .IR <signal.h>
  521. header may make visible all symbols from the
  522. .IR <time.h>
  523. header.
  524. .LP
  525. .IR "The following sections are informative."
  526. .SH "APPLICATION USAGE"
  527. On systems not supporting the XSI option, the
  528. .IR si_pid
  529. and
  530. .IR si_uid
  531. members of
  532. .BR siginfo_t
  533. are only required to be valid when
  534. .IR si_code
  535. is SI_USER or SI_QUEUE. On XSI-conforming systems, they are also
  536. valid for all
  537. .IR si_code
  538. values less than or equal to 0; however, it is unspecified whether
  539. SI_USER and SI_QUEUE have values less than or equal to zero, and
  540. therefore XSI applications should check whether
  541. .IR si_code
  542. has the value SI_USER or SI_QUEUE or is less than or equal to 0
  543. to tell whether
  544. .IR si_pid
  545. and
  546. .IR si_uid
  547. are valid.
  548. .SH RATIONALE
  549. None.
  550. .SH "FUTURE DIRECTIONS"
  551. The SIGPOLL and SIGPROF signals may be removed in a future version.
  552. .SH "SEE ALSO"
  553. .IR "\fB<errno.h>\fP",
  554. .IR "\fB<stropts.h>\fP",
  555. .IR "\fB<sys_types.h>\fP",
  556. .IR "\fB<time.h>\fP"
  557. .P
  558. .ad l
  559. The System Interfaces volume of POSIX.1\(hy2017,
  560. .IR "Section 2.2" ", " "The Compilation Environment",
  561. .IR "\fIalarm\fR\^(\|)",
  562. .IR "\fIioctl\fR\^(\|)",
  563. .IR "\fIkill\fR\^(\|)",
  564. .IR "\fIkillpg\fR\^(\|)",
  565. .IR "\fIpsiginfo\fR\^(\|)",
  566. .IR "\fIpthread_kill\fR\^(\|)",
  567. .IR "\fIpthread_sigmask\fR\^(\|)",
  568. .IR "\fIraise\fR\^(\|)",
  569. .IR "\fIsigaction\fR\^(\|)",
  570. .IR "\fIsigaddset\fR\^(\|)",
  571. .IR "\fIsigaltstack\fR\^(\|)",
  572. .IR "\fIsigdelset\fR\^(\|)",
  573. .IR "\fIsigemptyset\fR\^(\|)",
  574. .IR "\fIsigfillset\fR\^(\|)",
  575. .IR "\fIsighold\fR\^(\|)",
  576. .IR "\fIsiginterrupt\fR\^(\|)",
  577. .IR "\fIsigismember\fR\^(\|)",
  578. .IR "\fIsignal\fR\^(\|)",
  579. .IR "\fIsigpending\fR\^(\|)",
  580. .IR "\fIsigqueue\fR\^(\|)",
  581. .IR "\fIsigsuspend\fR\^(\|)",
  582. .IR "\fIsigtimedwait\fR\^(\|)",
  583. .IR "\fIsigwait\fR\^(\|)",
  584. .IR "\fItimer_create\fR\^(\|)",
  585. .IR "\fIwait\fR\^(\|)",
  586. .IR "\fIwaitid\fR\^(\|)"
  587. .ad b
  588. .P
  589. The Shell and Utilities volume of POSIX.1\(hy2017,
  590. .IR "\fIkill\fR\^"
  591. .\"
  592. .SH COPYRIGHT
  593. Portions of this text are reprinted and reproduced in electronic form
  594. from IEEE Std 1003.1-2017, Standard for Information Technology
  595. -- Portable Operating System Interface (POSIX), The Open Group Base
  596. Specifications Issue 7, 2018 Edition,
  597. Copyright (C) 2018 by the Institute of
  598. Electrical and Electronics Engineers, Inc and The Open Group.
  599. In the event of any discrepancy between this version and the original IEEE and
  600. The Open Group Standard, the original IEEE and The Open Group Standard
  601. is the referee document. The original Standard can be obtained online at
  602. http://www.opengroup.org/unix/online.html .
  603. .PP
  604. Any typographical or formatting errors that appear
  605. in this page are most likely
  606. to have been introduced during the conversion of the source files to
  607. man page format. To report such errors, see
  608. https://www.kernel.org/doc/man-pages/reporting_bugs.html .