Commit | Line | Data |
---|---|---|
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 | |
17 | struct 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 |
31 | allows users to atomically unmask, switch stacks, |
32 | and return from a signal context. | |
33 | The processes signal mask and stack status are | |
34 | restored from the context. | |
35 | The system call does not return; | |
36 | the users stack pointer, frame pointer, argument pointer, | |
37 | and processor status longword are restored from the context. | |
38 | Execution resumes at the specified pc. | |
931b8415 CL |
39 | This system call is used by the trampoline code and |
40 | .Xr longjmp 3 | |
6decfcd4 | 41 | when returning from a signal to the previously executing program. |
931b8415 CL |
42 | .Sh NOTES |
43 | This system call is not available in 4.2 | |
44 | .Tn BSD | |
6decfcd4 | 45 | hence it should not be used if backward compatibility is needed. |
931b8415 | 46 | .Sh RETURN VALUES |
6decfcd4 | 47 | If successful, the system call does not return. |
931b8415 CL |
48 | Otherwise, a value of -1 is returned and |
49 | .Va errno | |
6decfcd4 | 50 | is set to indicate the error. |
931b8415 CL |
51 | .Sh ERRORS |
52 | .Fn Sigreturn | |
6decfcd4 KM |
53 | will fail and the process context will remain unchanged |
54 | if one of the following occurs. | |
931b8415 CL |
55 | .Bl -tag -width [EINVAL] |
56 | .It Bq Er EFAULT | |
57 | .Fa Scp | |
eff6446c | 58 | points to memory that is not a valid part of the process |
6decfcd4 | 59 | address space. |
931b8415 | 60 | .It Bq Er EINVAL |
6decfcd4 KM |
61 | The process status longword is invalid or would improperly |
62 | raise 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 | |
68 | The | |
69 | .Nm | |
70 | function call appeared in | |
71 | .Bx 4.3 . |