OSDN Git Service

(split) LDP: Update original to LDP v3.65
[linuxjm/LDP_man-pages.git] / original / man3 / makecontext.3
index 730438b..a0aead6 100644 (file)
@@ -1,6 +1,7 @@
-.\" 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
@@ -36,8 +39,8 @@ makecontext, swapcontext \- manipulate user context
 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 ()
@@ -45,13 +48,13 @@ that allow user-level context switching
 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
@@ -60,7 +63,7 @@ and define a successor context and
 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,
@@ -78,7 +81,7 @@ The
 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.
@@ -99,7 +102,14 @@ Insufficient stack space left.
 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 ()
@@ -129,12 +139,12 @@ is undefined according to the standards,
 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 ().
@@ -214,9 +224,17 @@ main(int argc, char *argv[])
     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/.