1SIGRETURN(2) System Calls Manual SIGRETURN(2)
2
3
4
6 sigreturn - return from signal
7
9 #include <signal.h>
10
11 struct sigcontext {
12 int sc_onstack;
13 long sc_mask;
14 int sc_sp;
15 int sc_fp;
16 int sc_ap;
17 int sc_pc;
18 int sc_ps;
19 };
20
21 sigreturn(scp);
22 struct sigcontext *scp;
23
25 Sigreturn allows users to atomically unmask, switch stacks, and return
26 from a signal context. The processes signal mask and stack status are
27 restored from the context. The system call does not return; the users
28 stack pointer, frame pointer, argument pointer, and processor status
29 longword are restored from the context. Execution resumes at the spec‐
30 ified pc. This system call is used by the trampoline code, and
31 longjmp(3) when returning from a signal to the previously executing
32 program.
33
35 This system call is not available in 4.2BSD, hence it should not be
36 used if backward compatibility is needed.
37
38 The definition of the sigcontext structure is machine dependent (the
39 structure cited above is that for a VAX running 4.3BSD); no program
40 should depend on its internal structure. Setjmp(3) may be used to
41 build sigcontext structures in a machine independent manner.
42
44 If successful, the system call does not return. Otherwise, a value of
45 -1 is returned and errno is set to indicate the error.
46
48 Sigreturn will fail and the process context will remain unchanged if
49 one of the following occurs.
50
51 [EFAULT] Scp points to memory that is not a valid part of the
52 process address space.
53
54 [EINVAL] The process status longword is invalid or would improp‐
55 erly raise the privilege level of the process.
56
58 sigvec(2), setjmp(3)
59
61 On the PDP-11 the field sc_ap (argument pointer) does not exist and the
62 field sc_fp (frame pointer) is the PDP-11 register r5. Additionally,
63 three new fields sc_r0, sc_r1 and sc_ovno are present on the PDP-11
64 which hold register values r0 and r1 and the text overlay number to
65 restore (see ld(1)).
66
67 struct sigcontext {
68 int sc_onstack; /* sigstack state to restore */
69 long sc_mask; /* signal mask to restore */
70 int sc_sp; /* sp to restore */
71 int sc_fp; /* fp to restore */
72 int sc_r1; /* r1 to restore */
73 int sc_r0; /* r0 to restore */
74 int sc_pc; /* pc to restore */
75 int sc_ps; /* psl to restore */
76 int sc_ovno /* overlay to restore */
77 };
78
79
80
814.3 Berkeley Distribution June 30, 1985 SIGRETURN(2)