OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / getcontext.3
index 7d35cac..2ff22ef 100644 (file)
@@ -22,7 +22,7 @@
 .\" the source, must acknowledge the copyright and authors of this work.
 .\" %%%LICENSE_END
 .\"
-.TH GETCONTEXT 3 2009-03-15 "Linux" "Linux Programmer's Manual"
+.TH GETCONTEXT 3 2014-04-08 "Linux" "Linux Programmer's Manual"
 .SH NAME
 getcontext, setcontext \- get or set the user context
 .SH SYNOPSIS
@@ -33,19 +33,26 @@ getcontext, setcontext \- get or set the user context
 .BI "int setcontext(const ucontext_t *" ucp );
 .SH DESCRIPTION
 In a System V-like environment, one has the two types
-\fImcontext_t\fP and \fIucontext_t\fP defined in
+.I mcontext_t
+and
+.I ucontext_t
+defined in
 .I <ucontext.h>
 and the four functions
 .BR getcontext (),
 .BR setcontext (),
-.BR makecontext (3)
+.BR makecontext (3),
 and
 .BR swapcontext (3)
 that allow user-level context switching between multiple
 threads of control within a process.
 .LP
-The \fImcontext_t\fP type is machine-dependent and opaque.
-The \fIucontext_t\fP type is a structure that has at least
+The
+.I mcontext_t
+type is machine-dependent and opaque.
+The
+.I ucontext_t
+type is a structure that has at least
 the following fields:
 .in +4
 .nf
@@ -60,30 +67,43 @@ typedef struct ucontext {
 
 .fi
 .in
-with \fIsigset_t\fP and \fIstack_t\fP defined in
+with
+.IR sigset_t
+and
+.I stack_t
+defined in
 .IR <signal.h> .
-Here \fIuc_link\fP points to the context that will be resumed
+Here
+.I uc_link
+points to the context that will be resumed
 when the current context terminates (in case the current context
 was created using
 .BR makecontext (3)),
-\fIuc_sigmask\fP is the
+.I uc_sigmask
+is the
 set of signals blocked in this context (see
 .BR sigprocmask (2)),
-\fIuc_stack\fP is the stack used by this context (see
+.I uc_stack
+is the stack used by this context (see
 .BR sigaltstack (2)),
-and \fIuc_mcontext\fP is the
+and
+.I uc_mcontext
+is the
 machine-specific representation of the saved context,
 that includes the calling thread's machine registers.
 .LP
 The function
 .BR getcontext ()
 initializes the structure
-pointed at by \fIucp\fP to the currently active context.
+pointed at by
+.I ucp
+to the currently active context.
 .LP
 The function
 .BR setcontext ()
 restores the user context
-pointed at by \fIucp\fP.
+pointed at by
+.IR ucp .
 A successful call does not return.
 The context should have been obtained by a call of
 .BR getcontext (),
@@ -98,11 +118,17 @@ program execution continues as if this call just returned.
 .LP
 If the context was obtained by a call of
 .BR makecontext (3),
-program execution continues by a call to the function \fIfunc\fP
+program execution continues by a call to the function
+.I func
 specified as the second argument of that call to
 .BR makecontext (3).
-When the function \fIfunc\fP returns, we continue with the
-\fIuc_link\fP member of the structure \fIucp\fP specified as the
+When the function
+.I func
+returns, we continue with the
+.I uc_link
+member of the structure
+.I ucp
+specified as the
 first argument of that call to
 .BR makecontext (3).
 When this member is NULL, the thread exits.
@@ -119,10 +145,18 @@ When successful,
 returns 0 and
 .BR setcontext ()
 does not return.
-On error, both return \-1 and set \fIerrno\fP
+On error, both return \-1 and set
+.I errno
 appropriately.
 .SH ERRORS
 None defined.
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR getcontext ()
+and
+.BR setcontext ()
+functions are thread-safe.
 .SH CONFORMING TO
 SUSv2, POSIX.1-2001.
 POSIX.1-2008 removes the specification of
@@ -164,3 +198,12 @@ instead.
 .BR longjmp (3),
 .BR makecontext (3),
 .BR sigsetjmp (3)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.