RTLD_GET_VAR(3)
β¨ NAME β¨
rtld_get_var, rtld_set_var β query or change run-time linker parameters after image activation.
Okay so you're reading RTLD_GET_VAR(3) from the Library Functions Manual, and honestly? This is the lowkey iconic duo for peeking at and changing rtld settings after image activation. π«Ά
π LIBRARY π
Standard C Library (libc, -lc)
πΈ SYNOPSIS πΈ
#include <sys/errno.h>
#include <link.h>
const char *
rtld_get_var(const char *name);
int
rtld_set_var(const char *name, const char *value);
π¦ DESCRIPTION π¦
The dynamic linker rtld(1) can be configured by setting some environment variables for the process, before image activation. Sometimes it is desirable to query the current effective settings or change them afterward. Iconic behavior, honestly. β¨
Since the process environment variables are maintained by higher-level libraries, the run-time linker cannot access them after the image activation. The described functions make it possible to operate on rtld settings. Main character energy for real. π
The rtld_get_var() function returns the current value of the named parameter.
The rtld_set_var() function changes the value of the parameter to the new value value, if possible. The name argument to both functions is the name of the parameter, which is same as the corresponding environment variable (see rtld(1)) but without the LD_ (or LD_32_ or any other ABI-specific) prefix.
The list of variables that can be modified with the rtld_set_var() function is:
LD_BIND_NOTLD_BIND_NOWLD_DEBUGLD_DUMP_REL_PRELD_DUMP_REL_POSTLD_DYNAMIC_WEAKLD_LIBMAP_DISABLELD_LIBRARY_PATHLD_LIBRARY_PATH_FDSLD_LIBRARY_PATH_RPATHLD_LOADFLTR
π RETURN VALUES π
The rtld_get_var() returns the current value of the named parameter, or NULL if the name is invalid.
The rtld_set_var() returns 0 on success, or an integer indicating the error condition which prevented the operation.
π₯ ERRORS π₯
Possible errors returned from rtld_set_var():
[EPERM]β The requested change cannot be made at runtime, either because the runtime linker can only take this parameter at initialization time, or because the current process is executing with elevated privileges.[ENOENT]β The supplied parameter name is unknown.
π SEE ALSO π
π HISTORY π
The rtld_get_var function first appeared in FreeBSD 14.3.
source/version vibe: Debian Β· date: October 31, 2024 β RTLD_GET_VAR(3) π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 2024 The FreeBSD Foundation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms