projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tests: add consumer testpoint to pause data consumption
[lttng-tools.git]
/
src
/
bin
/
lttng-consumerd
/
lttng-consumerd.c
diff --git
a/src/bin/lttng-consumerd/lttng-consumerd.c
b/src/bin/lttng-consumerd/lttng-consumerd.c
index a56f02d1b1ccc264a4178b534ed189e377a45bae..9fb4747536ad7fb3551217f1f3d6aaa0198caae6 100644
(file)
--- a/
src/bin/lttng-consumerd/lttng-consumerd.c
+++ b/
src/bin/lttng-consumerd/lttng-consumerd.c
@@
-16,7
+16,6
@@
* 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>
#define _LGPL_SOURCE
#include <fcntl.h>
#include <getopt.h>
@@
-38,14
+37,13
@@
#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 <common/defaults.h>
#include <common/common.h>
#include <urcu/compiler.h>
#include <ulimit.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/compat/getenv.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/compat/poll.h>
#include <common/compat/getenv.h>
#include <common/sessiond-comm/sessiond-comm.h>
@@
-101,14
+99,6
@@
static void sighandler(int sig)
return;
}
return;
}
- /*
- * Ignore SIGPIPE because it should not stop the consumer whenever a
- * SIGPIPE is catched through a FD operation.
- */
- if (sig == SIGPIPE) {
- return;
- }
-
if (ctx) {
lttng_consumer_should_exit(ctx);
}
if (ctx) {
lttng_consumer_should_exit(ctx);
}
@@
-129,9
+119,10
@@
static int set_signal_handler(void)
return ret;
}
return ret;
}
- sa.sa_handler = sighandler;
sa.sa_mask = sigset;
sa.sa_flags = 0;
sa.sa_mask = sigset;
sa.sa_flags = 0;
+
+ sa.sa_handler = sighandler;
if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
PERROR("sigaction");
return ret;
if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
PERROR("sigaction");
return ret;
@@
-142,6
+133,7
@@
static int set_signal_handler(void)
return ret;
}
return ret;
}
+ sa.sa_handler = SIG_IGN;
if ((ret = sigaction(SIGPIPE, &sa, NULL)) < 0) {
PERROR("sigaction");
return ret;
if ((ret = sigaction(SIGPIPE, &sa, NULL)) < 0) {
PERROR("sigaction");
return ret;
@@
-316,6
+308,8
@@
int main(int argc, char **argv)
void *status;
struct lttng_consumer_local_data *tmp_ctx;
void *status;
struct lttng_consumer_local_data *tmp_ctx;
+ rcu_register_thread();
+
if (set_signal_handler()) {
retval = -1;
goto exit_set_signal_handler;
if (set_signal_handler()) {
retval = -1;
goto exit_set_signal_handler;
@@
-364,12
+358,6
@@
int main(int argc, char **argv)
goto exit_health_consumerd_cleanup;
}
goto exit_health_consumerd_cleanup;
}
- /* Set up max poll set size */
- if (lttng_poll_set_max_size()) {
- retval = -1;
- goto exit_init_data;
- }
-
if (*command_sock_path == '\0') {
switch (opt_type) {
case LTTNG_CONSUMER_KERNEL:
if (*command_sock_path == '\0') {
switch (opt_type) {
case LTTNG_CONSUMER_KERNEL:
@@
-500,7
+488,7
@@
int main(int argc, char **argv)
}
/* Create thread to manage the client socket */
}
/* Create thread to manage the client socket */
- ret = pthread_create(&health_thread,
NULL
,
+ ret = pthread_create(&health_thread,
default_pthread_attr()
,
thread_manage_health, (void *) NULL);
if (ret) {
errno = ret;
thread_manage_health, (void *) NULL);
if (ret) {
errno = ret;
@@
-519,7
+507,7
@@
int main(int argc, char **argv)
cmm_smp_mb(); /* Read ready before following operations */
/* Create thread to manage channels */
cmm_smp_mb(); /* Read ready before following operations */
/* Create thread to manage channels */
- ret = pthread_create(&channel_thread,
NULL
,
+ ret = pthread_create(&channel_thread,
default_pthread_attr()
,
consumer_thread_channel_poll,
(void *) ctx);
if (ret) {
consumer_thread_channel_poll,
(void *) ctx);
if (ret) {
@@
-530,7
+518,7
@@
int main(int argc, char **argv)
}
/* Create thread to manage the polling/writing of trace metadata */
}
/* Create thread to manage the polling/writing of trace metadata */
- ret = pthread_create(&metadata_thread,
NULL
,
+ ret = pthread_create(&metadata_thread,
default_pthread_attr()
,
consumer_thread_metadata_poll,
(void *) ctx);
if (ret) {
consumer_thread_metadata_poll,
(void *) ctx);
if (ret) {
@@
-541,8
+529,8
@@
int main(int argc, char **argv)
}
/* Create thread to manage the polling/writing of trace data */
}
/* Create thread to manage the polling/writing of trace data */
- ret = pthread_create(&data_thread,
NULL, consumer_thread_data_poll
,
- (void *) ctx);
+ ret = pthread_create(&data_thread,
default_pthread_attr()
,
+
consumer_thread_data_poll,
(void *) ctx);
if (ret) {
errno = ret;
PERROR("pthread_create");
if (ret) {
errno = ret;
PERROR("pthread_create");
@@
-550,8
+538,8
@@
int main(int argc, char **argv)
goto exit_data_thread;
}
goto exit_data_thread;
}
- /* Create the thread to manage the rece
ive of fd
*/
- ret = pthread_create(&sessiond_thread,
NULL
,
+ /* Create the thread to manage the rece
ption of fds
*/
+ ret = pthread_create(&sessiond_thread,
default_pthread_attr()
,
consumer_thread_sessiond_poll,
(void *) ctx);
if (ret) {
consumer_thread_sessiond_poll,
(void *) ctx);
if (ret) {
@@
-565,7
+553,7
@@
int main(int argc, char **argv)
* Create the thread to manage the UST metadata periodic timer and
* live timer.
*/
* Create the thread to manage the UST metadata periodic timer and
* live timer.
*/
- ret = pthread_create(&metadata_timer_thread,
NULL
,
+ ret = pthread_create(&metadata_timer_thread,
default_pthread_attr()
,
consumer_timer_thread, (void *) ctx);
if (ret) {
errno = ret;
consumer_timer_thread, (void *) ctx);
if (ret) {
errno = ret;
@@
-595,6
+583,14
@@
exit_metadata_timer_thread:
PERROR("pthread_join sessiond_thread");
retval = -1;
}
PERROR("pthread_join sessiond_thread");
retval = -1;
}
+
+ ret = consumer_timer_thread_get_channel_monitor_pipe();
+ if (ret >= 0) {
+ ret = close(ret);
+ if (ret) {
+ PERROR("close channel monitor pipe");
+ }
+ }
exit_sessiond_thread:
ret = pthread_join(data_thread, &status);
exit_sessiond_thread:
ret = pthread_join(data_thread, &status);
@@
-636,6
+632,12
@@
exit_init_data:
tmp_ctx = ctx;
ctx = NULL;
cmm_barrier(); /* Clear ctx for signal handler. */
tmp_ctx = ctx;
ctx = NULL;
cmm_barrier(); /* Clear ctx for signal handler. */
+ /*
+ * Wait for all pending call_rcu work to complete before tearing
+ * down data structures. call_rcu worker may be trying to
+ * perform lookups in those structures.
+ */
+ rcu_barrier();
lttng_consumer_destroy(tmp_ctx);
lttng_consumer_cleanup();
lttng_consumer_destroy(tmp_ctx);
lttng_consumer_cleanup();
@@
-651,6
+653,8
@@
exit_health_consumerd_cleanup:
exit_options:
exit_set_signal_handler:
exit_options:
exit_set_signal_handler:
+ rcu_unregister_thread();
+
if (!retval) {
exit(EXIT_SUCCESS);
} else {
if (!retval) {
exit(EXIT_SUCCESS);
} else {
This page took
0.026155 seconds
and
4
git commands to generate.