njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
| 3 | /*--- System call wrappers, etc. pub_core_syscalls.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_SYSCALLS_H |
| 32 | #define __PUB_CORE_SYSCALLS_H |
| 33 | |
| 34 | //-------------------------------------------------------------------- |
| 35 | // PURPOSE: This module contains all the syscall junk: mostly wrappers, |
| 36 | // but also the code that executes them, and related stuff. |
| 37 | //-------------------------------------------------------------------- |
| 38 | |
njn | 8c2e153 | 2005-06-10 23:16:13 +0000 | [diff] [blame] | 39 | // Return how many bytes of a thread's Valgrind stack are unused |
| 40 | extern SSizeT VGA_(stack_unused)(ThreadId tid); |
| 41 | |
| 42 | // Allocates a stack for the first thread, then runs it, |
| 43 | // as if the thread had been set up by clone() |
| 44 | extern void VGP_(main_thread_wrapper_NORETURN)(ThreadId tid); |
| 45 | |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 46 | extern HChar* VG_(resolve_filename_nodup)(Int fd); |
| 47 | extern HChar* VG_(resolve_filename)(Int fd); |
| 48 | |
| 49 | extern void VG_(client_syscall) ( ThreadId tid ); |
| 50 | |
| 51 | extern void VG_(post_syscall) ( ThreadId tid ); |
| 52 | |
sewardj | a8d8e23 | 2005-06-07 20:04:56 +0000 | [diff] [blame] | 53 | /* Clear this module's private state for thread 'tid' */ |
| 54 | extern void VG_(clear_syscallInfo) ( Int tid ); |
| 55 | |
| 56 | // Fix up a thread's state when syscall is interrupted by a signal. |
| 57 | extern void VG_(fixup_guest_state_after_syscall_interrupted)( |
| 58 | ThreadId tid, |
| 59 | Addr ip, |
| 60 | UWord sysnum, |
| 61 | SysRes sysret, |
| 62 | Bool restart |
| 63 | ); |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 64 | |
njn | 7b85dd5 | 2005-06-12 17:26:29 +0000 | [diff] [blame] | 65 | // Wait until all other threads are dead |
| 66 | extern void VG_(reap_threads)(ThreadId self); |
| 67 | |
njn | 2335d11 | 2005-05-15 20:52:04 +0000 | [diff] [blame] | 68 | // Release resources held by this thread |
| 69 | extern void VGP_(cleanup_thread) ( ThreadArchState* ); |
| 70 | |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 71 | /* fd leakage calls. */ |
| 72 | extern void VG_(init_preopened_fds) ( void ); |
| 73 | extern void VG_(show_open_fds) ( void ); |
| 74 | |
| 75 | #endif // __PUB_CORE_SYSCALLS_H |
| 76 | |
| 77 | /*--------------------------------------------------------------------*/ |
| 78 | /*--- end ---*/ |
| 79 | /*--------------------------------------------------------------------*/ |
| 80 | |