summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-09-17 13:32:46 +0000
committerLennart Poettering <lennart@poettering.net>2007-09-17 13:32:46 +0000
commit7f9fea74ef4c972ccc7f6cf797f83d1bdbcddde7 (patch)
treea0346e2ce9057db15db7f11bf506cbd410e2b000
parenta1526f105dfc642aea213cca84f90635878ba4bd (diff)
on Linu disable lazy binding altogether
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1840 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--src/daemon/main.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 43f573e6..c446582e 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -315,7 +315,6 @@ int main(int argc, char *argv[]) {
pa_strbuf *buf = NULL;
pa_daemon_conf *conf = NULL;
pa_mainloop *mainloop = NULL;
-
char *s;
int r = 0, retval = 1, d = 0;
int daemon_pipe[2] = { -1, -1 };
@@ -329,6 +328,23 @@ int main(int argc, char *argv[]) {
struct timeval tv;
#endif
+
+#if defined(__linux__) && defined(__OPTIMIZE__)
+ /*
+ Disable lazy relocations to make usage of external libraries
+ more deterministic for our RT threads. We abuse __OPTIMIZE__ as
+ a check whether we are a debug build or not.
+ */
+
+ if (!getenv("LD_BIND_NOW")) {
+ putenv(pa_xstrdup("LD_BIND_NOW=1"));
+
+ /* We have to execute ourselves, because the libc caches the
+ * value of $LD_BIND_NOW on initialization. */
+ pa_assert_se(execv("/proc/self/exe", argv) == 0);
+ }
+#endif
+
#ifdef HAVE_GETUID
real_root = getuid() == 0;
suid_root = !real_root && geteuid() == 0;