add note about finding the end of memory
[unix-history] / usr / src / lib / libc / sys / sigreturn.2
CommitLineData
6decfcd4
KM
1.\" Copyright (c) 1985 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
eff6446c 5.\" @(#)sigreturn.2 6.2 (Berkeley) %G%
6decfcd4
KM
6.\"
7.TH SIGRETURN 2 ""
8.UC 6
9.SH NAME
10sigreturn \- return from signal
11.SH SYNOPSIS
12.nf
13.B #include <signal.h>
14.PP
15.B struct sigcontext {
16.B int sc_onstack;
17.B int sc_mask;
18.B int sc_sp;
19.B int sc_fp;
20.B int sc_ap;
21.B int sc_pc;
22.B int sc_ps;
23.B };
24.PP
25.B sigreturn(scp);
26.B struct sigcontext *scp;
27.SH DESCRIPTION
28.I Sigreturn
29allows users to atomically unmask, switch stacks,
30and return from a signal context.
31The processes signal mask and stack status are
32restored from the context.
33The system call does not return;
34the users stack pointer, frame pointer, argument pointer,
35and processor status longword are restored from the context.
36Execution resumes at the specified pc.
37This system call is used by the trampoline code, and
38.IR longjmp (3)
39when returning from a signal to the previously executing program.
40.SH NOTES
41This system call is not available in 4.2BSD,
42hence it should not be used if backward compatibility is needed.
43.SH "RETURN VALUE
44If successful, the system call does not return.
45Otherwise, a value of \-1 is returned and
46.I errno
47is set to indicate the error.
48.SH ERRORS
49.I Sigreturn
50will fail and the process context will remain unchanged
51if one of the following occurs.
52.TP 15
53[EFAULT]
54.I Scp
eff6446c 55points to memory that is not a valid part of the process
6decfcd4
KM
56address space.
57.TP
58[EINVAL]
59The process status longword is invalid or would improperly
60raise the privilege level of the process.
61.SH "SEE ALSO"
62sigvec(2), setjmp(3)