1 2 /*--------------------------------------------------------------------*/ 3 /*--- Process-related libc stuff pub_tool_libcproc.h ---*/ 4 /*--------------------------------------------------------------------*/ 5 6 /* 7 This file is part of Valgrind, a dynamic binary instrumentation 8 framework. 9 10 Copyright (C) 2000-2010 Julian Seward 11 jseward (at) 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_TOOL_LIBCPROC_H 32 #define __PUB_TOOL_LIBCPROC_H 33 34 /* --------------------------------------------------------------------- 35 Command-line and environment stuff 36 ------------------------------------------------------------------ */ 37 38 /* Client environment. */ 39 extern Char** VG_(client_envp); 40 41 /* Looks up VG_(client_envp) */ 42 extern Char* VG_(getenv) ( Char* name ); 43 44 /* Path to all our library/aux files */ 45 extern const Char *VG_(libdir); 46 47 // The name of the LD_PRELOAD-equivalent variable. It varies across 48 // platforms. 49 extern const Char* VG_(LD_PRELOAD_var_name); 50 51 /* --------------------------------------------------------------------- 52 Important syscalls 53 ------------------------------------------------------------------ */ 54 55 extern Int VG_(waitpid)( Int pid, Int *status, Int options ); 56 extern Int VG_(system) ( Char* cmd ); 57 extern Int VG_(fork) ( void); 58 extern void VG_(execv) ( Char* filename, Char** argv ); 59 60 /* --------------------------------------------------------------------- 61 Resource limits 62 ------------------------------------------------------------------ */ 63 64 extern Int VG_(getrlimit) ( Int resource, struct vki_rlimit *rlim ); 65 extern Int VG_(setrlimit) ( Int resource, const struct vki_rlimit *rlim ); 66 67 /* --------------------------------------------------------------------- 68 pids, etc 69 ------------------------------------------------------------------ */ 70 71 extern Int VG_(gettid) ( void ); 72 extern Int VG_(getpid) ( void ); 73 extern Int VG_(getppid) ( void ); 74 extern Int VG_(getpgrp) ( void ); 75 extern Int VG_(geteuid) ( void ); 76 extern Int VG_(getegid) ( void ); 77 78 /* --------------------------------------------------------------------- 79 Timing 80 ------------------------------------------------------------------ */ 81 82 // Returns the number of milliseconds passed since the progam started 83 // (roughly; it gets initialised partway through Valgrind's initialisation 84 // steps). 85 extern UInt VG_(read_millisecond_timer) ( void ); 86 87 /* --------------------------------------------------------------------- 88 atfork 89 ------------------------------------------------------------------ */ 90 91 typedef void (*vg_atfork_t)(ThreadId); 92 extern void VG_(atfork)(vg_atfork_t pre, vg_atfork_t parent, vg_atfork_t child); 93 94 95 #endif // __PUB_TOOL_LIBCPROC_H 96 97 /*--------------------------------------------------------------------*/ 98 /*--- end ---*/ 99 /*--------------------------------------------------------------------*/ 100