4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * 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
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
25 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
29 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
30 /* All Rights Reserved */
32 #ifndef _SYS_UCONTEXT_H
33 #define _SYS_UCONTEXT_H
35 #include <sys/feature_tests.h>
37 #include <sys/types.h>
38 #include <sys/mcontext.h>
39 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
40 #include <sys/signal.h>
48 * Inclusion of <sys/signal.h> for sigset_t and stack_t definitions
49 * breaks XPG4v2 namespace. Therefore we must duplicate the defines
50 * for these types here when _XPG4_2 is defined.
53 #if defined(_XPG4_2) && !defined(__EXTENSIONS__)
56 typedef struct { /* signal set type */
57 unsigned long __sigbits
[4];
59 #endif /* _SIGSET_T */
69 #endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */
71 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
72 typedef struct ucontext ucontext_t
;
74 typedef struct __ucontext ucontext_t
;
75 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
77 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
82 unsigned long uc_flags
;
86 mcontext_t uc_mcontext
;
87 long uc_filler
[5]; /* see ABI spec for Intel386 */
90 #if defined(_SYSCALL32)
92 /* Kernel view of user ILP32 ucontext structure */
94 typedef struct ucontext32
{
99 mcontext32_t uc_mcontext
;
100 int32_t uc_filler
[5];
104 extern void ucontext_nto32(const ucontext_t
*src
, ucontext32_t
*dest
);
105 extern void ucontext_32ton(const ucontext32_t
*src
, ucontext_t
*dest
);
108 #endif /* _SYSCALL32 */
110 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
117 * values for uc_flags
118 * these are implementation dependent flags, that should be hidden
119 * from the user interface, defining which elements of ucontext
120 * are valid, and should be restored on call to setcontext
123 #define UC_SIGMASK 0x01
124 #define UC_STACK 0x02
127 #define UC_FPU UC_MAU
129 #define UC_MCONTEXT (UC_CPU|UC_FPU)
132 * UC_ALL specifies the default context
135 #define UC_ALL (UC_SIGMASK|UC_STACK|UC_MCONTEXT)
136 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
139 void savecontext(ucontext_t
*, const k_sigset_t
*);
140 void restorecontext(ucontext_t
*);
143 extern void savecontext32(ucontext32_t
*, const k_sigset_t
*);
151 #endif /* _SYS_UCONTEXT_H */