Print this page
Minor markup tweaks (Sy instead of Nm).
fix incorrect standard citations
first round of POSIX 2008 stuff

*** 1,104 **** - '\" te .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" 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 .\" http://www.opengroup.org/bookstore/. .\" 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. .\" This notice shall appear on any product containing this material. .\" 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. .\" 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. .\" 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] ! .TH BSD_SIGNAL 3C "Jul 24, 2002" ! .SH NAME ! bsd_signal \- simplified signal facilities ! .SH SYNOPSIS ! .LP ! .nf ! #include <signal.h> ! ! \fBvoid\fR (\fB*bsd_signal(int\fR \fIsig\fR, \fBvoid\fR (*\fIfunc\fR)(\fBint\fR)))(\fBint\fR); ! .fi ! ! .SH DESCRIPTION ! .sp ! .LP ! The \fBbsd_signal()\fR function provides a partially compatible interface for ! programs written to historical system interfaces (see \fBUSAGE\fR below). ! .sp ! .LP ! The function call \fBbsd_signal\fR(\fIsig\fR, \fIfunc\fR) has an effect as if ! implemented as: ! .sp ! .in +2 ! .nf void (*bsd_signal(int sig, void (*func)\|(int)))\|(int) { struct sigaction act, oact; ! act.sa_handler = \fIfunc\fR; act.sa_flags = SA_RESTART; sigemptyset(&act.sa_mask); ! sigaddset(&act.sa_mask, \fIsig\fR); ! if (sigaction(\fIsig\fR, &act, &oact) == \(mi1) ! return(\fBSIG_ERR\fR); return(oact.sa_handler); } ! .fi ! .in -2 ! ! .sp ! .LP The handler function should be declared: ! .sp ! .in +2 ! .nf ! void handler(int \fIsig\fR); ! .fi ! .in -2 ! ! .sp ! .LP ! where \fIsig\fR is the signal number. The behavior is undefined if \fIfunc\fR is a function that takes more than one argument, or an argument of a different type. ! .SH RETURN VALUES ! .sp ! .LP ! Upon successful completion, \fBbsd_signal()\fR returns the previous action for ! \fIsig\fR. Otherwise, \fBSIG_ERR\fR is returned and \fBerrno\fR is set to ! indicate the error. ! .SH ERRORS ! .sp ! .LP ! Refer to \fBsigaction\fR(2). ! .SH USAGE ! .sp ! .LP ! This function is a direct replacement for the \fBBSD\fR \fBsignal\fR(3UCB) function for simple applications that are installing a single-argument signal ! handler function. If a \fBBSD\fR signal handler function is being installed that expects more than one argument, the application has to be modified to use ! \fBsigaction\fR(2). The \fBbsd_signal()\fR function differs from ! \fBsignal\fR(3UCB) in that the \fBSA_RESTART\fR flag is set and the ! \fBSA_RESETHAND\fR will be clear when \fBbsd_signal()\fR is used. The state of ! these flags is not specified for \fBsignal\fR(3UCB). ! .SH ATTRIBUTES ! .sp ! .LP ! See \fBattributes\fR(5) for descriptions of the following attributes: ! .sp ! ! .sp ! .TS ! box; ! c | c ! l | l . ! ATTRIBUTE TYPE ATTRIBUTE VALUE ! _ ! Interface Stability Standard ! .TE ! ! .SH SEE ALSO ! .sp ! .LP ! \fBsigaction\fR(2), \fBsigaddset\fR(3C), \fBsigemptyset\fR(3C), ! \fBsignal\fR(3UCB), \fBattributes\fR(5), \fBstandards\fR(5) --- 1,98 ---- .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved .\" 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 .\" http://www.opengroup.org/bookstore/. .\" 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. .\" This notice shall appear on any product containing this material. .\" 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. .\" 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. .\" 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] ! .Dd "Jul 19, 2014" ! .Dt BSD_SIGNAL 3C ! .Os ! .Sh NAME ! .Nm bsd_signal ! .Nd simplified signal facilities ! .Sh SYNOPSIS ! .In signal.h ! .Ft void ! .Fn \*(lp*bsd_signal "int sig" "void \*(lp*func\*(rp\*(lpint\*(rp\*(rp\*(rp\*(lpint" ! .\" \fBvoid\fR (\fB*bsd_signal(int\fR \fIsig\fR, \fBvoid\fR (*\fIfunc\fR)(\fBint\fR)))(\fBint\fR); ! .Sh DESCRIPTION ! The ! .Fn bsd_signal ! function provides a partially compatible interface for ! programs written to historical system interfaces (see ! .Sx USAGE ! below). ! .Lp ! The function call ! .Fn bsd_signal sig func ! has an effect as if implemented as: ! .Bd -literal -offset indent void (*bsd_signal(int sig, void (*func)\|(int)))\|(int) { struct sigaction act, oact; ! act.sa_handler = func; act.sa_flags = SA_RESTART; sigemptyset(&act.sa_mask); ! sigaddset(&act.sa_mask, sig); ! if (sigaction(sig, &act, &oact) == \(mi1) ! return(SIG_ERR); return(oact.sa_handler); } ! .Ed ! .Lp The handler function should be declared: ! .Lp ! .Dl Ft void Fn handler "int sig" ; ! .Lp ! where ! .Fa sig ! is the signal number. The behavior is undefined if ! .Fa func is a function that takes more than one argument, or an argument of a different type. ! .Sh RETURN VALUES ! Upon successful completion, ! .Fn bsd_signal ! returns the previous action for ! .Fa sig . ! Otherwise, ! .Dv SIG_ERR ! is returned and ! .Va errno ! is set to indicate the error. ! .Sh ERRORS ! Refer to ! .Xr sigaction 2 . ! .Sh USAGE ! This function is a direct replacement for the ! .Bx ! .Fn signal function for simple applications that are installing a single-argument signal ! handler function. If a ! .Bx ! signal handler function is being installed that expects more than one argument, the application has to be modified to use ! .Xr sigaction 2 . ! .Lp ! Portable applications should use ! .Xr sigaction 2 ! instead of this function. ! .Sh INTERFACE STABILITY ! .Sy Obsolete Standard . ! .Sh SEE ALSO ! .Xr sigaction 2 , ! .Xr sigaddset 3C , ! .Xr sigemptyset 3C , ! .Xr standards 5 ! .Sh STANDARDS ! The ! .Fn bsd_signal ! function was added in ! .St -xpg4.2 . ! It was subsequently obsoleted in ! .St -p1003.1-2001 ! and removed from ! .St -p1003.1-2008 .