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]
21 /* Copyright (c) 1988 AT&T */
22 /* All Rights Reserved */
26 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
29 * Use is subject to license terms.
35 #include <sys/ucontext.h>
37 * The file sys/regset.h defines indices in the gregset_t array,
38 * such as EIP on i386. Those defines were historically exposed
39 * via sys/ucontext.h, sys/signal.h, etc. which caused surprises
40 * due to those defines unexpectedly polluting the namespace.
41 * On the other hand, several existing applications assume that
42 * the regset names are defined after an include <ucontext.h>.
43 * To solve both problems at once: <ucontext.h> (this file)
44 * DOES include sys/regset.h for you but <sys/ucontext.h>
45 * does NOT include sys/regset.h anymore.
47 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
48 #include <sys/regset.h>
49 #include <sys/siginfo.h>
57 #ifdef __PRAGMA_REDEFINE_EXTNAME
58 #pragma redefine_extname makecontext __makecontext_v2
60 #define makecontext __makecontext_v2
64 extern int getcontext(ucontext_t
*) __RETURNS_TWICE
;
65 #pragma unknown_control_flow(getcontext)
66 extern int setcontext(const ucontext_t
*) __NORETURN
;
67 extern int swapcontext(ucontext_t
*_RESTRICT_KYWD
,
68 const ucontext_t
*_RESTRICT_KYWD
);
69 extern void makecontext(ucontext_t
*, void(*)(), int, ...);
71 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
72 extern int walkcontext(const ucontext_t
*, int (*)(uintptr_t, int, void *),
74 extern int printstack(int);
75 extern int addrtosymstr(void *, char *, int);
76 extern int getustack(stack_t
**);
77 extern int setustack(stack_t
*);
79 extern int stack_getbounds(stack_t
*);
80 extern int stack_setbounds(const stack_t
*);
81 extern int stack_inbounds(void *);
82 extern int stack_violation(int, const siginfo_t
*, const ucontext_t
*);
84 extern void *_stack_grow(void *);
85 #endif /* !_XPG4_2 || __EXTENSIONS__ */
91 #endif /* _UCONTEXT_H */