-.\" Copyright (C) 2001 Andries Brouwer (aeb@cwi.nl)
+\" Copyright (C) 2001 Andries Brouwer (aeb@cwi.nl)
.\" and Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
+.\"
.\" 2006-08-02, mtk, Added example program
.\"
-.TH MAKECONTEXT 3 2009-03-31 "GNU" "Linux Programmer's Manual"
+.TH MAKECONTEXT 3 2014-04-14 "GNU" "Linux Programmer's Manual"
.SH NAME
makecontext, swapcontext \- manipulate user context
.SH SYNOPSIS
In a System V-like environment, one has the type \fIucontext_t\fP defined in
.I <ucontext.h>
and the four functions
-.BR getcontext (2),
-.BR setcontext (2),
+.BR getcontext (3),
+.BR setcontext (3),
.BR makecontext ()
and
.BR swapcontext ()
between multiple threads of control within a process.
.LP
For the type and the first two functions, see
-.BR getcontext (2).
+.BR getcontext (3).
.LP
The
.BR makecontext ()
function modifies the context pointed to
by \fIucp\fP (which was obtained from a call to
-.BR getcontext (2)).
+.BR getcontext (3)).
Before invoking
.BR makecontext (),
the caller must allocate a new stack
assign its address to \fIucp\->uc_link\fP.
When this context is later activated (using
-.BR setcontext (2)
+.BR setcontext (3)
or
.BR swapcontext ())
the function \fIfunc\fP is called,
function saves the current context in
the structure pointed to by \fIoucp\fP, and then activates the
context pointed to by \fIucp\fP.
-.SH "RETURN VALUE"
+.SH RETURN VALUE
When successful,
.BR swapcontext ()
does not return.
and
.BR swapcontext ()
are provided in glibc since version 2.1.
-.SH "CONFORMING TO"
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR makecontext ()
+and
+.BR swapcontext ()
+functions are thread-safe.
+.SH CONFORMING TO
SUSv2, POSIX.1-2001.
POSIX.1-2008 removes the specifications of
.BR makecontext ()
and won't work on architectures where pointers are larger than
.IR int s.
Nevertheless, starting with version 2.8, glibc makes some changes to
-.BR makecontext (3),
+.BR makecontext (),
to permit this on some 64-bit architectures (e.g., x86-64).
.SH EXAMPLE
.PP
The example program below demonstrates the use of
-.BR getcontext (2),
+.BR getcontext (3),
.BR makecontext (),
and
.BR swapcontext ().
exit(EXIT_SUCCESS);
}
.fi
-.SH "SEE ALSO"
-.BR getcontext (2),
+.SH SEE ALSO
.BR sigaction (2),
.BR sigaltstack (2),
.BR sigprocmask (2),
+.BR getcontext (3),
.BR sigsetjmp (3)
+.SH COLOPHON
+This page is part of release 3.65 of the Linux
+.I man-pages
+project.
+A description of the project,
+and information about reporting bugs,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.