12#ifndef O2_SIMSETUP_STATICTLSRESERVE_H
13#define O2_SIMSETUP_STATICTLSRESERVE_H
36 constexpr std::string_view
name =
"glibc.rtld.optional_static_tls";
38 bool haveReserve =
false;
39 bool malformed =
false;
40 unsigned long current = 0;
41 std::string_view rest = tunables ? tunables :
"";
42 while (!rest.empty()) {
43 const auto colon = rest.find(
':');
44 const std::string_view
entry = rest.substr(0, colon);
45 rest = colon == std::string_view::npos ? std::string_view{} : rest.substr(colon + 1);
47 if (
equal == std::string_view::npos ||
equal == 0) {
56 value.remove_prefix(2);
57 }
else if (
value.size() > 1 &&
value[0] ==
'0') {
59 value.remove_prefix(1);
61 unsigned long bytes = 0;
73 if (!malformed && haveReserve && current >= reserve) {
83 if (tunables.empty()) {
86 setenv(
"GLIBC_TUNABLES", tunables.c_str(), 1);
96 constexpr const char* guard =
"O2_STATIC_TLS_REEXEC";
106 const auto length = readlink(
"/proc/self/exe", self,
sizeof(self) - 1);
111 const char* base = strrchr(self,
'/');
112 if (strncmp(base ? base + 1 : self,
"ld-", 3) == 0) {
116 setenv(guard,
"1", 1);
117 fprintf(stderr,
"Restarting %s with GLIBC_TUNABLES=%s for the static TLS of Geant4\n", self, getenv(
"GLIBC_TUNABLES"));
119 const int error = errno;
121 fprintf(stderr,
"Restart of %s failed: %s\n", self, strerror(
error));
std::function< bool(const void *, const void *)> equal
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h configStandalone Internal display display_internal Number of updates the Qt GUI may send ahead of the last one the display has before it waits for the display Opacity of the console background Number of console lines kept
char error[CURL_ERROR_SIZE]
GLuint const GLchar * name
GLsizei const GLfloat * value
GLuint GLsizei GLsizei * length
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string withStaticTLSReserve(const char *tunables, unsigned long reserve=Geant4StaticTLSReserve)
bool setStaticTLSReserve(unsigned long reserve=Geant4StaticTLSReserve)
Sets the static TLS reserve in the environment, for the programs started from here....
constexpr unsigned long Geant4StaticTLSReserve
Static TLS reserve in bytes for a Geant4 built with the initial-exec TLS model and loaded by dlopen.
void ensureStaticTLSReserve(char *argv[], unsigned long reserve=Geant4StaticTLSReserve)
std::string to_string(gsl::span< T, Size > span)