mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-profile: add ld_preload helper
This is to be used by instruments to adjust the spawnable to inject preload into the spawned environment.
This commit is contained in:
@ -378,3 +378,19 @@ sysprof_spawnable_add_trace_fd (SysprofSpawnable *self,
|
||||
|
||||
return g_steal_fd (&fd);
|
||||
}
|
||||
|
||||
void
|
||||
sysprof_spawnable_add_ld_preload (SysprofSpawnable *self,
|
||||
const char *library_path)
|
||||
{
|
||||
g_autofree char *amended = NULL;
|
||||
const char *val;
|
||||
|
||||
g_return_if_fail (SYSPROF_IS_SPAWNABLE (self));
|
||||
g_return_if_fail (library_path != NULL);
|
||||
|
||||
if ((val = sysprof_spawnable_getenv (self, "LD_PRELOAD")))
|
||||
library_path = amended = g_strdup_printf ("%s:%s", val, library_path);
|
||||
|
||||
sysprof_spawnable_setenv (self, "LD_PRELOAD", library_path);
|
||||
}
|
||||
|
||||
@ -78,6 +78,9 @@ SYSPROF_AVAILABLE_IN_ALL
|
||||
int sysprof_spawnable_add_trace_fd (SysprofSpawnable *self,
|
||||
const char *envvar);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_spawnable_add_ld_preload (SysprofSpawnable *self,
|
||||
const char *library_path);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
GSubprocess *sysprof_spawnable_spawn (SysprofSpawnable *self,
|
||||
GError **error);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
|
||||
Reference in New Issue
Block a user