projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: add missing getenv.h include to ustctl.c
[lttng-ust.git]
/
liblttng-ust
/
lttng-ust-comm.c
diff --git
a/liblttng-ust/lttng-ust-comm.c
b/liblttng-ust/lttng-ust-comm.c
index 6c6eeda51a960c4b3632486faa67adc4e49b0ef0..61d5d2d87ad14df1cbd96fe813c6b782d680f9fe 100644
(file)
--- a/
liblttng-ust/lttng-ust-comm.c
+++ b/
liblttng-ust/lttng-ust-comm.c
@@
-356,11
+356,11
@@
const char *get_lttng_home_dir(void)
{
const char *val;
{
const char *val;
- val = (const char *) lttng_
secure_
getenv("LTTNG_HOME");
+ val = (const char *) lttng_getenv("LTTNG_HOME");
if (val != NULL) {
return val;
}
if (val != NULL) {
return val;
}
- return (const char *) lttng_
secure_
getenv("HOME");
+ return (const char *) lttng_getenv("HOME");
}
/*
}
/*
@@
-388,6
+388,16
@@
void lttng_fixup_urcu_bp_tls(void)
rcu_read_unlock();
}
rcu_read_unlock();
}
+void lttng_ust_fixup_tls(void)
+{
+ lttng_fixup_urcu_bp_tls();
+ lttng_fixup_ringbuffer_tls();
+ lttng_fixup_vtid_tls();
+ lttng_fixup_nest_count_tls();
+ lttng_fixup_procname_tls();
+ lttng_fixup_ust_mutex_nest_tls();
+}
+
int lttng_get_notify_socket(void *owner)
{
struct sock_info *info = owner;
int lttng_get_notify_socket(void *owner)
{
struct sock_info *info = owner;
@@
-441,7
+451,7
@@
int setup_local_apps(void)
}
/*
}
/*
- * Get
notify_sock
timeout, in ms.
+ * Get
socket
timeout, in ms.
* -1: wait forever. 0: don't wait. >0: timeout, in ms.
*/
static
* -1: wait forever. 0: don't wait. >0: timeout, in ms.
*/
static
@@
-450,7
+460,7
@@
long get_timeout(void)
long constructor_delay_ms = LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_MS;
if (!got_timeout_env) {
long constructor_delay_ms = LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_MS;
if (!got_timeout_env) {
- str_timeout = getenv("LTTNG_UST_REGISTER_TIMEOUT");
+ str_timeout =
lttng_
getenv("LTTNG_UST_REGISTER_TIMEOUT");
got_timeout_env = 1;
}
if (str_timeout)
got_timeout_env = 1;
}
if (str_timeout)
@@
-461,12
+471,20
@@
long get_timeout(void)
return constructor_delay_ms;
}
return constructor_delay_ms;
}
+/* Timeout for notify socket send and recv. */
static
long get_notify_sock_timeout(void)
{
return get_timeout();
}
static
long get_notify_sock_timeout(void)
{
return get_timeout();
}
+/* Timeout for connecting to cmd and notify sockets. */
+static
+long get_connect_sock_timeout(void)
+{
+ return get_timeout();
+}
+
/*
* Return values: -1: wait forever. 0: don't wait. 1: timeout wait.
*/
/*
* Return values: -1: wait forever. 0: don't wait. 1: timeout wait.
*/
@@
-928,6
+946,21
@@
int handle_message(struct sock_info *sock_info,
}
}
DBG("Return value: %d", lur.ret_val);
}
}
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");
ret = send_reply(sock, &lur);
if (ret < 0) {
DBG("error sending reply");
@@
-958,13
+991,6
@@
int handle_message(struct sock_info *sock_info,
error:
ust_unlock();
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;
}
return ret;
}
@@
-1295,6
+1321,8
@@
void *ust_listener_thread(void *arg)
int sock, ret, prev_connect_failed = 0, has_waited = 0;
long timeout;
int sock, ret, prev_connect_failed = 0, has_waited = 0;
long timeout;
+ lttng_ust_fixup_tls();
+
/* Restart trying to connect to the session daemon */
restart:
if (prev_connect_failed) {
/* Restart trying to connect to the session daemon */
restart:
if (prev_connect_failed) {
@@
-1339,7
+1367,8
@@
restart:
* first connect registration message.
*/
/* Connect cmd socket */
* first connect registration message.
*/
/* Connect cmd socket */
- ret = ustcomm_connect_unix_sock(sock_info->sock_path);
+ ret = ustcomm_connect_unix_sock(sock_info->sock_path,
+ get_connect_sock_timeout());
if (ret < 0) {
DBG("Info: sessiond not accepting connections to %s apps socket", sock_info->name);
prev_connect_failed = 1;
if (ret < 0) {
DBG("Info: sessiond not accepting connections to %s apps socket", sock_info->name);
prev_connect_failed = 1;
@@
-1395,7
+1424,8
@@
restart:
ust_unlock();
/* Connect notify socket */
ust_unlock();
/* Connect notify socket */
- ret = ustcomm_connect_unix_sock(sock_info->sock_path);
+ ret = ustcomm_connect_unix_sock(sock_info->sock_path,
+ get_connect_sock_timeout());
if (ret < 0) {
DBG("Info: sessiond not accepting connections to %s apps socket", sock_info->name);
prev_connect_failed = 1;
if (ret < 0) {
DBG("Info: sessiond not accepting connections to %s apps socket", sock_info->name);
prev_connect_failed = 1;
@@
-1558,12
+1588,7
@@
void __attribute__((constructor)) lttng_ust_init(void)
* to be the dynamic linker mutex) and ust_lock, taken within
* the ust lock.
*/
* to be the dynamic linker mutex) and ust_lock, taken within
* the ust lock.
*/
- lttng_fixup_urcu_bp_tls();
- lttng_fixup_ringbuffer_tls();
- lttng_fixup_vtid_tls();
- lttng_fixup_nest_count_tls();
- lttng_fixup_procname_tls();
- lttng_fixup_ust_mutex_nest_tls();
+ lttng_ust_fixup_tls();
/*
* We want precise control over the order in which we construct
/*
* We want precise control over the order in which we construct
@@
-1572,6
+1597,7
@@
void __attribute__((constructor)) lttng_ust_init(void)
* sessiond before the init functions are completed).
*/
init_usterr();
* sessiond before the init functions are completed).
*/
init_usterr();
+ lttng_ust_getenv_init(); /* Needs init_usterr() to be completed. */
init_tracepoint();
lttng_ust_clock_init();
lttng_ust_getcpu_init();
init_tracepoint();
lttng_ust_clock_init();
lttng_ust_getcpu_init();
@@
-1792,6
+1818,9
@@
void ust_before_fork(sigset_t *save_sigset)
sigset_t all_sigs;
int ret;
sigset_t all_sigs;
int ret;
+ /* Fixup lttng-ust TLS. */
+ lttng_ust_fixup_tls();
+
if (URCU_TLS(lttng_ust_nest_count))
return;
/* Disable signals */
if (URCU_TLS(lttng_ust_nest_count))
return;
/* Disable signals */
This page took
0.026137 seconds
and
4
git commands to generate.