mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
cache env strings on startup
This commit is contained in:
@@ -811,7 +811,7 @@ os_process_launch(OS_ProcessLaunchParams *params)
|
|||||||
char **envp = 0;
|
char **envp = 0;
|
||||||
if(params->inherit_env)
|
if(params->inherit_env)
|
||||||
{
|
{
|
||||||
envp = __environ;
|
envp = os_lnx_state.default_env;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1443,7 +1443,7 @@ lnx_signal_handler(int sig, siginfo_t *info, void *arg)
|
|||||||
}
|
}
|
||||||
fprintf(stderr, "\nVersion: %s%s\n\n", BUILD_VERSION_STRING_LITERAL, BUILD_GIT_HASH_STRING_LITERAL_APPEND);
|
fprintf(stderr, "\nVersion: %s%s\n\n", BUILD_VERSION_STRING_LITERAL, BUILD_GIT_HASH_STRING_LITERAL_APPEND);
|
||||||
|
|
||||||
_exit(0);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -1486,6 +1486,20 @@ main(int argc, char **argv)
|
|||||||
os_lnx_state.entity_arena = arena_alloc();
|
os_lnx_state.entity_arena = arena_alloc();
|
||||||
pthread_mutex_init(&os_lnx_state.entity_mutex, 0);
|
pthread_mutex_init(&os_lnx_state.entity_mutex, 0);
|
||||||
|
|
||||||
|
// cache default environment
|
||||||
|
{
|
||||||
|
U64 env_count = 0;
|
||||||
|
for(; __environ[env_count] != 0; env_count += 1) {}
|
||||||
|
char **default_env = push_array(os_lnx_state.arena, char *, env_count+1);
|
||||||
|
for EachIndex(i, env_count)
|
||||||
|
{
|
||||||
|
default_env[i] = (char *)str8_copy(os_lnx_state.arena, str8_cstring(__environ[i])).str;
|
||||||
|
}
|
||||||
|
default_env[env_count] = 0;
|
||||||
|
os_lnx_state.default_env_count = env_count;
|
||||||
|
os_lnx_state.default_env = default_env;
|
||||||
|
}
|
||||||
|
|
||||||
//- rjf: grab dynamically allocated system info
|
//- rjf: grab dynamically allocated system info
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(0, 0);
|
Temp scratch = scratch_begin(0, 0);
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ struct OS_LNX_State
|
|||||||
pthread_mutex_t entity_mutex;
|
pthread_mutex_t entity_mutex;
|
||||||
Arena *entity_arena;
|
Arena *entity_arena;
|
||||||
OS_LNX_Entity *entity_free;
|
OS_LNX_Entity *entity_free;
|
||||||
|
U64 default_env_count;
|
||||||
|
char **default_env;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user