| 1 |
.\" Copyright (C) 2004 IBM Corporation |
| 2 |
.\" This file is distributed according to the GNU General Public License. |
| 3 |
.\" See the file COPYING in the top level source directory for details. |
| 4 |
.\" |
| 5 |
|
| 6 |
.de Sh \" Subsection |
| 7 |
.br |
| 8 |
.if t .Sp |
| 9 |
.ne 5 |
| 10 |
.PP |
| 11 |
\fB\\$1\fR |
| 12 |
.PP |
| 13 |
.. |
| 14 |
.de Sp \" Vertical space (when we can't use .PP) |
| 15 |
.if t .sp .5v |
| 16 |
.if n .sp |
| 17 |
.. |
| 18 |
.de Ip \" List item |
| 19 |
.br |
| 20 |
.ie \\n(.$>=3 .ne \\$3 |
| 21 |
.el .ne 3 |
| 22 |
.IP "\\$1" \\$2 |
| 23 |
.. |
| 24 |
.TH "SWAPCONTEXT" 2 "2004-March-12" "Linux 2.6" "Linux 2.6 Programmer's Guide" |
| 25 |
.SH NAME |
| 26 |
swapcontext \- Swap out old context with new context |
| 27 |
.SH "SYNOPSIS" |
| 28 |
.ad l |
| 29 |
.hy 0 |
| 30 |
.HP 21 |
| 31 |
int\ \fBsys_swapcontext\fR\ (struct\ ucontext\ \fI*old_ctx\fR, struct\ ucontext\ \fI*new_ctx\fR, int\ \fIr5\fR, int\ \fIr6\fR, int\ \fIr7\fR, int\ \fIr8\fR, struct\ pt_regs\ \fI*regs\fR); |
| 32 |
.ad |
| 33 |
.hy |
| 34 |
|
| 35 |
.SH "DESCRIPTION" |
| 36 |
|
| 37 |
.PP |
| 38 |
\fBswapcontext\fR swaps out context \fIold_ctx\fR with new context \fInew_ctx\fR. The \fIint r#\fR values have no place in the system call functionality. The \fIregs\fR value indicates the current user register values from the user stack. |
| 39 |
|
| 40 |
.SH "RETURN VALUE" |
| 41 |
|
| 42 |
.PP |
| 43 |
\fBswapcontext\fR returns 0 on success; otherwise, \fBswapcontext\fR returns one of the errors listed in the "Errors" section. |
| 44 |
|
| 45 |
.SH "ERRORS" |
| 46 |
|
| 47 |
.TP |
| 48 |
-EFAULT |
| 49 |
\fIswapcontext\fR could not verify that the memory area pointed to by \fIold_ctx\fR or \fInew_ctx\fR was accessible for the operation. |
| 50 |
|
| 51 |
.TP |
| 52 |
-SIGSEGV |
| 53 |
A fault occurred when the context was being copied into the kernel's image of the user's registers. The should only occur in an out-of-memory situation. |
| 54 |
|
| 55 |
.SH "SEE ALSO" |
| 56 |
.BR getcontext(2), |
| 57 |
.BR sigaction(2), |
| 58 |
.BR sigaltstack(2), |
| 59 |
.BR sigprocmask(2) |
| 60 |
\fB\fR |
| 61 |
|
| 62 |
.SH AUTHOR |
| 63 |
Niki Rahimi |