X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ust%2Flttng-ust-comm.c;h=e206456f0d98060ea20c2310c4f993c1d6494ece;hb=90d125c709f566f3663bf84677f100134cc618e0;hp=0fe2da466ad1cce241b0b82efd864e651223341e;hpb=8e95eaadb72a1a97486f15cc128ff6ed2fcd0196;p=lttng-ust.git diff --git a/src/lib/lttng-ust/lttng-ust-comm.c b/src/lib/lttng-ust/lttng-ust-comm.c index 0fe2da46..e206456f 100644 --- a/src/lib/lttng-ust/lttng-ust-comm.c +++ b/src/lib/lttng-ust/lttng-ust-comm.c @@ -370,16 +370,26 @@ static char *get_map_shm(struct sock_info *sock_info); /* * Returns the HOME directory path. Caller MUST NOT free(3) the returned * pointer. + * The following env are checked in order of priority: + * 1 - LTTNG_UST_HOME + * 2 - LTTNG_HOME + * 3 - HOME */ static const char *get_lttng_home_dir(void) { const char *val; + val = (const char *) lttng_ust_getenv("LTTNG_UST_HOME"); + if (val != NULL) { + return val; + } + val = (const char *) lttng_ust_getenv("LTTNG_HOME"); if (val != NULL) { return val; } + return (const char *) lttng_ust_getenv("HOME"); } @@ -389,13 +399,13 @@ const char *get_lttng_home_dir(void) static void lttng_ust_nest_count_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(lttng_ust_nest_count))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(lttng_ust_nest_count))); } static void lttng_ust_mutex_nest_alloc_tls(void) { - asm volatile ("" : : "m" (URCU_TLS(ust_mutex_nest))); + __asm__ __volatile__ ("" : : "m" (URCU_TLS(ust_mutex_nest))); } /* @@ -1584,14 +1594,14 @@ open_write: pid = fork(); URCU_TLS(lttng_ust_nest_count)--; if (pid > 0) { - int status; + int status, wait_ret; /* * Parent: wait for child to return, in which case the * shared memory map will have been created. */ - pid = wait(&status); - if (pid < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) { + wait_ret = waitpid(pid, &status, 0); + if (wait_ret < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) { wait_shm_fd = -1; goto end; }