blob: 444694d7f2002dda5c5f8c43bb608122dcdf2014 [file] [log] [blame]
njn0c246472005-05-31 01:00:08 +00001
2/*--------------------------------------------------------------------*/
3/*--- POSIX signals. pub_core_signals.h ---*/
4/*--------------------------------------------------------------------*/
5
6/*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
9
10 Copyright (C) 2000-2005 Julian Seward
11 jseward@acm.org
12
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 02111-1307, USA.
27
28 The GNU General Public License is contained in the file COPYING.
29*/
30
31#ifndef __PUB_CORE_SIGNALS_H
32#define __PUB_CORE_SIGNALS_H
33
34//--------------------------------------------------------------------
35// PURPOSE: This module implements all the signal handling stuff.
36//--------------------------------------------------------------------
37
38/* Highest signal the kernel will let us use */
39extern Int VG_(max_signal);
40
41extern void VG_(sigstartup_actions) ( void );
42
sewardja8d8e232005-06-07 20:04:56 +000043/* Poll a thread's set of pending signals, and update the Thread's
44 context to deliver one (viz, create signal frames if needed) */
njn0c246472005-05-31 01:00:08 +000045extern void VG_(poll_signals) ( ThreadId );
46
47/* Fake system calls for signal handling. */
sewardja8d8e232005-06-07 20:04:56 +000048extern SysRes VG_(do_sys_sigaltstack) ( ThreadId tid, vki_stack_t* ss,
49 vki_stack_t* oss );
50extern SysRes VG_(do_sys_sigaction) ( Int signo,
51 const struct vki_sigaction *new_act,
52 struct vki_sigaction *old_act );
53extern SysRes VG_(do_sys_sigprocmask) ( ThreadId tid, Int how,
54 vki_sigset_t* set,
55 vki_sigset_t* oldset );
njn0c246472005-05-31 01:00:08 +000056
57extern void VG_(clear_out_queued_signals)
58 ( ThreadId tid, /* OUT */ vki_sigset_t* saved_mask );
59
60extern void VG_(kill_self)(Int sigNo);
61
62/* These function synthesize a fault, as if the running instruction
63 had had a fault. These functions do not return - they longjmp back
64 into the scheduler so the signal can be delivered. */
65extern void VG_(synth_fault) (ThreadId tid);
66extern void VG_(synth_fault_mapping)(ThreadId tid, Addr addr);
67extern void VG_(synth_fault_perms) (ThreadId tid, Addr addr);
68extern void VG_(synth_sigill) (ThreadId tid, Addr addr);
69
70/* Extend the stack to cover addr, if possible */
71extern Bool VG_(extend_stack)(Addr addr, UInt maxsize);
72
73/* Returns True if the signal is OK for the client to use */
74extern Bool VG_(client_signal_OK)(Int sigNo);
75
76/* Forces the client's signal handler to SIG_DFL - generally just
77 before using that signal to kill the process. */
78extern void VG_(set_default_handler)(Int sig);
79
80#endif // __PUB_CORE_SIGNALS_H
81
82/*--------------------------------------------------------------------*/
83/*--- end ---*/
84/*--------------------------------------------------------------------*/