blob: 8ca0fa9f8b802563800ca4bdddcad1b313dbdf37 [file] [log] [blame]
njn2521d322005-05-08 14:45:13 +00001
2/*--------------------------------------------------------------------*/
njnc1b01812005-06-17 22:19:06 +00003/*--- System call wrappers, etc. pub_core_syswrap.h ---*/
njn2521d322005-05-08 14:45:13 +00004/*--------------------------------------------------------------------*/
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
njnc1b01812005-06-17 22:19:06 +000031#ifndef __PUB_CORE_SYSWRAP_H
32#define __PUB_CORE_SYSWRAP_H
njn2521d322005-05-08 14:45:13 +000033
34//--------------------------------------------------------------------
njn899ce732005-06-21 00:28:11 +000035// PURPOSE: This module contains all the syscall junk: mostly PRE/POST
36// wrappers, but also the main syscall jacketing code.
njn2521d322005-05-08 14:45:13 +000037//--------------------------------------------------------------------
38
njn8c2e1532005-06-10 23:16:13 +000039// Return how many bytes of a thread's Valgrind stack are unused
njnaf839f52005-06-23 03:27:57 +000040extern SSizeT VG_(stack_unused)(ThreadId tid);
njn8c2e1532005-06-10 23:16:13 +000041
42// Allocates a stack for the first thread, then runs it,
43// as if the thread had been set up by clone()
njnaf839f52005-06-23 03:27:57 +000044extern void VG_(main_thread_wrapper_NORETURN)(ThreadId tid);
njn8c2e1532005-06-10 23:16:13 +000045
njn2521d322005-05-08 14:45:13 +000046extern void VG_(client_syscall) ( ThreadId tid );
47
48extern void VG_(post_syscall) ( ThreadId tid );
49
sewardja8d8e232005-06-07 20:04:56 +000050/* Clear this module's private state for thread 'tid' */
51extern void VG_(clear_syscallInfo) ( Int tid );
52
53// Fix up a thread's state when syscall is interrupted by a signal.
54extern void VG_(fixup_guest_state_after_syscall_interrupted)(
55 ThreadId tid,
56 Addr ip,
57 UWord sysnum,
58 SysRes sysret,
59 Bool restart
60 );
njn2521d322005-05-08 14:45:13 +000061
njn7b85dd52005-06-12 17:26:29 +000062// Wait until all other threads are dead
63extern void VG_(reap_threads)(ThreadId self);
64
njn2335d112005-05-15 20:52:04 +000065// Release resources held by this thread
njnaf839f52005-06-23 03:27:57 +000066extern void VG_(cleanup_thread) ( ThreadArchState* );
njn2335d112005-05-15 20:52:04 +000067
njn2521d322005-05-08 14:45:13 +000068/* fd leakage calls. */
69extern void VG_(init_preopened_fds) ( void );
70extern void VG_(show_open_fds) ( void );
71
njnc1b01812005-06-17 22:19:06 +000072#endif // __PUB_CORE_SYSWRAP_H
njn2521d322005-05-08 14:45:13 +000073
74/*--------------------------------------------------------------------*/
75/*--- end ---*/
76/*--------------------------------------------------------------------*/
77