2 .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved
3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 .\" http://www.opengroup.org/bookstore/.
5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions 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.
6 .\" This notice shall appear on any product containing this material.
7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 .TH BSD_SIGNAL 3C "Jul 24, 2002"
12 bsd_signal \- simplified signal facilities
18 \fBvoid\fR (\fB*bsd_signal(int\fR \fIsig\fR, \fBvoid\fR (*\fIfunc\fR)(\fBint\fR)))(\fBint\fR);
24 The \fBbsd_signal()\fR function provides a partially compatible interface for
25 programs written to historical system interfaces (see \fBUSAGE\fR below).
28 The function call \fBbsd_signal\fR(\fIsig\fR, \fIfunc\fR) has an effect as if
33 void (*bsd_signal(int sig, void (*func)\|(int)))\|(int)
35 struct sigaction act, oact;
37 act.sa_handler = \fIfunc\fR;
38 act.sa_flags = SA_RESTART;
39 sigemptyset(&act.sa_mask);
40 sigaddset(&act.sa_mask, \fIsig\fR);
41 if (sigaction(\fIsig\fR, &act, &oact) == \(mi1)
42 return(\fBSIG_ERR\fR);
43 return(oact.sa_handler);
50 The handler function should be declared:
54 void handler(int \fIsig\fR);
60 where \fIsig\fR is the signal number. The behavior is undefined if \fIfunc\fR
61 is a function that takes more than one argument, or an argument of a different
66 Upon successful completion, \fBbsd_signal()\fR returns the previous action for
67 \fIsig\fR. Otherwise, \fBSIG_ERR\fR is returned and \fBerrno\fR is set to
72 Refer to \fBsigaction\fR(2).
76 This function is a direct replacement for the \fBBSD\fR \fBsignal\fR(3UCB)
77 function for simple applications that are installing a single-argument signal
78 handler function. If a \fBBSD\fR signal handler function is being installed
79 that expects more than one argument, the application has to be modified to use
80 \fBsigaction\fR(2). The \fBbsd_signal()\fR function differs from
81 \fBsignal\fR(3UCB) in that the \fBSA_RESTART\fR flag is set and the
82 \fBSA_RESETHAND\fR will be clear when \fBbsd_signal()\fR is used. The state of
83 these flags is not specified for \fBsignal\fR(3UCB).
87 See \fBattributes\fR(5) for descriptions of the following attributes:
95 ATTRIBUTE TYPE ATTRIBUTE VALUE
97 Interface Stability Standard
103 \fBsigaction\fR(2), \fBsigaddset\fR(3C), \fBsigemptyset\fR(3C),
104 \fBsignal\fR(3UCB), \fBattributes\fR(5), \fBstandards\fR(5)