Bug 439685 compiler warning in callgrind/main.c
[valgrind.git] / coregrind / pub_core_syswrap.h
blob0b40b501d6d62e94f759fce1a899f1852cfface1
2 /*--------------------------------------------------------------------*/
3 /*--- System call wrappers, etc. pub_core_syswrap.h ---*/
4 /*--------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2000-2017 Julian Seward
11 jseward@acm.org
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.
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.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see <http://www.gnu.org/licenses/>.
26 The GNU General Public License is contained in the file COPYING.
29 #ifndef __PUB_CORE_SYSWRAP_H
30 #define __PUB_CORE_SYSWRAP_H
32 #include "pub_core_basics.h" // VG_ macro
33 #include "pub_core_threadstate.h" // ThreadArchState
34 #include "pub_core_tooliface.h" // CorePart
36 //--------------------------------------------------------------------
37 // PURPOSE: This module contains all the syscall junk: mostly PRE/POST
38 // wrappers, but also the main syscall jacketing code.
39 //--------------------------------------------------------------------
41 // Allocates a stack for the first thread, then runs it,
42 // as if the thread had been set up by clone()
43 extern void VG_(main_thread_wrapper_NORETURN)(ThreadId tid);
45 extern void VG_(client_syscall) ( ThreadId tid, UInt trc );
47 extern void VG_(post_syscall) ( ThreadId tid );
49 /* Clear this module's private state for thread 'tid' */
50 extern void VG_(clear_syscallInfo) ( ThreadId tid );
52 // Returns True if the given thread is currently in a system call
53 extern Bool VG_(is_in_syscall) ( ThreadId tid );
55 extern Bool VG_(is_in_kernel_restart_syscall) ( ThreadId tid );
57 // If VG_(is_in_syscall) (tid), returns the sysno the given thread is in
58 extern Word VG_(is_in_syscall_no) (ThreadId tid );
60 // Fix up a thread's state when syscall is interrupted by a signal.
61 extern void VG_(fixup_guest_state_after_syscall_interrupted)(
62 ThreadId tid,
63 Addr ip,
64 SysRes sysret,
65 Bool restart,
66 struct vki_ucontext *uc
69 #if defined(VGO_solaris)
70 // Determine if in a blocking syscall.
71 extern Bool VG_(is_ip_in_blocking_syscall)(ThreadId tid, Addr ip);
72 #endif
74 // Wait until all other threads are dead
75 extern void VG_(reap_threads)(ThreadId self);
77 // Release resources held by this thread
78 extern void VG_(cleanup_thread) ( ThreadArchState* );
80 /* fd leakage calls. */
81 extern void VG_(init_preopened_fds) ( void );
82 extern void VG_(show_open_fds) ( const HChar* when );
84 // When the final thread is done, where shall I call to shutdown the
85 // system cleanly? Is set once at startup (in m_main) and never
86 // changes after that. Is basically a pointer to the exit
87 // continuation. This is all just a nasty hack to avoid calling
88 // directly from m_syswrap to m_main at exit, since that would cause
89 // m_main to become part of a module cycle, which is silly.
90 extern void (* VG_(address_of_m_main_shutdown_actions_NORETURN) )
91 (ThreadId,VgSchedReturnCode);
93 #if defined(VGO_solaris)
94 extern void VG_(save_context)(ThreadId tid, vki_ucontext_t *uc,
95 CorePart part);
96 extern void VG_(restore_context)(ThreadId tid, vki_ucontext_t *uc,
97 CorePart part, Bool esp_is_thrptr);
98 extern void VG_(syswrap_init)(void);
99 extern void VG_(change_mapping_ownership)(Addr addr, Bool once_only);
100 extern Bool VG_(setup_client_dataseg)(void);
101 extern void VG_(track_client_dataseg)(ThreadId tid);
102 #endif
104 #if defined(VGO_freebsd)
105 extern Bool VG_(get_capability_mode)(void);
106 #endif
108 #endif // __PUB_CORE_SYSWRAP_H
110 /*--------------------------------------------------------------------*/
111 /*--- end ---*/
112 /*--------------------------------------------------------------------*/