1.\" Copyright (c) 1985, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)sigreturn.2 8.1 (Berkeley) 06/04/93 7.\" 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 <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 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. 39This system call is used by the trampoline code and 40.Xr longjmp 3 41when returning from a signal to the previously executing program. 42.Sh NOTES 43This system call is not available in 4.2 44.Tn BSD 45hence it should not be used if backward compatibility is needed. 46.Sh RETURN VALUES 47If successful, the system call does not return. 48Otherwise, a value of -1 is returned and 49.Va errno 50is set to indicate the error. 51.Sh ERRORS 52.Fn Sigreturn 53will fail and the process context will remain unchanged 54if one of the following occurs. 55.Bl -tag -width [EINVAL] 56.It Bq Er EFAULT 57.Fa Scp 58points to memory that is not a valid part of the process 59address space. 60.It Bq Er EINVAL 61The process status longword is invalid or would improperly 62raise the privilege level of the process. 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 . 72