readlink.2 rename.2 unlink.2
[unix-history] / usr / src / lib / libc / sys / sigreturn.2
CommitLineData
931b8415 1.\" Copyright (c) 1985, 1991 The Regents of the University of California.
88b3ccf2 2.\" All rights reserved.
6decfcd4 3.\"
91cff1e1 4.\" %sccs.include.redist.man%
88b3ccf2 5.\"
931b8415 6.\" @(#)sigreturn.2 6.5 (Berkeley) %G%
6decfcd4 7.\"
931b8415
CL
8.Dd
9.Dt SIGRETURN 2
10.Os BSD 4.3
11.Sh NAME
12.Nm sigreturn
13.Nd return from signal
14.Sh SYNOPSIS
15.Fd #include <sys/signal.h>
16.Bd -literal
17struct sigcontext {
18 int sc_onstack;
19 int sc_mask;
20 int sc_sp;
21 int sc_fp;
22 int sc_ap;
23 int sc_pc;
24 int sc_ps;
25};
26.Ed
27.Ft int
28.Fn sigreturn "struct sigcontext *scp"
29.Sh DESCRIPTION
30.Fn Sigreturn
6decfcd4
KM
31allows users to atomically unmask, switch stacks,
32and return from a signal context.
33The processes signal mask and stack status are
34restored from the context.
35The system call does not return;
36the users stack pointer, frame pointer, argument pointer,
37and processor status longword are restored from the context.
38Execution resumes at the specified pc.
931b8415
CL
39This system call is used by the trampoline code and
40.Xr longjmp 3
6decfcd4 41when returning from a signal to the previously executing program.
931b8415
CL
42.Sh NOTES
43This system call is not available in 4.2
44.Tn BSD
6decfcd4 45hence it should not be used if backward compatibility is needed.
931b8415 46.Sh RETURN VALUES
6decfcd4 47If successful, the system call does not return.
931b8415
CL
48Otherwise, a value of -1 is returned and
49.Va errno
6decfcd4 50is set to indicate the error.
931b8415
CL
51.Sh ERRORS
52.Fn Sigreturn
6decfcd4
KM
53will fail and the process context will remain unchanged
54if one of the following occurs.
931b8415
CL
55.Bl -tag -width [EINVAL]
56.It Bq Er EFAULT
57.Fa Scp
eff6446c 58points to memory that is not a valid part of the process
6decfcd4 59address space.
931b8415 60.It Bq Er EINVAL
6decfcd4
KM
61The process status longword is invalid or would improperly
62raise the privilege level of the process.
931b8415
CL
63.El
64.Sh SEE ALSO
65.Xr sigvec 2 ,
66.Xr setjmp 3
67.Sh HISTORY
68The
69.Nm
70function call appeared in
71.Bx 4.3 .