sewardj | cbdddcf | 2005-03-10 23:23:45 +0000 | [diff] [blame] | 1 | /*--------------------------------------------------------------------*/ |
| 2 | /*--- Various things we want to wrap. vg_intercept.c ---*/ |
| 3 | /*--------------------------------------------------------------------*/ |
| 4 | |
| 5 | /* |
| 6 | This file is part of Valgrind, an extensible x86 protected-mode |
| 7 | emulator for monitoring program execution on x86-Unixes. |
| 8 | |
njn | 5361242 | 2005-03-12 16:22:54 +0000 | [diff] [blame] | 9 | Copyright (C) 2000-2005 Julian Seward |
sewardj | cbdddcf | 2005-03-10 23:23:45 +0000 | [diff] [blame] | 10 | jseward@acm.org |
| 11 | |
| 12 | This program is free software; you can redistribute it and/or |
| 13 | modify it under the terms of the GNU General Public License as |
| 14 | published by the Free Software Foundation; either version 2 of the |
| 15 | License, or (at your option) any later version. |
| 16 | |
| 17 | This program is distributed in the hope that it will be useful, but |
| 18 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 20 | General Public License for more details. |
| 21 | |
| 22 | You should have received a copy of the GNU General Public License |
| 23 | along with this program; if not, write to the Free Software |
| 24 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 25 | 02111-1307, USA. |
| 26 | |
| 27 | The GNU General Public License is contained in the file COPYING. |
| 28 | */ |
| 29 | |
| 30 | |
| 31 | /* --------------------------------------------------------------------- |
| 32 | ALL THE CODE IN THIS FILE RUNS ON THE SIMULATED CPU. It is |
| 33 | intended for various reasons as drop-in replacements for libc |
| 34 | functions. These functions are not called directly - they're the |
| 35 | targets of code redirection. They're named weirdly so that the |
| 36 | intercept code can find them when the shared object is initially |
| 37 | loaded. |
| 38 | ------------------------------------------------------------------ */ |
| 39 | |
| 40 | #include "valgrind.h" |
| 41 | #include "core.h" |
| 42 | #include <unistd.h> |
| 43 | #include <pthread.h> |
| 44 | #include <dlfcn.h> |
| 45 | |
| 46 | /* --------------------------------------------------------------------- |
| 47 | Hook for running __libc_freeres once the program exits. |
| 48 | ------------------------------------------------------------------ */ |
| 49 | |
sewardj | 2c5ffbe | 2005-03-12 13:32:06 +0000 | [diff] [blame] | 50 | void VG_WRAPPER(freeres)( void ); |
sewardj | cbdddcf | 2005-03-10 23:23:45 +0000 | [diff] [blame] | 51 | void VG_WRAPPER(freeres)( void ) |
| 52 | { |
| 53 | int res; |
| 54 | #ifndef __UCLIBC__ |
| 55 | extern void __libc_freeres(void); |
| 56 | __libc_freeres(); |
| 57 | #endif |
| 58 | VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */, |
| 59 | VG_USERREQ__LIBC_FREERES_DONE, 0, 0, 0, 0); |
| 60 | /*NOTREACHED*/ |
| 61 | *(int *)0 = 'x'; |
| 62 | } |
| 63 | |
| 64 | /*--------------------------------------------------------------------*/ |
| 65 | /*--- end vg_intercept.c ---*/ |
| 66 | /*--------------------------------------------------------------------*/ |
| 67 | |