2 /*--------------------------------------------------------------------*/
3 /*--- Process-related libc stuff. pub_core_libcproc.h ---*/
4 /*--------------------------------------------------------------------*/
7 This file is part of Valgrind, a dynamic binary instrumentation
10 Copyright (C) 2000-2017 Julian Seward
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_LIBCPROC_H
30 #define __PUB_CORE_LIBCPROC_H
32 //--------------------------------------------------------------------
33 // PURPOSE: This module contains libc code related to the process.
34 // It's a bit of a mixed bag.
35 //--------------------------------------------------------------------
37 #include "config.h" // Crucial: ensure we get ENABLE_INNER
38 #include "pub_tool_libcproc.h"
40 /* The directory we look for all our auxiliary files in. Useful for
41 running Valgrind out of a build tree without having to do "make
42 install". Inner valgrinds require a different lib variable, else
43 they end up picking up .so's etc intended for the outer
46 # define VALGRIND_LIB "VALGRIND_LIB_INNER"
48 # define VALGRIND_LIB "VALGRIND_LIB"
51 /* Additional command-line arguments; they are overridden by actual
52 command-line option. Each argument is separated by spaces. There
53 is no quoting mechanism. */
54 #define VALGRIND_OPTS "VALGRIND_OPTS"
56 /* The full name of Valgrind's stage1 (launcher) executable. This is
57 set by stage1 and read by stage2, and is used for recursive
58 invocations of Valgrind on child processes.
60 For self-hosting, the inner and outer Valgrinds must use different
61 names to avoid collisions. */
63 # define VALGRIND_LAUNCHER "VALGRIND_LAUNCHER_INNER"
65 # define VALGRIND_LAUNCHER "VALGRIND_LAUNCHER"
69 // Environment manipulations
70 extern HChar
**VG_(env_setenv
) ( HChar
***envp
, const HChar
* varname
,
72 extern void VG_(env_unsetenv
) ( HChar
**env
, const HChar
*varname
,
73 void (*free_fn
) ( void *) );
74 extern void VG_(env_remove_valgrind_env_stuff
) ( HChar
** env
,
76 void (*free_fn
) (void *) );
77 extern HChar
**VG_(env_clone
) ( HChar
**env_clone
);
80 extern Int
VG_(getgroups
)( Int size
, UInt
* list
);
81 extern Int
VG_(ptrace
)( Int request
, Int pid
, void *addr
, void *data
);
84 extern void VG_(do_atfork_pre
) ( ThreadId tid
);
85 extern void VG_(do_atfork_parent
) ( ThreadId tid
);
86 extern void VG_(do_atfork_child
) ( ThreadId tid
);
88 #if defined(VGO_freebsd)
89 // sysctlbyname, getosreldate, is32on64
90 extern Int
VG_(sysctlbyname
)(const HChar
*name
, void *oldp
, SizeT
*oldlenp
, const void *newp
, SizeT newlen
);
91 extern Bool
VG_(is32on64
)(void);
103 // icache invalidation
104 extern void VG_(invalidate_icache
) ( void *ptr
, SizeT nbytes
);
107 extern void VG_(flush_dcache
) ( void *ptr
, SizeT nbytes
);
109 #endif // __PUB_CORE_LIBCPROC_H
111 /*--------------------------------------------------------------------*/
113 /*--------------------------------------------------------------------*/