Fix: ignore SIGPIPE
[lttng-tools.git] / src / bin / lttng-consumerd / lttng-consumerd.c
CommitLineData
d4a1283e
JD
1/*
2 * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
3 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 *
d14d33bf
AM
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2 only,
7 * as published by the Free Software Foundation.
d4a1283e
JD
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
d14d33bf
AM
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
d4a1283e
JD
17 */
18
19#define _GNU_SOURCE
6c1c0768 20#define _LGPL_SOURCE
d4a1283e
JD
21#include <fcntl.h>
22#include <getopt.h>
23#include <grp.h>
24#include <limits.h>
25#include <pthread.h>
26#include <signal.h>
27#include <stdio.h>
28#include <stdlib.h>
29#include <string.h>
30#include <sys/ipc.h>
1ccfc0e3 31#include <sys/resource.h>
d4a1283e
JD
32#include <sys/shm.h>
33#include <sys/socket.h>
34#include <sys/stat.h>
35#include <sys/types.h>
36#include <urcu/list.h>
37#include <poll.h>
38#include <unistd.h>
03424a9b 39#include <sys/mman.h>
5348b470 40#include <assert.h>
3bd1e081 41#include <config.h>
7753dea8 42#include <urcu/compiler.h>
1ccfc0e3 43#include <ulimit.h>
d4a1283e 44
db758600
DG
45#include <common/defaults.h>
46#include <common/common.h>
f02e1e8a 47#include <common/consumer.h>
331744e3 48#include <common/consumer-timer.h>
fb3a43a9 49#include <common/compat/poll.h>
e8fa9fb0 50#include <common/compat/getenv.h>
10a8a223 51#include <common/sessiond-comm/sessiond-comm.h>
5c635c72 52#include <common/utils.h>
10a8a223
DG
53
54#include "lttng-consumerd.h"
1fc79fb4 55#include "health-consumerd.h"
d4a1283e 56
d8ef542d 57/* threads (channel handling, poll, metadata, sessiond) */
331744e3 58
5c635c72
MD
59static pthread_t channel_thread, data_thread, metadata_thread,
60 sessiond_thread, metadata_timer_thread, health_thread;
d4a1283e 61
3183dbb0 62/* to count the number of times the user pressed ctrl+c */
13e44745
JD
63static int sigintcount = 0;
64
d4a1283e 65/* Argument variables */
97e19046
DG
66int lttng_opt_quiet; /* not static in error.h */
67int lttng_opt_verbose; /* not static in error.h */
c7e35b03
JR
68int lttng_opt_mi; /* not static in error.h */
69
d4a1283e
JD
70static int opt_daemon;
71static const char *progname;
6533b585
DG
72static char command_sock_path[PATH_MAX]; /* Global command socket path */
73static char error_sock_path[PATH_MAX]; /* Global error path */
3bd1e081 74static enum lttng_consumer_type opt_type = LTTNG_CONSUMER_KERNEL;
d4a1283e 75
7753dea8 76/* the liblttngconsumerd context */
3bd1e081 77static struct lttng_consumer_local_data *ctx;
cb040cc1 78
1fc79fb4
MD
79/* Consumerd health monitoring */
80struct health_app *health_consumerd;
81
6c71277b
MD
82const char *tracing_group_name = DEFAULT_TRACING_GROUP;
83
748b7b07
MD
84int lttng_consumer_ready = NR_LTTNG_CONSUMER_READY;
85
5c635c72
MD
86enum lttng_consumer_type lttng_consumer_get_type(void)
87{
88 if (!ctx) {
89 return LTTNG_CONSUMER_UNKNOWN;
90 }
91 return ctx->type;
92}
93
d4a1283e 94/*
6533b585 95 * Signal handler for the daemon
d4a1283e
JD
96 */
97static void sighandler(int sig)
98{
13e44745
JD
99 if (sig == SIGINT && sigintcount++ == 0) {
100 DBG("ignoring first SIGINT");
101 return;
102 }
103
a04821e0
MD
104 if (ctx) {
105 lttng_consumer_should_exit(ctx);
106 }
d4a1283e
JD
107}
108
109/*
6533b585 110 * Setup signal handler for :
d4a1283e
JD
111 * SIGINT, SIGTERM, SIGPIPE
112 */
113static int set_signal_handler(void)
114{
115 int ret = 0;
116 struct sigaction sa;
117 sigset_t sigset;
118
119 if ((ret = sigemptyset(&sigset)) < 0) {
8fdf2d4d 120 PERROR("sigemptyset");
d4a1283e
JD
121 return ret;
122 }
123
d4a1283e
JD
124 sa.sa_mask = sigset;
125 sa.sa_flags = 0;
35c973f1
MD
126
127 sa.sa_handler = sighandler;
d4a1283e 128 if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
8fdf2d4d 129 PERROR("sigaction");
d4a1283e
JD
130 return ret;
131 }
132
133 if ((ret = sigaction(SIGINT, &sa, NULL)) < 0) {
8fdf2d4d 134 PERROR("sigaction");
d4a1283e
JD
135 return ret;
136 }
137
35c973f1 138 sa.sa_handler = SIG_IGN;
d4a1283e 139 if ((ret = sigaction(SIGPIPE, &sa, NULL)) < 0) {
8fdf2d4d 140 PERROR("sigaction");
d4a1283e
JD
141 return ret;
142 }
143
144 return ret;
145}
146
d4a1283e 147/*
3183dbb0 148 * Usage function on stream file.
d4a1283e 149 */
3183dbb0 150static void usage(FILE *fp)
d4a1283e 151{
3183dbb0
DG
152 fprintf(fp, "Usage: %s OPTIONS\n\nOptions:\n", progname);
153 fprintf(fp, " -h, --help "
d4a1283e 154 "Display this usage.\n");
6c71277b 155 fprintf(fp, " -c, --consumerd-cmd-sock PATH "
d4a1283e 156 "Specify path for the command socket\n");
6c71277b 157 fprintf(fp, " -e, --consumerd-err-sock PATH "
d4a1283e 158 "Specify path for the error socket\n");
3183dbb0 159 fprintf(fp, " -d, --daemonize "
d4a1283e 160 "Start as a daemon.\n");
3183dbb0 161 fprintf(fp, " -q, --quiet "
d4a1283e 162 "No output at all.\n");
3183dbb0 163 fprintf(fp, " -v, --verbose "
d4a1283e 164 "Verbose mode. Activate DBG() macro.\n");
3183dbb0 165 fprintf(fp, " -V, --version "
d4a1283e 166 "Show version number.\n");
6c71277b
MD
167 fprintf(fp, " -g, --group NAME "
168 "Specify the tracing group name. (default: tracing)\n");
3183dbb0 169 fprintf(fp, " -k, --kernel "
3bd1e081 170 "Consumer kernel buffers (default).\n");
3183dbb0 171 fprintf(fp, " -u, --ust "
3bd1e081 172 "Consumer UST buffers.%s\n",
74d0b642 173#ifdef HAVE_LIBLTTNG_UST_CTL
3bd1e081
MD
174 ""
175#else
176 " (support not compiled in)"
177#endif
178 );
d4a1283e
JD
179}
180
181/*
182 * daemon argument parsing
183 */
8f7a281b 184static int parse_args(int argc, char **argv)
d4a1283e 185{
8f7a281b 186 int c, ret = 0;
d4a1283e
JD
187
188 static struct option long_options[] = {
7753dea8
MD
189 { "consumerd-cmd-sock", 1, 0, 'c' },
190 { "consumerd-err-sock", 1, 0, 'e' },
d4a1283e 191 { "daemonize", 0, 0, 'd' },
6c71277b 192 { "group", 1, 0, 'g' },
d4a1283e
JD
193 { "help", 0, 0, 'h' },
194 { "quiet", 0, 0, 'q' },
195 { "verbose", 0, 0, 'v' },
196 { "version", 0, 0, 'V' },
3bd1e081 197 { "kernel", 0, 0, 'k' },
74d0b642 198#ifdef HAVE_LIBLTTNG_UST_CTL
3bd1e081
MD
199 { "ust", 0, 0, 'u' },
200#endif
d4a1283e
JD
201 { NULL, 0, 0, 0 }
202 };
203
204 while (1) {
205 int option_index = 0;
5acdb082
MD
206 c = getopt_long(argc, argv, "dhqvVku" "c:e:g:",
207 long_options, &option_index);
d4a1283e
JD
208 if (c == -1) {
209 break;
210 }
211
212 switch (c) {
914a571b 213 case 0:
5acdb082
MD
214 fprintf(stderr, "option %s",
215 long_options[option_index].name);
914a571b
JD
216 if (optarg) {
217 fprintf(stderr, " with arg %s\n", optarg);
8f7a281b
MD
218 ret = -1;
219 goto end;
914a571b
JD
220 }
221 break;
222 case 'c':
e8fa9fb0
MD
223 if (lttng_is_setuid_setgid()) {
224 WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
225 "-c, --consumerd-cmd-sock");
226 } else {
227 snprintf(command_sock_path, PATH_MAX, "%s", optarg);
228 }
914a571b
JD
229 break;
230 case 'e':
e8fa9fb0
MD
231 if (lttng_is_setuid_setgid()) {
232 WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
233 "-e, --consumerd-err-sock");
234 } else {
235 snprintf(error_sock_path, PATH_MAX, "%s", optarg);
236 }
914a571b
JD
237 break;
238 case 'd':
239 opt_daemon = 1;
240 break;
6c71277b 241 case 'g':
e8fa9fb0
MD
242 if (lttng_is_setuid_setgid()) {
243 WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
244 "-g, --group");
245 } else {
246 tracing_group_name = optarg;
247 }
6c71277b 248 break;
914a571b 249 case 'h':
3183dbb0
DG
250 usage(stdout);
251 exit(EXIT_SUCCESS);
914a571b 252 case 'q':
97e19046 253 lttng_opt_quiet = 1;
914a571b
JD
254 break;
255 case 'v':
97e19046 256 lttng_opt_verbose = 1;
914a571b
JD
257 break;
258 case 'V':
259 fprintf(stdout, "%s\n", VERSION);
260 exit(EXIT_SUCCESS);
3bd1e081
MD
261 case 'k':
262 opt_type = LTTNG_CONSUMER_KERNEL;
263 break;
74d0b642 264#ifdef HAVE_LIBLTTNG_UST_CTL
3bd1e081 265 case 'u':
7753dea8
MD
266# if (CAA_BITS_PER_LONG == 64)
267 opt_type = LTTNG_CONSUMER64_UST;
268# elif (CAA_BITS_PER_LONG == 32)
269 opt_type = LTTNG_CONSUMER32_UST;
270# else
271# error "Unknown bitness"
272# endif
3bd1e081
MD
273 break;
274#endif
914a571b 275 default:
3183dbb0 276 usage(stderr);
8f7a281b
MD
277 ret = -1;
278 goto end;
d4a1283e
JD
279 }
280 }
8f7a281b
MD
281end:
282 return ret;
d4a1283e
JD
283}
284
1ccfc0e3
DG
285/*
286 * Set open files limit to unlimited. This daemon can open a large number of
287 * file descriptors in order to consumer multiple kernel traces.
288 */
289static void set_ulimit(void)
290{
291 int ret;
292 struct rlimit lim;
293
294 /* The kernel does not allowed an infinite limit for open files */
295 lim.rlim_cur = 65535;
296 lim.rlim_max = 65535;
297
298 ret = setrlimit(RLIMIT_NOFILE, &lim);
299 if (ret < 0) {
300 PERROR("failed to set open files limit");
301 }
302}
303
d4a1283e
JD
304/*
305 * main
306 */
307int main(int argc, char **argv)
308{
72f11bd7 309 int ret = 0, retval = 0;
d4a1283e 310 void *status;
a04821e0 311 struct lttng_consumer_local_data *tmp_ctx;
d4a1283e 312
72f11bd7
MD
313 if (set_signal_handler()) {
314 retval = -1;
315 goto exit_set_signal_handler;
316 }
317
d4a1283e
JD
318 /* Parse arguments */
319 progname = argv[0];
72f11bd7
MD
320 if (parse_args(argc, argv)) {
321 retval = -1;
322 goto exit_options;
323 }
d4a1283e
JD
324
325 /* Daemonize */
326 if (opt_daemon) {
ceed52b5
MD
327 int i;
328
329 /*
330 * fork
331 * child: setsid, close FD 0, 1, 2, chdir /
332 * parent: exit (if fork is successful)
333 */
d4a1283e
JD
334 ret = daemon(0, 0);
335 if (ret < 0) {
ceed52b5 336 PERROR("daemon");
72f11bd7
MD
337 retval = -1;
338 goto exit_options;
d4a1283e 339 }
ceed52b5
MD
340 /*
341 * We are in the child. Make sure all other file
342 * descriptors are closed, in case we are called with
343 * more opened file descriptors than the standard ones.
344 */
345 for (i = 3; i < sysconf(_SC_OPEN_MAX); i++) {
346 (void) close(i);
347 }
d4a1283e
JD
348 }
349
72f11bd7
MD
350 /*
351 * Starting from here, we can create threads. This needs to be after
352 * lttng_daemonize due to RCU.
353 */
354
355 health_consumerd = health_app_create(NR_HEALTH_CONSUMERD_TYPES);
356 if (!health_consumerd) {
357 retval = -1;
358 goto exit_health_consumerd_cleanup;
359 }
360
fb3a43a9 361 /* Set up max poll set size */
25b397f9
MD
362 if (lttng_poll_set_max_size()) {
363 retval = -1;
364 goto exit_init_data;
365 }
fb3a43a9 366
9d035200 367 if (*command_sock_path == '\0') {
7753dea8
MD
368 switch (opt_type) {
369 case LTTNG_CONSUMER_KERNEL:
72f11bd7
MD
370 ret = snprintf(command_sock_path, PATH_MAX,
371 DEFAULT_KCONSUMERD_CMD_SOCK_PATH,
990570ed 372 DEFAULT_LTTNG_RUNDIR);
72f11bd7
MD
373 if (ret < 0) {
374 retval = -1;
375 goto exit_init_data;
376 }
7753dea8
MD
377 break;
378 case LTTNG_CONSUMER64_UST:
72f11bd7
MD
379 ret = snprintf(command_sock_path, PATH_MAX,
380 DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH,
381 DEFAULT_LTTNG_RUNDIR);
382 if (ret < 0) {
383 retval = -1;
384 goto exit_init_data;
385 }
7753dea8
MD
386 break;
387 case LTTNG_CONSUMER32_UST:
72f11bd7
MD
388 ret = snprintf(command_sock_path, PATH_MAX,
389 DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH,
390 DEFAULT_LTTNG_RUNDIR);
391 if (ret < 0) {
392 retval = -1;
393 goto exit_init_data;
394 }
7753dea8
MD
395 break;
396 default:
72f11bd7
MD
397 ERR("Unknown consumerd type");
398 retval = -1;
399 goto exit_init_data;
7753dea8 400 }
d4a1283e 401 }
e4421fec
DG
402
403 /* Init */
72f11bd7
MD
404 if (lttng_consumer_init()) {
405 retval = -1;
406 goto exit_init_data;
282dadbc
MD
407 }
408
72f11bd7 409 /* Initialize communication library */
e98ec547 410 lttcomm_init();
72f11bd7 411 /* Initialize TCP timeout values */
e98ec547 412 lttcomm_inet_init();
e4421fec 413
1ccfc0e3
DG
414 if (!getuid()) {
415 /* Set limit for open files */
416 set_ulimit();
417 }
418
0e904f3e
MD
419 if (run_as_create_worker(argv[0]) < 0) {
420 goto exit_init_data;
421 }
422
5348b470 423 /* create the consumer instance with and assign the callbacks */
d41f73b7
MD
424 ctx = lttng_consumer_create(opt_type, lttng_consumer_read_subbuffer,
425 NULL, lttng_consumer_on_recv_stream, NULL);
72f11bd7
MD
426 if (!ctx) {
427 retval = -1;
428 goto exit_init_data;
cb040cc1
JD
429 }
430
3bd1e081 431 lttng_consumer_set_command_sock_path(ctx, command_sock_path);
9d035200 432 if (*error_sock_path == '\0') {
7753dea8
MD
433 switch (opt_type) {
434 case LTTNG_CONSUMER_KERNEL:
72f11bd7
MD
435 ret = snprintf(error_sock_path, PATH_MAX,
436 DEFAULT_KCONSUMERD_ERR_SOCK_PATH,
990570ed 437 DEFAULT_LTTNG_RUNDIR);
72f11bd7
MD
438 if (ret < 0) {
439 retval = -1;
440 goto exit_init_data;
441 }
7753dea8
MD
442 break;
443 case LTTNG_CONSUMER64_UST:
72f11bd7
MD
444 ret = snprintf(error_sock_path, PATH_MAX,
445 DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH,
446 DEFAULT_LTTNG_RUNDIR);
447 if (ret < 0) {
448 retval = -1;
449 goto exit_init_data;
450 }
7753dea8
MD
451 break;
452 case LTTNG_CONSUMER32_UST:
72f11bd7
MD
453 ret = snprintf(error_sock_path, PATH_MAX,
454 DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH,
455 DEFAULT_LTTNG_RUNDIR);
456 if (ret < 0) {
457 retval = -1;
458 goto exit_init_data;
459 }
7753dea8
MD
460 break;
461 default:
72f11bd7
MD
462 ERR("Unknown consumerd type");
463 retval = -1;
464 goto exit_init_data;
7753dea8 465 }
d4a1283e
JD
466 }
467
32258573 468 /* Connect to the socket created by lttng-sessiond to report errors */
d4a1283e 469 DBG("Connecting to error socket %s", error_sock_path);
1ce86c9a 470 ret = lttcomm_connect_unix_sock(error_sock_path);
72f11bd7
MD
471 /*
472 * Not a fatal error, but all communication with lttng-sessiond will
473 * fail.
474 */
1ce86c9a 475 if (ret < 0) {
99bab54f 476 WARN("Cannot connect to error socket (is lttng-sessiond started?)");
d4a1283e 477 }
3bd1e081 478 lttng_consumer_set_error_sock(ctx, ret);
d4a1283e 479
331744e3 480 /*
d3e2ba59
JD
481 * Block RT signals used for UST periodical metadata flush and the live
482 * timer in main, and create a dedicated thread to handle these signals.
331744e3 483 */
72f11bd7
MD
484 if (consumer_signal_init()) {
485 retval = -1;
486 goto exit_init_data;
487 }
d3e2ba59 488
331744e3
JD
489 ctx->type = opt_type;
490
72f11bd7
MD
491 if (utils_create_pipe(health_quit_pipe)) {
492 retval = -1;
493 goto exit_health_pipe;
5c635c72
MD
494 }
495
496 /* Create thread to manage the client socket */
497 ret = pthread_create(&health_thread, NULL,
498 thread_manage_health, (void *) NULL);
72f11bd7
MD
499 if (ret) {
500 errno = ret;
5c635c72 501 PERROR("pthread_create health");
72f11bd7
MD
502 retval = -1;
503 goto exit_health_thread;
5c635c72
MD
504 }
505
748b7b07
MD
506 /*
507 * Wait for health thread to be initialized before letting the
508 * sessiond thread reply to the sessiond that we are ready.
509 */
510 while (uatomic_read(&lttng_consumer_ready)) {
1f3130d5 511 usleep(100000);
748b7b07
MD
512 }
513 cmm_smp_mb(); /* Read ready before following operations */
514
d8ef542d 515 /* Create thread to manage channels */
72f11bd7
MD
516 ret = pthread_create(&channel_thread, NULL,
517 consumer_thread_channel_poll,
d8ef542d 518 (void *) ctx);
72f11bd7
MD
519 if (ret) {
520 errno = ret;
521 PERROR("pthread_create");
522 retval = -1;
523 goto exit_channel_thread;
d8ef542d
MD
524 }
525
7d980def 526 /* Create thread to manage the polling/writing of trace metadata */
72f11bd7
MD
527 ret = pthread_create(&metadata_thread, NULL,
528 consumer_thread_metadata_poll,
7d980def 529 (void *) ctx);
72f11bd7
MD
530 if (ret) {
531 errno = ret;
532 PERROR("pthread_create");
533 retval = -1;
534 goto exit_metadata_thread;
7d980def
DG
535 }
536
537 /* Create thread to manage the polling/writing of trace data */
df27ef7b 538 ret = pthread_create(&data_thread, NULL, consumer_thread_data_poll,
cb040cc1 539 (void *) ctx);
72f11bd7
MD
540 if (ret) {
541 errno = ret;
542 PERROR("pthread_create");
543 retval = -1;
544 goto exit_data_thread;
d4a1283e
JD
545 }
546
7d980def 547 /* Create the thread to manage the receive of fd */
72f11bd7
MD
548 ret = pthread_create(&sessiond_thread, NULL,
549 consumer_thread_sessiond_poll,
cb040cc1 550 (void *) ctx);
72f11bd7
MD
551 if (ret) {
552 errno = ret;
553 PERROR("pthread_create");
554 retval = -1;
555 goto exit_sessiond_thread;
df27ef7b
DG
556 }
557
d3e2ba59
JD
558 /*
559 * Create the thread to manage the UST metadata periodic timer and
560 * live timer.
561 */
562 ret = pthread_create(&metadata_timer_thread, NULL,
563 consumer_timer_thread, (void *) ctx);
72f11bd7
MD
564 if (ret) {
565 errno = ret;
566 PERROR("pthread_create");
567 retval = -1;
568 goto exit_metadata_timer_thread;
d3e2ba59 569 }
331744e3 570
d3e2ba59
JD
571 ret = pthread_detach(metadata_timer_thread);
572 if (ret) {
573 errno = ret;
72f11bd7
MD
574 PERROR("pthread_detach");
575 retval = -1;
576 goto exit_metadata_timer_detach;
331744e3
JD
577 }
578
72f11bd7
MD
579 /*
580 * This is where we start awaiting program completion (e.g. through
581 * signal that asks threads to teardown.
582 */
583
584exit_metadata_timer_detach:
585exit_metadata_timer_thread:
df27ef7b 586 ret = pthread_join(sessiond_thread, &status);
72f11bd7
MD
587 if (ret) {
588 errno = ret;
589 PERROR("pthread_join sessiond_thread");
590 retval = -1;
d4a1283e 591 }
72f11bd7 592exit_sessiond_thread:
d4a1283e 593
df27ef7b 594 ret = pthread_join(data_thread, &status);
72f11bd7
MD
595 if (ret) {
596 errno = ret;
597 PERROR("pthread_join data_thread");
598 retval = -1;
df27ef7b 599 }
72f11bd7 600exit_data_thread:
df27ef7b 601
df27ef7b 602 ret = pthread_join(metadata_thread, &status);
72f11bd7
MD
603 if (ret) {
604 errno = ret;
605 PERROR("pthread_join metadata_thread");
606 retval = -1;
df27ef7b 607 }
72f11bd7 608exit_metadata_thread:
df27ef7b 609
d8ef542d 610 ret = pthread_join(channel_thread, &status);
72f11bd7
MD
611 if (ret) {
612 errno = ret;
613 PERROR("pthread_join channel_thread");
614 retval = -1;
d8ef542d 615 }
72f11bd7 616exit_channel_thread:
d8ef542d 617
5c635c72 618 ret = pthread_join(health_thread, &status);
72f11bd7
MD
619 if (ret) {
620 errno = ret;
621 PERROR("pthread_join health_thread");
622 retval = -1;
5c635c72 623 }
72f11bd7 624exit_health_thread:
5c635c72 625
5c635c72 626 utils_close_pipe(health_quit_pipe);
72f11bd7 627exit_health_pipe:
5c635c72 628
72f11bd7 629exit_init_data:
a04821e0
MD
630 tmp_ctx = ctx;
631 ctx = NULL;
632 cmm_barrier(); /* Clear ctx for signal handler. */
633 lttng_consumer_destroy(tmp_ctx);
3bd1e081 634 lttng_consumer_cleanup();
72f11bd7 635
1fc79fb4
MD
636 if (health_consumerd) {
637 health_app_destroy(health_consumerd);
638 }
9c691628
JG
639 /* Ensure all prior call_rcu are done. */
640 rcu_barrier();
d4a1283e 641
9c691628 642 run_as_destroy_worker();
72f11bd7 643
9c691628
JG
644exit_health_consumerd_cleanup:
645exit_options:
72f11bd7 646exit_set_signal_handler:
a5356923 647
72f11bd7
MD
648 if (!retval) {
649 exit(EXIT_SUCCESS);
650 } else {
651 exit(EXIT_FAILURE);
652 }
d4a1283e 653}
This page took 0.076047 seconds and 4 git commands to generate.