File: signal.h.0p

package info (click to toggle)
manpages-posix 1.67-3
  • links: PTS
  • area: non-free
  • in suites: sarge
  • size: 9,564 kB
  • ctags: 6
  • sloc: makefile: 69; sh: 37
file content (788 lines) | stat: -rw-r--r-- 15,754 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "<signal.h>" P 2003 POSIX
.\" <signal.h> 
.SH NAME
signal.h \- signals
.SH SYNOPSIS
.LP
\fB#include <signal.h>\fP
.SH DESCRIPTION
.LP
Some of the functionality described on this reference page extends
the ISO\ C standard. Applications shall define
the appropriate feature test macro (see the System Interfaces volume
of IEEE\ Std\ 1003.1-2001, Section 2.2, The Compilation Environment)
to enable the visibility of these symbols in this
header. 
.LP
The \fI<signal.h>\fP header shall define the following symbolic constants,
each of which expands to a distinct constant
expression of the type:
.sp
.RS
.nf

\fBvoid (*)(int)
\fP
.fi
.RE
.LP
whose value matches no declarable function.
.TP 7
SIG_DFL
Request for default signal handling.
.TP 7
SIG_ERR
Return value from \fIsignal\fP() in case of error.
.TP 7
SIG_HOLD
Request that signal be held. 
.TP 7
SIG_IGN
Request that signal be ignored.
.sp
.LP
The following data types shall be defined through \fBtypedef\fP:
.TP 7
\fBsig_atomic_t\fP
Possibly volatile-qualified integer type of an object that can be
accessed as an atomic entity, even in the presence of
asynchronous interrupts.
.TP 7
\fBsigset_t\fP
Integer or structure type of an object used to represent sets of signals.
.TP 7
\fBpid_t\fP
As
described in \fI<sys/types.h>\fP . 
.sp
.LP
The \fI<signal.h>\fP header shall define the \fBsigevent\fP structure,
which has at least the following members:
.sp
.RS
.nf

\fBint                    sigev_notify           \fP Notification type. \fB
int                    sigev_signo            \fP Signal number. \fB
union sigval           sigev_value            \fP Signal value. \fB
void(*)(union sigval)  sigev_notify_function  \fP Notification function. \fB
(pthread_attr_t *)     sigev_notify_attributes\fP Notification attributes. \fB
\fP
.fi
.RE
.LP
The following values of \fIsigev_notify\fP shall be defined:
.TP 7
SIGEV_NONE
No asynchronous notification is delivered when the event of interest
occurs.
.TP 7
SIGEV_SIGNAL
A queued signal, with an application-defined value, is generated when
the event of interest occurs.
.TP 7
SIGEV_THREAD
A notification function is called to perform notification.
.sp
.LP
The \fBsigval\fP union shall be defined as:
.sp
.RS
.nf

\fBint    sival_int   \fP Integer signal value. \fB
void  *sival_ptr   \fP Pointer signal value. \fB
\fP
.fi
.RE
.LP
This header shall also declare the macros SIGRTMIN and SIGRTMAX, which
evaluate to integer expressions, and specify a range of
signal numbers that are reserved for application use and for which
the realtime signal behavior specified in this volume of
IEEE\ Std\ 1003.1-2001 is supported. The signal numbers in this range
do not overlap any of the signals specified in the
following table.
.LP
The range SIGRTMIN through SIGRTMAX inclusive shall include at least
{RTSIG_MAX} signal numbers.
.LP
It is implementation-defined whether realtime signal behavior is supported
for other signals. 
.LP
This header also declares the constants that are used to refer to
the signals that occur in the system. Signals defined here
begin with the letters SIG. Each of the signals have distinct positive
integer values. The value 0 is reserved for use as the null
signal (see \fIkill\fP()). Additional implementation-defined signals
may occur in the
system.
.LP
The
ISO\ C standard only requires the signal names SIGABRT, SIGFPE, SIGILL,
SIGINT, SIGSEGV, and SIGTERM to be defined. 
.LP
The following signals shall be supported on all implementations (default
actions are explained below the table):
.TS C
center; l1 l1 lw(40).
\fBSignal\fP	\fBDefault Action\fP	T{
.na
\fBDescription\fP
.ad
T}
SIGABRT	A	T{
.na
Process abort signal.
.ad
T}
SIGALRM	T	T{
.na
Alarm clock.
.ad
T}
SIGBUS	A	T{
.na
Access to an undefined portion of a memory object.
.ad
T}
SIGCHLD	I	T{
.na
Child process terminated, stopped,
.ad
T}
\ 	\ 	T{
.na
or continued.
.ad
T}
SIGCONT	C	T{
.na
Continue executing, if stopped.
.ad
T}
SIGFPE	A	T{
.na
Erroneous arithmetic operation.
.ad
T}
SIGHUP	T	T{
.na
Hangup.
.ad
T}
SIGILL	A	T{
.na
Illegal instruction.
.ad
T}
SIGINT	T	T{
.na
Terminal interrupt signal.
.ad
T}
SIGKILL	T	T{
.na
Kill (cannot be caught or ignored).
.ad
T}
SIGPIPE	T	T{
.na
Write on a pipe with no one to read it.
.ad
T}
SIGQUIT	A	T{
.na
Terminal quit signal.
.ad
T}
SIGSEGV	A	T{
.na
Invalid memory reference.
.ad
T}
SIGSTOP	S	T{
.na
Stop executing (cannot be caught or ignored).
.ad
T}
SIGTERM	T	T{
.na
Termination signal.
.ad
T}
SIGTSTP	S	T{
.na
Terminal stop signal.
.ad
T}
SIGTTIN	S	T{
.na
Background process attempting read.
.ad
T}
SIGTTOU	S	T{
.na
Background process attempting write.
.ad
T}
SIGUSR1	T	T{
.na
User-defined signal 1.
.ad
T}
SIGUSR2	T	T{
.na
User-defined signal 2.
.ad
T}
SIGPOLL	T	T{
.na
Pollable event.
.ad
T}
SIGPROF	T	T{
.na
Profiling timer expired.
.ad
T}
SIGSYS	A	T{
.na
Bad system call.
.ad
T}
SIGTRAP	A	T{
.na
Trace/breakpoint trap.
.ad
T}
SIGURG	I	T{
.na
High bandwidth data is available at a socket.
.ad
T}
SIGVTALRM	T	T{
.na
Virtual timer expired.
.ad
T}
SIGXCPU	A	T{
.na
CPU time limit exceeded.
.ad
T}
SIGXFSZ	A	T{
.na
File size limit exceeded.
.ad
T}
.TE
.LP
The default actions are as follows:
.TP 7
T
Abnormal termination of the process. The process is terminated with
all the consequences of \fI_exit\fP() except that the status made
available to \fIwait\fP() and \fIwaitpid\fP() indicates abnormal
termination by the specified signal.
.TP 7
A
Abnormal termination of the process.
.br
Additionally, implementation-defined abnormal termination actions,
such as creation of a \fBcore\fP file, may occur. 
.TP 7
I
Ignore the signal.
.TP 7
S
Stop the process.
.TP 7
C
Continue the process, if it is stopped; otherwise, ignore the signal.
.sp
.sp
.LP
The
header shall provide a declaration of \fBstruct sigaction\fP, including
at least the following members:
.sp
.RS
.nf

\fBvoid (*sa_handler)(int) \fP Pointer to a signal-catching function or one of the macros \fB
                        \fP SIG_IGN or SIG_DFL. \fB
sigset_t sa_mask        \fP Set of signals to be blocked during execution of the signal \fB
                        \fP handling function. \fB
int      sa_flags       \fP Special flags. \fB
void (*sa_sigaction)(int, siginfo_t *, void *)
                        \fP Pointer to a signal-catching function. \fB
\fP
.fi
.RE
.LP
The storage occupied by \fIsa_handler\fP and \fIsa_sigaction\fP may
overlap, and a conforming application shall not use both
simultaneously. 
.LP
The following shall be declared as constants:
.TP 7
SA_NOCLDSTOP
Do
not generate SIGCHLD when children stop 
.br
or
stopped children continue. 
.TP 7
SIG_BLOCK
The resulting set is the union of the current set and the signal set
pointed to by the argument \fIset\fP. 
.TP 7
SIG_UNBLOCK
The resulting set is the intersection of the current set and the complement
of the signal set pointed to by the argument
\fIset\fP. 
.TP 7
SIG_SETMASK
The resulting set is the signal set pointed to by the argument \fIset\fP.
.TP 7
SA_ONSTACK
Causes signal delivery to occur on an alternate stack. 
.TP 7
SA_RESETHAND
Causes signal dispositions to be set to SIG_DFL on entry to signal
handlers. 
.TP 7
SA_RESTART
Causes certain functions to become restartable. 
.TP 7
SA_SIGINFO
Causes extra information to be passed to signal handlers at the time
of receipt of a signal. 
.TP 7
SA_NOCLDWAIT
Causes implementations not to create zombie processes on child death.
.TP 7
SA_NODEFER
Causes signal not to be automatically blocked on entry to signal handler.
.TP 7
SS_ONSTACK
Process is executing on an alternate signal stack. 
.TP 7
SS_DISABLE
Alternate signal stack is disabled. 
.TP 7
MINSIGSTKSZ
Minimum stack size for a signal handler. 
.TP 7
SIGSTKSZ
Default size in bytes for the alternate signal stack. 
.sp
.LP
The \fBucontext_t\fP structure shall be defined through \fBtypedef\fP
as described in \fI<ucontext.h>\fP.
.LP
The \fBmcontext_t\fP type shall be defined through \fBtypedef\fP as
described in \fI<ucontext.h>\fP.
.LP
The \fI<signal.h>\fP header shall define the \fBstack_t\fP type as
a structure that includes at least the following
members:
.sp
.RS
.nf

\fBvoid     *ss_sp      \fP Stack base or pointer. \fB
size_t    ss_size    \fP Stack size. \fB
int       ss_flags   \fP Flags. \fB
\fP
.fi
.RE
.LP
The \fI<signal.h>\fP header shall define the \fBsigstack\fP structure
that includes at least the following members:
.sp
.RS
.nf

\fBint       ss_onstack \fP Non-zero when signal stack is in use. \fB
void     *ss_sp      \fP Signal stack pointer. \fB
\fP
.fi
.RE
.LP
The
\fI<signal.h>\fP header shall define the \fBsiginfo_t\fP type as a
structure that includes at least the following members:
.sp
.RS
.nf

\fB
int           si_signo \fP Signal number. \fB


int           si_errno \fP If non-zero, an \fIerrno\fP value associated with \fB
                       \fP this signal, as defined in \fB<errno.h>.\fP \fB


int           si_code  \fP Signal code. \fB


pid_t         si_pid   \fP Sending process ID. \fB
uid_t         si_uid   \fP Real user ID of sending process. \fB
void         *si_addr  \fP Address of faulting instruction. \fB
int           si_status\fP Exit value or signal. \fB
long          si_band  \fP Band event for SIGPOLL. \fB


union sigval  si_value \fP Signal value. \fB

\fP
.fi
.RE
.LP
The macros specified in the \fBCode\fP column of the following table
are defined for use as values of \fIsi_code\fP that are
\ signal-specific or  non-signal-specific reasons why the signal
was generated.
.TS C
center; l l lw(40).
\fBSignal\fP	\fBCode\fP	T{
.na
\fBReason\fP
.ad
T}
SIGILL	ILL_ILLOPC	T{
.na
Illegal opcode.
.ad
T}
\ 	ILL_ILLOPN	T{
.na
Illegal operand.
.ad
T}
\ 	ILL_ILLADR	T{
.na
Illegal addressing mode.
.ad
T}
\ 	ILL_ILLTRP	T{
.na
Illegal trap.
.ad
T}
\ 	ILL_PRVOPC	T{
.na
Privileged opcode.
.ad
T}
\ 	ILL_PRVREG	T{
.na
Privileged register.
.ad
T}
\ 	ILL_COPROC	T{
.na
Coprocessor error.
.ad
T}
\ 	ILL_BADSTK	T{
.na
Internal stack error.
.ad
T}
SIGFPE	FPE_INTDIV	T{
.na
Integer divide by zero.
.ad
T}
\ 	FPE_INTOVF	T{
.na
Integer overflow.
.ad
T}
\ 	FPE_FLTDIV	T{
.na
Floating-point divide by zero.
.ad
T}
\ 	FPE_FLTOVF	T{
.na
Floating-point overflow.
.ad
T}
\ 	FPE_FLTUND	T{
.na
Floating-point underflow.
.ad
T}
\ 	FPE_FLTRES	T{
.na
Floating-point inexact result.
.ad
T}
\ 	FPE_FLTINV	T{
.na
Invalid floating-point operation.
.ad
T}
\ 	FPE_FLTSUB	T{
.na
Subscript out of range.
.ad
T}
SIGSEGV	SEGV_MAPERR	T{
.na
Address not mapped to object.
.ad
T}
\ 	SEGV_ACCERR	T{
.na
Invalid permissions for mapped object.
.ad
T}
SIGBUS	BUS_ADRALN	T{
.na
Invalid address alignment.
.ad
T}
\ 	BUS_ADRERR	T{
.na
Nonexistent physical address.
.ad
T}
\ 	BUS_OBJERR	T{
.na
Object-specific hardware error.
.ad
T}
SIGTRAP	TRAP_BRKPT	T{
.na
Process breakpoint.
.ad
T}
\ 	TRAP_TRACE	T{
.na
Process trace trap.
.ad
T}
SIGCHLD	CLD_EXITED	T{
.na
Child has exited.
.ad
T}
\ 	CLD_KILLED	T{
.na
Child has terminated abnormally and did not create a \fBcore\fP file.
.ad
T}
\ 	CLD_DUMPED	T{
.na
Child has terminated abnormally and created a \fBcore\fP file.
.ad
T}
\ 	CLD_TRAPPED	T{
.na
Traced child has trapped.
.ad
T}
\ 	CLD_STOPPED	T{
.na
Child has stopped.
.ad
T}
\ 	CLD_CONTINUED	T{
.na
Stopped child has continued.
.ad
T}
SIGPOLL	POLL_IN	T{
.na
Data input available.
.ad
T}
\ 	POLL_OUT	T{
.na
Output buffers available.
.ad
T}
\ 	POLL_MSG	T{
.na
Input message available.
.ad
T}
\ 	POLL_ERR	T{
.na
I/O error.
.ad
T}
\ 	POLL_PRI	T{
.na
High priority input available.
.ad
T}
\ 	POLL_HUP	T{
.na
Device disconnected.
.ad
T}
Any	SI_USER	T{
.na
Signal sent by \fIkill\fP().
.ad
T}
\ 	SI_QUEUE	T{
.na
Signal sent by the \fIsigqueue\fP().
.ad
T}
\ 	SI_TIMER	T{
.na
Signal generated by expiration of a timer set by \fItimer_settime\fP().
.ad
T}
\ 	SI_ASYNCIO	T{
.na
Signal generated by completion of an asynchronous I/O request.
.ad
T}
\ 	SI_MESGQ	T{
.na
Signal generated by arrival of a message on an empty message queue.
.ad
T}
.TE
.LP
Implementations may support additional \fIsi_code\fP values not included
in this list, may generate values included in this list
under circumstances other than those described in this list, and may
contain extensions or limitations that prevent some values
from being generated. Implementations do not generate a different
value from the ones described in this list for circumstances
described in this list.
.LP
In addition, the following signal-specific information shall be available:
.TS C
center; l1 l1 l.
\fBSignal\fP	\fBMember\fP	\fBValue\fP
SIGILL	\fBvoid * \fIsi_addr\fP\fP	Address of faulting instruction.
SIGFPE	\fB\ \fP	\ 
SIGSEGV	\fBvoid * \fIsi_addr\fP\fP	Address of faulting memory reference.
SIGBUS	\fB\ \fP	\ 
SIGCHLD	\fBpid_t \fIsi_pid\fP\fP	Child process ID.
\ 	\fBint \fIsi_status\fP\fP	Exit value or signal.
\ 	\fBuid_t \fIsi_uid\fP\fP	Real user ID of the process that sent the signal.
SIGPOLL	\fBlong \fIsi_band\fP\fP	Band event for POLL_IN, POLL_OUT, or POLL_MSG.
.TE
.LP
For some implementations, the value of \fIsi_addr\fP may be inaccurate.
.LP
The following shall be declared as functions and may also be defined
as macros:
.sp
.RS
.nf

\fB
void (*bsd_signal(int, void (*)(int)))(int);


int    kill(pid_t, int);


int    killpg(pid_t, int);


int    pthread_kill(pthread_t, int);
int    pthread_sigmask(int, const sigset_t *, sigset_t *);

int    raise(int);

int    sigaction(int, const struct sigaction *restrict,
           struct sigaction *restrict);
int    sigaddset(sigset_t *, int);


int    sigaltstack(const stack_t *restrict, stack_t *restrict);


int    sigdelset(sigset_t *, int);
int    sigemptyset(sigset_t *);
int    sigfillset(sigset_t *);


int    sighold(int);
int    sigignore(int);
int    siginterrupt(int, int);


int    sigismember(const sigset_t *, int);

void (*signal(int, void (*)(int)))(int);

int    sigpause(int);


int    sigpending(sigset_t *);
int    sigprocmask(int, const sigset_t *restrict, sigset_t *restrict);


int    sigqueue(pid_t, int, const union sigval);


int    sigrelse(int);
void (*sigset(int, void (*)(int)))(int);


int    sigsuspend(const sigset_t *);


int    sigtimedwait(const sigset_t *restrict, siginfo_t *restrict,
           const struct timespec *restrict);


int    sigwait(const sigset_t *restrict, int *restrict);


int    sigwaitinfo(const sigset_t *restrict, siginfo_t *restrict);

\fP
.fi
.RE
.LP
Inclusion of the \fI<signal.h>\fP header may make visible all symbols
from the \fI<time.h>\fP header. 
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fI<errno.h>\fP , \fI<stropts.h>\fP , \fI<sys/types.h>\fP , \fI<time.h>\fP
, \fI<ucontext.h>\fP , the System Interfaces volume of IEEE\ Std\ 1003.1-2001,
\fIalarm\fP(), \fIbsd_signal\fP(), \fIioctl\fP(), \fIkill\fP(), \fIkillpg\fP(),
\fIraise\fP(), \fIsigaction\fP(), \fIsigaddset\fP(), \fIsigaltstack\fP(),
\fIsigdelset\fP(), \fIsigemptyset\fP(), \fIsigfillset\fP(), \fIsiginterrupt\fP(),
\fIsigismember\fP(), \fIsignal\fP(), \fIsigpending\fP(), \fIsigprocmask\fP(),
\fIsigqueue\fP(), \fIsigsuspend\fP(), \fIsigwaitinfo\fP(), \fIwait\fP(),
\fIwaitid\fP()
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .