sigaltstack.2 (17782) | sigaltstack.2 (23660) |
---|---|
1.\" Copyright (c) 1983, 1991, 1992, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 15 unchanged lines hidden (view full) --- 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" | 1.\" Copyright (c) 1983, 1991, 1992, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 15 unchanged lines hidden (view full) --- 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" |
32.\" @(#)sigaltstack.2 8.1 (Berkeley) 6/4/93 | 32.\" @(#)sigaltstack.2 8.2 (Berkeley) 5/1/95 |
33.\" | 33.\" |
34.Dd June 4, 1993 | 34.Dd May 1, 1995 |
35.Dt SIGALTSTACK 2 36.Os BSD 4.2 37.Sh NAME 38.Nm sigaltstack 39.Nd set and/or get signal stack context 40.Sh SYNOPSIS 41.Fd #include <sys/types.h> 42.Fd #include <signal.h> 43.Bd -literal 44struct sigaltstack { | 35.Dt SIGALTSTACK 2 36.Os BSD 4.2 37.Sh NAME 38.Nm sigaltstack 39.Nd set and/or get signal stack context 40.Sh SYNOPSIS 41.Fd #include <sys/types.h> 42.Fd #include <signal.h> 43.Bd -literal 44struct sigaltstack { |
45 caddr_t ss_sp; | 45 caddr_t ss_base; |
46 long ss_size; 47 int ss_flags; 48}; 49.Ed 50.Ft int 51.Fn sigaltstack "const struct sigaltstack *ss" "struct sigaltstack *oss" 52.Sh DESCRIPTION 53.Fn Sigaltstack --- 15 unchanged lines hidden (view full) --- 69If the process is not currently executing on the signal stack, 70the system arranges a switch to the signal stack for the 71duration of the signal handler's execution. 72.Pp 73If 74.Dv SS_DISABLE 75is set in 76.Fa ss_flags , | 46 long ss_size; 47 int ss_flags; 48}; 49.Ed 50.Ft int 51.Fn sigaltstack "const struct sigaltstack *ss" "struct sigaltstack *oss" 52.Sh DESCRIPTION 53.Fn Sigaltstack --- 15 unchanged lines hidden (view full) --- 69If the process is not currently executing on the signal stack, 70the system arranges a switch to the signal stack for the 71duration of the signal handler's execution. 72.Pp 73If 74.Dv SS_DISABLE 75is set in 76.Fa ss_flags , |
77.Fa ss_sp | 77.Fa ss_base |
78and 79.Fa ss_size 80are ignored and the signal stack will be disabled. 81Trying to disable an active stack will cause 82.Fn sigaltstack 83to return -1 with 84.Va errno 85set to --- 15 unchanged lines hidden (view full) --- 101if the signal stack is currently disabled. 102.Sh NOTES 103The value 104.Dv SIGSTKSZ 105is defined to be the number of bytes/chars that would be used to cover 106the usual case when allocating an alternate stack area. 107The following code fragment is typically used to allocate an alternate stack. 108.Bd -literal -offset indent | 78and 79.Fa ss_size 80are ignored and the signal stack will be disabled. 81Trying to disable an active stack will cause 82.Fn sigaltstack 83to return -1 with 84.Va errno 85set to --- 15 unchanged lines hidden (view full) --- 101if the signal stack is currently disabled. 102.Sh NOTES 103The value 104.Dv SIGSTKSZ 105is defined to be the number of bytes/chars that would be used to cover 106the usual case when allocating an alternate stack area. 107The following code fragment is typically used to allocate an alternate stack. 108.Bd -literal -offset indent |
109if ((sigstk.ss_sp = malloc(SIGSTKSZ)) == NULL) | 109if ((sigstk.ss_base = malloc(SIGSTKSZ)) == NULL) |
110 /* error return */ 111sigstk.ss_size = SIGSTKSZ; 112sigstk.ss_flags = 0; 113if (sigaltstack(&sigstk,0) < 0) 114 perror("sigaltstack"); 115.Ed 116An alternative approach is provided for programs with signal handlers 117that require a specific amount of stack space other than the default size. --- 48 unchanged lines hidden --- | 110 /* error return */ 111sigstk.ss_size = SIGSTKSZ; 112sigstk.ss_flags = 0; 113if (sigaltstack(&sigstk,0) < 0) 114 perror("sigaltstack"); 115.Ed 116An alternative approach is provided for programs with signal handlers 117that require a specific amount of stack space other than the default size. --- 48 unchanged lines hidden --- |