[PATCH 8/9] include/ucontext.h: provide declarations for {get, set, make, swap}context
Florian Fainelli
florian at openwrt.org
Mon Dec 31 14:38:31 UTC 2012
This patch adds definitions for the {get,set,make,swap}context
user-space context manipulation functions. These declarations are made
conditional to the enabling of UCLIBC_HAS_CONTEXT_FUNCS. Base on a
initial patch by Carmelo Amoroso.
Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
Signed-off-by: Florian Fainelli <florian at openwrt.org>
---
include/ucontext.h | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/include/ucontext.h b/include/ucontext.h
index 14a1270..3974290 100644
--- a/include/ucontext.h
+++ b/include/ucontext.h
@@ -23,9 +23,32 @@
/* Get machine dependent definition of data structures. */
#include <sys/ucontext.h>
-/* The System V ABI user-level context switching support functions
- * are marked obsolescent by SuSv3, and are not implemented by
- * uClibc. This header is therefore empty. */
+#ifdef __UCLIBC_HAS_CONTEXT_FUNCS__
+__BEGIN_DECLS
+
+/* Get user context and store it in variable pointed to by UCP. */
+extern int getcontext (ucontext_t *__ucp) __THROW;
+
+/* Set user context from information of variable pointed to by UCP. */
+extern int setcontext (__const ucontext_t *__ucp) __THROW;
+
+/* Save current context in context variable pointed to by OUCP and set
+ context from variable pointed to by UCP. */
+extern int swapcontext (ucontext_t *__restrict __oucp,
+ __const ucontext_t *__restrict __ucp) __THROW;
+
+/* Manipulate user context UCP to continue with calling functions FUNC
+ + and the ARGC-1 parameters following ARGC when the context is used
+ + the next time in `setcontext' or `swapcontext'.
+ +
+ + We cannot say anything about the parameters FUNC takes; `void'
+ + is as good as any other choice. */
+extern void makecontext (ucontext_t *__ucp, void (*__func) (void),
+ int __argc, ...) __THROW;
+
+__END_DECLS
+
+#endif
#endif /* ucontext.h */
--
1.7.10.4
More information about the uClibc
mailing list