njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
| 3 | /*--- Process-related libc stuff. pub_core_libcproc.h ---*/ |
| 4 | /*--------------------------------------------------------------------*/ |
| 5 | |
| 6 | /* |
| 7 | This file is part of Valgrind, a dynamic binary instrumentation |
| 8 | framework. |
| 9 | |
Elliott Hughes | ed39800 | 2017-06-21 14:41:24 -0700 | [diff] [blame^] | 10 | Copyright (C) 2000-2017 Julian Seward |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 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_LIBCPROC_H |
| 32 | #define __PUB_CORE_LIBCPROC_H |
| 33 | |
| 34 | //-------------------------------------------------------------------- |
| 35 | // PURPOSE: This module contains libc code related to the process. |
| 36 | // It's a bit of a mixed bag. |
| 37 | //-------------------------------------------------------------------- |
| 38 | |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 39 | #include "config.h" // Crucial: ensure we get ENABLE_INNER |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 40 | #include "pub_tool_libcproc.h" |
| 41 | |
Elliott Hughes | ed39800 | 2017-06-21 14:41:24 -0700 | [diff] [blame^] | 42 | /* The directory we look for all our auxiliary files in. Useful for |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 43 | running Valgrind out of a build tree without having to do "make |
| 44 | install". Inner valgrinds require a different lib variable, else |
| 45 | they end up picking up .so's etc intended for the outer |
| 46 | valgrind. */ |
| 47 | #ifdef ENABLE_INNER |
| 48 | # define VALGRIND_LIB "VALGRIND_LIB_INNER" |
| 49 | #else |
| 50 | # define VALGRIND_LIB "VALGRIND_LIB" |
| 51 | #endif |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 52 | |
| 53 | /* Additional command-line arguments; they are overridden by actual |
| 54 | command-line option. Each argument is separated by spaces. There |
| 55 | is no quoting mechanism. */ |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 56 | #define VALGRIND_OPTS "VALGRIND_OPTS" |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 57 | |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 58 | /* The full name of Valgrind's stage1 (launcher) executable. This is |
| 59 | set by stage1 and read by stage2, and is used for recursive |
| 60 | invocations of Valgrind on child processes. |
| 61 | |
| 62 | For self-hosting, the inner and outer Valgrinds must use different |
| 63 | names to avoid collisions. */ |
| 64 | #ifdef ENABLE_INNER |
| 65 | # define VALGRIND_LAUNCHER "VALGRIND_LAUNCHER_INNER" |
| 66 | #else |
| 67 | # define VALGRIND_LAUNCHER "VALGRIND_LAUNCHER" |
| 68 | #endif |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 69 | |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 70 | |
| 71 | // Environment manipulations |
florian | 19f91bb | 2012-11-10 22:29:54 +0000 | [diff] [blame] | 72 | extern HChar **VG_(env_setenv) ( HChar ***envp, const HChar* varname, |
| 73 | const HChar *val ); |
sewardj | 8eb8bab | 2015-07-21 14:44:28 +0000 | [diff] [blame] | 74 | extern void VG_(env_unsetenv) ( HChar **env, const HChar *varname, |
| 75 | void (*free_fn) ( void *) ); |
| 76 | extern void VG_(env_remove_valgrind_env_stuff) ( HChar** env, |
| 77 | Bool ro_strings, |
| 78 | void (*free_fn) (void *) ); |
florian | 19f91bb | 2012-11-10 22:29:54 +0000 | [diff] [blame] | 79 | extern HChar **VG_(env_clone) ( HChar **env_clone ); |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 80 | |
| 81 | // misc |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 82 | extern Int VG_(getgroups)( Int size, UInt* list ); |
| 83 | extern Int VG_(ptrace)( Int request, Int pid, void *addr, void *data ); |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 84 | |
| 85 | // atfork |
njn | e9ba34a | 2008-10-13 04:19:15 +0000 | [diff] [blame] | 86 | extern void VG_(do_atfork_pre) ( ThreadId tid ); |
| 87 | extern void VG_(do_atfork_parent) ( ThreadId tid ); |
| 88 | extern void VG_(do_atfork_child) ( ThreadId tid ); |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 89 | |
sewardj | 291849f | 2012-04-20 23:58:55 +0000 | [diff] [blame] | 90 | // icache invalidation |
| 91 | extern void VG_(invalidate_icache) ( void *ptr, SizeT nbytes ); |
| 92 | |
sewardj | c76d0e5 | 2014-05-03 21:22:55 +0000 | [diff] [blame] | 93 | // dcache flushing |
| 94 | extern void VG_(flush_dcache) ( void *ptr, SizeT nbytes ); |
sewardj | 291849f | 2012-04-20 23:58:55 +0000 | [diff] [blame] | 95 | |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 96 | #endif // __PUB_CORE_LIBCPROC_H |
| 97 | |
| 98 | /*--------------------------------------------------------------------*/ |
| 99 | /*--- end ---*/ |
| 100 | /*--------------------------------------------------------------------*/ |