1ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 2ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/*--------------------------------------------------------------------*/ 3ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/*--- Process-related libc stuff pub_tool_libcproc.h ---*/ 4ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/*--------------------------------------------------------------------*/ 5ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 6ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/* 7ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown This file is part of Valgrind, a dynamic binary instrumentation 8ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown framework. 9ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 10663860b1408516d02ebfcb3a9999a134e6cfb223Ben Cheng Copyright (C) 2000-2012 Julian Seward 11ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown jseward@acm.org 12ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 13ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown This program is free software; you can redistribute it and/or 14ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown modify it under the terms of the GNU General Public License as 15ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown published by the Free Software Foundation; either version 2 of the 16ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown License, or (at your option) any later version. 17ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 18ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown This program is distributed in the hope that it will be useful, but 19ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown WITHOUT ANY WARRANTY; without even the implied warranty of 20ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown General Public License for more details. 22ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 23ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown You should have received a copy of the GNU General Public License 24ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown along with this program; if not, write to the Free Software 25ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 26ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 02111-1307, USA. 27ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 28ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown The GNU General Public License is contained in the file COPYING. 29ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown*/ 30ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 31ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown#ifndef __PUB_TOOL_LIBCPROC_H 32ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown#define __PUB_TOOL_LIBCPROC_H 33ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 34ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/* --------------------------------------------------------------------- 35ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown Command-line and environment stuff 36ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown ------------------------------------------------------------------ */ 37ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 38ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/* Client environment. */ 39ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Char** VG_(client_envp); 40ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 41ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/* Looks up VG_(client_envp) */ 42ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Char* VG_(getenv) ( Char* name ); 43ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 44ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/* Path to all our library/aux files */ 45ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern const Char *VG_(libdir); 46ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 47ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown// The name of the LD_PRELOAD-equivalent variable. It varies across 48ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown// platforms. 49ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern const Char* VG_(LD_PRELOAD_var_name); 50ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 51ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/* --------------------------------------------------------------------- 52ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown Important syscalls 53ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown ------------------------------------------------------------------ */ 54ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 55ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Int VG_(waitpid)( Int pid, Int *status, Int options ); 56ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Int VG_(system) ( Char* cmd ); 57ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Int VG_(fork) ( void); 58ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern void VG_(execv) ( Char* filename, Char** argv ); 59ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 60ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/* --------------------------------------------------------------------- 61b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov Resource limits and capabilities 62ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown ------------------------------------------------------------------ */ 63ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 64ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Int VG_(getrlimit) ( Int resource, struct vki_rlimit *rlim ); 65ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Int VG_(setrlimit) ( Int resource, const struct vki_rlimit *rlim ); 66b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanovextern Int VG_(prctl) (Int option, 67b32f58018498ea2225959b0ba11c18f0c433deefEvgeniy Stepanov ULong arg2, ULong arg3, ULong arg4, ULong arg5); 68ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 69ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/* --------------------------------------------------------------------- 70ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown pids, etc 71ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown ------------------------------------------------------------------ */ 72ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 73ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Int VG_(gettid) ( void ); 74ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Int VG_(getpid) ( void ); 75ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Int VG_(getppid) ( void ); 76ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Int VG_(getpgrp) ( void ); 77ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Int VG_(geteuid) ( void ); 78ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern Int VG_(getegid) ( void ); 79ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 80ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/* --------------------------------------------------------------------- 81ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown Timing 82ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown ------------------------------------------------------------------ */ 83ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 84ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown// Returns the number of milliseconds passed since the progam started 85ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown// (roughly; it gets initialised partway through Valgrind's initialisation 86ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown// steps). 87ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern UInt VG_(read_millisecond_timer) ( void ); 88ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 89ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/* --------------------------------------------------------------------- 90ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown atfork 91ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown ------------------------------------------------------------------ */ 92ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 93ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Browntypedef void (*vg_atfork_t)(ThreadId); 94ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brownextern void VG_(atfork)(vg_atfork_t pre, vg_atfork_t parent, vg_atfork_t child); 95ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 96ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 97ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown#endif // __PUB_TOOL_LIBCPROC_H 98ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown 99ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/*--------------------------------------------------------------------*/ 100ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/*--- end ---*/ 101ed07e00d438c74b7a23c01bfffde77e3968305e4Jeff Brown/*--------------------------------------------------------------------*/ 102