projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Store the relay protocol version in the consumer_output
[lttng-tools.git]
/
src
/
bin
/
lttng-consumerd
/
health-consumerd.c
diff --git
a/src/bin/lttng-consumerd/health-consumerd.c
b/src/bin/lttng-consumerd/health-consumerd.c
index 60808f37094d304480468875c5cde6b944599c9c..2ea6303f77533fd28bf9684598733bdf4f8cf9c9 100644
(file)
--- a/
src/bin/lttng-consumerd/health-consumerd.c
+++ b/
src/bin/lttng-consumerd/health-consumerd.c
@@
-15,7
+15,7
@@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define _
GNU
_SOURCE
+#define _
LGPL
_SOURCE
#include <fcntl.h>
#include <getopt.h>
#include <grp.h>
#include <fcntl.h>
#include <getopt.h>
#include <grp.h>
@@
-36,15
+36,14
@@
#include <unistd.h>
#include <sys/mman.h>
#include <assert.h>
#include <unistd.h>
#include <sys/mman.h>
#include <assert.h>
-#include <config.h>
#include <urcu/compiler.h>
#include <ulimit.h>
#include <inttypes.h>
#include <common/defaults.h>
#include <common/common.h>
#include <urcu/compiler.h>
#include <ulimit.h>
#include <inttypes.h>
#include <common/defaults.h>
#include <common/common.h>
-#include <common/consumer.h>
-#include <common/consumer-timer.h>
+#include <common/consumer
/consumer
.h>
+#include <common/consumer
/consumer
-timer.h>
#include <common/compat/poll.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/utils.h>
#include <common/compat/poll.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/utils.h>
@@
-119,8
+118,6
@@
int setup_health_path(void)
goto end;
}
} else {
goto end;
}
} else {
- static char *rundir;
-
home_path = utils_get_home_dir();
if (home_path == NULL) {
/* TODO: Add --socket PATH option */
home_path = utils_get_home_dir();
if (home_path == NULL) {
/* TODO: Add --socket PATH option */
@@
-129,16
+126,6
@@
int setup_health_path(void)
goto end;
}
goto end;
}
- /*
- * Create rundir from home path. This will create something like
- * $HOME/.lttng
- */
- ret = asprintf(&rundir, DEFAULT_LTTNG_HOME_RUNDIR, home_path);
- if (ret < 0) {
- ret = -ENOMEM;
- goto end;
- }
-
/* Set health check Unix path */
if (strlen(health_unix_sock_path) != 0) {
goto end;
/* Set health check Unix path */
if (strlen(health_unix_sock_path) != 0) {
goto end;
@@
-146,22
+133,21
@@
int setup_health_path(void)
switch (type) {
case LTTNG_CONSUMER_KERNEL:
snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
switch (type) {
case LTTNG_CONSUMER_KERNEL:
snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
- DEFAULT_HOME_KCONSUMER_HEALTH_UNIX_SOCK,
rundir
);
+ DEFAULT_HOME_KCONSUMER_HEALTH_UNIX_SOCK,
home_path
);
break;
case LTTNG_CONSUMER64_UST:
snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
break;
case LTTNG_CONSUMER64_UST:
snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
- DEFAULT_HOME_USTCONSUMER64_HEALTH_UNIX_SOCK,
rundir
);
+ DEFAULT_HOME_USTCONSUMER64_HEALTH_UNIX_SOCK,
home_path
);
break;
case LTTNG_CONSUMER32_UST:
snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
break;
case LTTNG_CONSUMER32_UST:
snprintf(health_unix_sock_path, sizeof(health_unix_sock_path),
- DEFAULT_HOME_USTCONSUMER32_HEALTH_UNIX_SOCK,
rundir
);
+ DEFAULT_HOME_USTCONSUMER32_HEALTH_UNIX_SOCK,
home_path
);
break;
default:
ret = -EINVAL;
goto end;
}
}
break;
default:
ret = -EINVAL;
goto end;
}
}
-
end:
return ret;
}
end:
return ret;
}
@@
-246,6
+232,10
@@
void *thread_manage_health(void *data)
goto error;
}
goto error;
}
+ /* Perform prior memory accesses before decrementing ready */
+ cmm_smp_mb__before_uatomic_dec();
+ uatomic_dec(<tng_consumer_ready);
+
while (1) {
DBG("Health check ready");
while (1) {
DBG("Health check ready");
@@
-269,6
+259,11
@@
restart:
revents = LTTNG_POLL_GETEV(&events, i);
pollfd = LTTNG_POLL_GETFD(&events, i);
revents = LTTNG_POLL_GETEV(&events, i);
pollfd = LTTNG_POLL_GETFD(&events, i);
+ if (!revents) {
+ /* No activity for this FD (poll implementation). */
+ continue;
+ }
+
/* Thread quit pipe has been closed. Killing thread. */
ret = check_health_quit_pipe(pollfd, revents);
if (ret) {
/* Thread quit pipe has been closed. Killing thread. */
ret = check_health_quit_pipe(pollfd, revents);
if (ret) {
@@
-278,7
+273,8
@@
restart:
/* Event on the registration socket */
if (pollfd == sock) {
/* Event on the registration socket */
if (pollfd == sock) {
- if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) {
+ if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)
+ && !(revents & LPOLLIN)) {
ERR("Health socket poll error");
goto error;
}
ERR("Health socket poll error");
goto error;
}
@@
-312,7
+308,7
@@
restart:
assert(msg.cmd == HEALTH_CMD_CHECK);
assert(msg.cmd == HEALTH_CMD_CHECK);
-
reply.ret_code = 0
;
+
memset(&reply, 0, sizeof(reply))
;
for (i = 0; i < NR_HEALTH_CONSUMERD_TYPES; i++) {
/*
* health_check_state return 0 if thread is in
for (i = 0; i < NR_HEALTH_CONSUMERD_TYPES; i++) {
/*
* health_check_state return 0 if thread is in
@@
-323,7
+319,7
@@
restart:
}
}
}
}
- DBG
2
("Health check return value %" PRIx64, reply.ret_code);
+ DBG("Health check return value %" PRIx64, reply.ret_code);
ret = send_unix_sock(new_sock, (void *) &reply, sizeof(reply));
if (ret < 0) {
ret = send_unix_sock(new_sock, (void *) &reply, sizeof(reply));
if (ret < 0) {
This page took
0.026499 seconds
and
4
git commands to generate.