1 /* Copyright (C) 2021 Free Software Foundation, Inc. 2 Contributed by Oracle. 3 4 This file is part of GNU Binutils. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3, or (at your option) 9 any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, 51 Franklin Street - Fifth Floor, Boston, 19 MA 02110-1301, USA. */ 20 21 /* Lineage events for process fork, exec, etc. */ 22 23 #ifndef DESCENDANTS_H 24 #define DESCENDANTS_H 25 26 #include <dlfcn.h> 27 #include <errno.h> 28 #include <fcntl.h> 29 #include <alloca.h> 30 #include <assert.h> 31 32 #include "gp-defs.h" 33 #include "gp-experiment.h" 34 #include "collector.h" 35 #include "memmgr.h" 36 #include "cc_libcollector.h" 37 #include "tsd.h" 38 39 /* configuration, not changed after init. */ 40 typedef enum 41 { 42 LM_DORMANT = -2, /* env vars preserved, not recording */ 43 LM_CLOSED = -1, /* env vars cleared, not recording */ 44 LM_TRACK_LINEAGE = 1, /* env vars preserved, recording */ 45 } line_mode_t; 46 47 extern line_mode_t line_mode; 48 extern int user_follow_mode; 49 extern int java_mode; 50 extern int dbg_current_mode; /* for debug only */ 51 extern unsigned line_key; 52 extern char **sp_env_backup; 53 54 #define INIT_REENTRANCE(x) ((x) = __collector_tsd_get_by_key (line_key)) 55 #define CHCK_REENTRANCE(x) (((INIT_REENTRANCE(x)) == NULL) || (*(x) != 0)) 56 #define PUSH_REENTRANCE(x) ((*(x))++) 57 #define POP_REENTRANCE(x) ((*(x))--) 58 59 /* environment variables that must be forwarded to descendents */ 60 #define SP_COLLECTOR_PARAMS "SP_COLLECTOR_PARAMS" 61 #define SP_COLLECTOR_EXPNAME "SP_COLLECTOR_EXPNAME" 62 #define SP_COLLECTOR_FOLLOW_SPEC "SP_COLLECTOR_FOLLOW_SPEC" 63 #define SP_COLLECTOR_FOUNDER "SP_COLLECTOR_FOUNDER" 64 #define SP_PRELOAD_STRINGS "SP_COLLECTOR_PRELOAD" 65 #define LD_PRELOAD_STRINGS "LD_PRELOAD" 66 #define SP_LIBPATH_STRINGS "SP_COLLECTOR_LIBRARY_PATH" 67 #define LD_LIBPATH_STRINGS "LD_LIBRARY_PATH" 68 #define JAVA_TOOL_OPTIONS "JAVA_TOOL_OPTIONS" 69 #define COLLECTOR_JVMTI_OPTION "-agentlib:gp-collector" 70 71 extern int __collector_linetrace_shutdown_hwcs_6830763_XXXX; 72 extern void __collector_env_unset (char *envp[]); 73 extern void __collector_env_save_preloads (); 74 extern char ** __collector_env_backup (); 75 extern void __collector_env_backup_free (); 76 extern void __collector_env_update (char *envp[]); 77 extern void __collector_env_print (char *label); 78 extern void __collector_env_printall (char *label, char *envp[]); 79 extern char ** __collector_env_allocate (char *const old_env[], int allocate_env); 80 81 #endif 82