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