9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3c / bsd_signal.3c
blobaf0219194486404fadec28554c4a289d7e23f6c0
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
44 .\" Portions Copyright (c) 2002, Sun Microsystems, Inc.  All Rights Reserved.
45 .\"
46 .TH BSD_SIGNAL 3C "May 13, 2017"
47 .SH NAME
48 bsd_signal \- simplified signal facilities
49 .SH SYNOPSIS
50 .LP
51 .nf
52 #include <signal.h>
54 \fBvoid\fR (\fB*bsd_signal(int\fR \fIsig\fR, \fBvoid\fR (*\fIfunc\fR)(\fBint\fR)))(\fBint\fR);
55 .fi
57 .SH DESCRIPTION
58 .LP
59 The \fBbsd_signal()\fR function provides a partially compatible interface for
60 programs written to historical system interfaces (see \fBUSAGE\fR below).
61 .sp
62 .LP
63 The function call \fBbsd_signal\fR(\fIsig\fR, \fIfunc\fR) has an effect as if
64 implemented as:
65 .sp
66 .in +2
67 .nf
68 void (*bsd_signal(int sig, void (*func)\|(int)))\|(int)
70      struct sigaction act, oact;
72      act.sa_handler = \fIfunc\fR;
73      act.sa_flags = SA_RESTART;
74      sigemptyset(&act.sa_mask);
75      sigaddset(&act.sa_mask, \fIsig\fR);
76      if (sigaction(\fIsig\fR, &act, &oact) == \(mi1)
77           return(\fBSIG_ERR\fR);
78      return(oact.sa_handler);
80 .fi
81 .in -2
83 .sp
84 .LP
85 The handler function should be declared:
86 .sp
87 .in +2
88 .nf
89 void handler(int \fIsig\fR);
90 .fi
91 .in -2
93 .sp
94 .LP
95 where \fIsig\fR is the signal number.  The behavior is undefined if \fIfunc\fR
96 is a function that takes more than one argument, or an argument of a different
97 type.
98 .SH RETURN VALUES
99 .LP
100 Upon successful completion, \fBbsd_signal()\fR returns the previous action for
101 \fIsig\fR. Otherwise, \fBSIG_ERR\fR is returned and \fBerrno\fR is set to
102 indicate the error.
103 .SH ERRORS
105 Refer to \fBsigaction\fR(2).
106 .SH USAGE
108 This function is a direct replacement for the \fBBSD\fR \fBsignal()\fR
109 function for simple applications that are installing a single-argument signal
110 handler function.  If a \fBBSD\fR signal handler function is being installed
111 that expects more than one argument, the application has to be modified to use
112 \fBsigaction\fR(2). The \fBbsd_signal()\fR function differs from the \fBBSD\fR
113 \fBsignal()\fR in that the \fBSA_RESTART\fR flag is set and the
114 \fBSA_RESETHAND\fR will be clear when \fBbsd_signal()\fR is used.  The state of
115 these flags is not specified for the \fBBSD\fR \fBsignal()\fR.
116 .SH ATTRIBUTES
118 See \fBattributes\fR(5) for descriptions of the following attributes:
123 box;
124 c | c
125 l | l .
126 ATTRIBUTE TYPE  ATTRIBUTE VALUE
128 Interface Stability     Standard
131 .SH SEE ALSO
133 \fBsigaction\fR(2), \fBsigaddset\fR(3C), \fBsigemptyset\fR(3C),
134 \fBattributes\fR(5), \fBstandards\fR(5)