summaryrefslogtreecommitdiffstats
path: root/man3/makecontext.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/makecontext.3')
-rw-r--r--man3/makecontext.318
1 files changed, 9 insertions, 9 deletions
diff --git a/man3/makecontext.3 b/man3/makecontext.3
index c46fb8708..89e073ac9 100644
--- a/man3/makecontext.3
+++ b/man3/makecontext.3
@@ -169,12 +169,12 @@ main: exiting
#include <stdio.h>
#include <stdlib.h>
#include <ucontext.h>
-
+\&
static ucontext_t uctx_main, uctx_func1, uctx_func2;
-
+\&
#define handle_error(msg) \e
do { perror(msg); exit(EXIT_FAILURE); } while (0)
-
+\&
static void
func1(void)
{
@@ -184,7 +184,7 @@ func1(void)
handle_error("swapcontext");
printf("%s: returning\en", __func__);
}
-
+\&
static void
func2(void)
{
@@ -194,20 +194,20 @@ func2(void)
handle_error("swapcontext");
printf("%s: returning\en", __func__);
}
-
+\&
int
main(int argc, char *argv[])
{
char func1_stack[16384];
char func2_stack[16384];
-
+\&
if (getcontext(&uctx_func1) == \-1)
handle_error("getcontext");
uctx_func1.uc_stack.ss_sp = func1_stack;
uctx_func1.uc_stack.ss_size = sizeof(func1_stack);
uctx_func1.uc_link = &uctx_main;
makecontext(&uctx_func1, func1, 0);
-
+\&
if (getcontext(&uctx_func2) == \-1)
handle_error("getcontext");
uctx_func2.uc_stack.ss_sp = func2_stack;
@@ -215,11 +215,11 @@ main(int argc, char *argv[])
/* Successor context is f1(), unless argc > 1 */
uctx_func2.uc_link = (argc > 1) ? NULL : &uctx_func1;
makecontext(&uctx_func2, func2, 0);
-
+\&
printf("%s: swapcontext(&uctx_main, &uctx_func2)\en", __func__);
if (swapcontext(&uctx_main, &uctx_func2) == \-1)
handle_error("swapcontext");
-
+\&
printf("%s: exiting\en", __func__);
exit(EXIT_SUCCESS);
}