X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-ust-comm.c;h=651d2aaa45cec437cabb7cdb4147d66330800065;hb=a49a7e686059ce795ce678b42cc109b7a2b1d91e;hp=4a21866358b66a4d9f766abdfd47665e2cffe13d;hpb=6548fca464f68be5ded73be6b9a479daf08e62d6;p=lttng-ust.git diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index 4a218663..651d2aaa 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -52,7 +53,7 @@ #include "tracepoint-internal.h" #include "lttng-tracer-core.h" #include "compat.h" -#include "../libringbuffer/tlsfixup.h" +#include "../libringbuffer/rb-init.h" #include "lttng-ust-statedump.h" #include "clock.h" #include "../libringbuffer/getcpu.h" @@ -533,6 +534,30 @@ int get_constructor_timeout(struct timespec *constructor_timeout) return 1; } +static +void get_blocking_retry_timeout(void) +{ + const char *str_blocking_retry_timeout = + lttng_secure_getenv("LTTNG_UST_BLOCKING_RETRY_TIMEOUT"); + + if (str_blocking_retry_timeout) { + long timeout = strtol(str_blocking_retry_timeout, NULL, 10); + + if (timeout < 0) + timeout = -1; + if (timeout > INT_MAX) { + WARN("Saturating %s value from %ld to %d\n", + "LTTNG_UST_BLOCKING_RETRY_TIMEOUT", + timeout, INT_MAX); + timeout = INT_MAX; + } + DBG("%s environment variable value is %ld", + "LTTNG_UST_BLOCKING_RETRY_TIMEOUT", + timeout); + lttng_ust_ringbuffer_set_retry_timeout(timeout); + } +} + static int register_to_sessiond(int socket, enum ustctl_socket_type type) { @@ -956,6 +981,21 @@ int handle_message(struct sock_info *sock_info, } } DBG("Return value: %d", lur.ret_val); + + ust_unlock(); + + /* + * Performed delayed statedump operations outside of the UST + * lock. We need to take the dynamic loader lock before we take + * the UST lock internally within handle_pending_statedump(). + */ + handle_pending_statedump(sock_info); + + if (ust_lock()) { + ret = -LTTNG_UST_ERR_EXITING; + goto error; + } + ret = send_reply(sock, &lur); if (ret < 0) { DBG("error sending reply"); @@ -986,13 +1026,6 @@ int handle_message(struct sock_info *sock_info, error: ust_unlock(); - /* - * Performed delayed statedump operations outside of the UST - * lock. We need to take the dynamic loader lock before we take - * the UST lock internally within handle_pending_statedump(). - */ - handle_pending_statedump(sock_info); - return ret; } @@ -1664,6 +1697,8 @@ void __attribute__((constructor)) lttng_ust_init(void) timeout_mode = get_constructor_timeout(&constructor_timeout); + get_blocking_retry_timeout(); + ret = sem_init(&constructor_wait, 0, 0); if (ret) { PERROR("sem_init");