blob: 7432b82ae49f844c498d5a5dcbdbcfa09dd95a40 [file] [log] [blame]
njnf39e9a32005-06-12 02:43:17 +00001
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
sewardj03f8d3f2012-08-05 15:46:46 +000010 Copyright (C) 2000-2012 Julian Seward
njnf39e9a32005-06-12 02:43:17 +000011 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_TOOL_LIBCPROC_H
32#define __PUB_TOOL_LIBCPROC_H
33
34/* ---------------------------------------------------------------------
35 Command-line and environment stuff
36 ------------------------------------------------------------------ */
37
njn08ce7b32009-02-27 03:38:28 +000038/* Client environment. */
florian19f91bb2012-11-10 22:29:54 +000039extern HChar** VG_(client_envp);
njnf39e9a32005-06-12 02:43:17 +000040
41/* Looks up VG_(client_envp) */
florian19f91bb2012-11-10 22:29:54 +000042extern HChar* VG_(getenv) ( const HChar* name );
njnf39e9a32005-06-12 02:43:17 +000043
njn8d9965c2005-06-12 17:47:24 +000044/* Path to all our library/aux files */
florian19f91bb2012-11-10 22:29:54 +000045extern const HChar *VG_(libdir);
njn8d9965c2005-06-12 17:47:24 +000046
njne323a6b2010-07-01 02:35:03 +000047// The name of the LD_PRELOAD-equivalent variable. It varies across
48// platforms.
florian19f91bb2012-11-10 22:29:54 +000049extern const HChar* VG_(LD_PRELOAD_var_name);
njne323a6b2010-07-01 02:35:03 +000050
njnf39e9a32005-06-12 02:43:17 +000051/* ---------------------------------------------------------------------
52 Important syscalls
53 ------------------------------------------------------------------ */
54
njne9ba34a2008-10-13 04:19:15 +000055extern Int VG_(waitpid)( Int pid, Int *status, Int options );
florian19f91bb2012-11-10 22:29:54 +000056extern Int VG_(system) ( const HChar* cmd );
njne9ba34a2008-10-13 04:19:15 +000057extern Int VG_(fork) ( void);
florian19f91bb2012-11-10 22:29:54 +000058extern void VG_(execv) ( const HChar* filename, HChar** argv );
njnf39e9a32005-06-12 02:43:17 +000059
60/* ---------------------------------------------------------------------
sewardj3b290482011-05-06 21:02:55 +000061 Resource limits and capabilities
njnf39e9a32005-06-12 02:43:17 +000062 ------------------------------------------------------------------ */
63
64extern Int VG_(getrlimit) ( Int resource, struct vki_rlimit *rlim );
65extern Int VG_(setrlimit) ( Int resource, const struct vki_rlimit *rlim );
sewardj3b290482011-05-06 21:02:55 +000066extern Int VG_(prctl) (Int option,
67 ULong arg2, ULong arg3, ULong arg4, ULong arg5);
njnf39e9a32005-06-12 02:43:17 +000068
69/* ---------------------------------------------------------------------
70 pids, etc
71 ------------------------------------------------------------------ */
72
sewardj45f4e7c2005-09-27 19:20:21 +000073extern Int VG_(gettid) ( void );
njnf39e9a32005-06-12 02:43:17 +000074extern Int VG_(getpid) ( void );
75extern Int VG_(getppid) ( void );
76extern Int VG_(getpgrp) ( void );
sewardj45f4e7c2005-09-27 19:20:21 +000077extern Int VG_(geteuid) ( void );
78extern Int VG_(getegid) ( void );
njnf39e9a32005-06-12 02:43:17 +000079
80/* ---------------------------------------------------------------------
81 Timing
82 ------------------------------------------------------------------ */
83
njnb63ca162007-03-28 12:16:55 +000084// Returns the number of milliseconds passed since the progam started
85// (roughly; it gets initialised partway through Valgrind's initialisation
86// steps).
njnf39e9a32005-06-12 02:43:17 +000087extern UInt VG_(read_millisecond_timer) ( void );
88
njne9ba34a2008-10-13 04:19:15 +000089/* ---------------------------------------------------------------------
90 atfork
91 ------------------------------------------------------------------ */
92
93typedef void (*vg_atfork_t)(ThreadId);
94extern void VG_(atfork)(vg_atfork_t pre, vg_atfork_t parent, vg_atfork_t child);
95
96
njnf39e9a32005-06-12 02:43:17 +000097#endif // __PUB_TOOL_LIBCPROC_H
98
99/*--------------------------------------------------------------------*/
100/*--- end ---*/
101/*--------------------------------------------------------------------*/