Add lttng-error.h containing every API err. code
[lttng-tools.git] / src / bin / lttng-sessiond / kernel.c
CommitLineData
20fe2104
DG
1/*
2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
3 *
d14d33bf
AM
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2 only,
6 * as published by the Free Software Foundation.
20fe2104
DG
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
d14d33bf
AM
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20fe2104
DG
16 */
17
8c0faa1d 18#define _GNU_SOURCE
20fe2104 19#include <errno.h>
7b395890 20#include <fcntl.h>
20fe2104
DG
21#include <stdlib.h>
22#include <stdio.h>
f34daff7 23#include <string.h>
8c0faa1d 24#include <unistd.h>
77c7c900 25#include <inttypes.h>
20fe2104 26
990570ed 27#include <common/common.h>
db758600 28#include <common/kernel-ctl/kernel-ctl.h>
42224349 29#include <common/sessiond-comm/sessiond-comm.h>
1e307fab 30
2f77fc4b 31#include "consumer.h"
4771f025 32#include "kernel.h"
096102bd 33#include "kern-modules.h"
20fe2104 34
d65106b1 35/*
050349bb 36 * Add context on a kernel channel.
d65106b1
DG
37 */
38int kernel_add_channel_context(struct ltt_kernel_channel *chan,
39 struct lttng_kernel_context *ctx)
40{
41 int ret;
42
43 DBG("Adding context to channel %s", chan->channel->name);
44 ret = kernctl_add_context(chan->fd, ctx);
45 if (ret < 0) {
b579acd9 46 if (errno != EEXIST) {
df0f840b 47 PERROR("add context ioctl");
b579acd9
DG
48 } else {
49 /* If EEXIST, we just ignore the error */
50 ret = 0;
51 }
d65106b1
DG
52 goto error;
53 }
54
ba7f0ae5 55 chan->ctx = zmalloc(sizeof(struct lttng_kernel_context));
d65106b1 56 if (chan->ctx == NULL) {
df0f840b 57 PERROR("zmalloc event context");
d65106b1
DG
58 goto error;
59 }
60
61 memcpy(chan->ctx, ctx, sizeof(struct lttng_kernel_context));
62
63 return 0;
64
65error:
66 return ret;
67}
68
69/*
050349bb 70 * Add context on a kernel event.
d65106b1
DG
71 */
72int kernel_add_event_context(struct ltt_kernel_event *event,
73 struct lttng_kernel_context *ctx)
74{
75 int ret;
76
77 DBG("Adding context to event %s", event->event->name);
78 ret = kernctl_add_context(event->fd, ctx);
79 if (ret < 0) {
df0f840b 80 PERROR("add context ioctl");
d65106b1
DG
81 goto error;
82 }
83
ba7f0ae5 84 event->ctx = zmalloc(sizeof(struct lttng_kernel_context));
d65106b1 85 if (event->ctx == NULL) {
df0f840b 86 PERROR("zmalloc event context");
d65106b1
DG
87 goto error;
88 }
89
90 memcpy(event->ctx, ctx, sizeof(struct lttng_kernel_context));
91
92 return 0;
93
94error:
95 return ret;
96}
97
20fe2104 98/*
050349bb
DG
99 * Create a new kernel session, register it to the kernel tracer and add it to
100 * the session daemon session.
20fe2104 101 */
8c0faa1d 102int kernel_create_session(struct ltt_session *session, int tracer_fd)
20fe2104
DG
103{
104 int ret;
105 struct ltt_kernel_session *lks;
106
54012638 107 /* Allocate data structure */
f9815039 108 lks = trace_kernel_create_session(session->path);
20fe2104 109 if (lks == NULL) {
54012638 110 ret = -1;
20fe2104
DG
111 goto error;
112 }
113
54012638 114 /* Kernel tracer session creation */
20fe2104
DG
115 ret = kernctl_create_session(tracer_fd);
116 if (ret < 0) {
df0f840b 117 PERROR("ioctl kernel create session");
20fe2104
DG
118 goto error;
119 }
120
20fe2104 121 lks->fd = ret;
7b395890
DG
122 /* Prevent fd duplication after execlp() */
123 ret = fcntl(lks->fd, F_SETFD, FD_CLOEXEC);
124 if (ret < 0) {
df0f840b 125 PERROR("fcntl session fd");
7b395890
DG
126 }
127
3bd1e081 128 lks->consumer_fds_sent = 0;
8c0faa1d 129 session->kernel_session = lks;
8c0faa1d
DG
130
131 DBG("Kernel session created (fd: %d)", lks->fd);
20fe2104
DG
132
133 return 0;
134
135error:
136 return ret;
137}
138
139/*
050349bb
DG
140 * Create a kernel channel, register it to the kernel tracer and add it to the
141 * kernel session.
20fe2104 142 */
050349bb
DG
143int kernel_create_channel(struct ltt_kernel_session *session,
144 struct lttng_channel *chan, char *path)
20fe2104
DG
145{
146 int ret;
147 struct ltt_kernel_channel *lkc;
20fe2104 148
54012638 149 /* Allocate kernel channel */
62499ad6 150 lkc = trace_kernel_create_channel(chan, path);
54012638 151 if (lkc == NULL) {
20fe2104
DG
152 goto error;
153 }
154
77c7c900 155 DBG3("Kernel create channel %s in %s with attr: %d, %" PRIu64 ", %" PRIu64 ", %u, %u, %d",
173af62f
DG
156 chan->name, path, lkc->channel->attr.overwrite,
157 lkc->channel->attr.subbuf_size, lkc->channel->attr.num_subbuf,
158 lkc->channel->attr.switch_timer_interval, lkc->channel->attr.read_timer_interval,
159 lkc->channel->attr.output);
160
54012638 161 /* Kernel tracer channel creation */
f3ed775e 162 ret = kernctl_create_channel(session->fd, &lkc->channel->attr);
20fe2104 163 if (ret < 0) {
df0f840b 164 PERROR("ioctl kernel create channel");
20fe2104
DG
165 goto error;
166 }
167
54012638 168 /* Setup the channel fd */
20fe2104 169 lkc->fd = ret;
7b395890
DG
170 /* Prevent fd duplication after execlp() */
171 ret = fcntl(lkc->fd, F_SETFD, FD_CLOEXEC);
172 if (ret < 0) {
df0f840b 173 PERROR("fcntl session fd");
7b395890
DG
174 }
175
54012638 176 /* Add channel to session */
8c0faa1d
DG
177 cds_list_add(&lkc->list, &session->channel_list.head);
178 session->channel_count++;
20fe2104 179
00e2e675 180 DBG("Kernel channel %s created (fd: %d)", lkc->channel->name, lkc->fd);
20fe2104
DG
181
182 return 0;
183
184error:
54012638 185 return -1;
20fe2104 186}
f34daff7
DG
187
188/*
050349bb
DG
189 * Create a kernel event, enable it to the kernel tracer and add it to the
190 * channel event list of the kernel session.
f34daff7 191 */
050349bb
DG
192int kernel_create_event(struct lttng_event *ev,
193 struct ltt_kernel_channel *channel)
f34daff7
DG
194{
195 int ret;
196 struct ltt_kernel_event *event;
f34daff7 197
62499ad6 198 event = trace_kernel_create_event(ev);
54012638 199 if (event == NULL) {
d87bfb32 200 ret = -1;
f34daff7
DG
201 goto error;
202 }
203
f3ed775e
DG
204 ret = kernctl_create_event(channel->fd, event->event);
205 if (ret < 0) {
bd29c13d
DG
206 switch (errno) {
207 case EEXIST:
208 break;
209 case ENOSYS:
210 WARN("Event type not implemented");
211 break;
212 default:
d87bfb32
DG
213 PERROR("create event ioctl");
214 }
215 ret = -errno;
e953ef25 216 goto free_event;
8c0faa1d 217 }
f34daff7 218
5f822d0a 219 /*
2c425ff7 220 * LTTNG_KERNEL_SYSCALL event creation will return 0 on success.
5f822d0a
DG
221 */
222 if (ret == 0 && event->event->instrumentation == LTTNG_KERNEL_SYSCALL) {
223 DBG2("Kernel event syscall creation success");
87eb4ab8
MD
224 /*
225 * We use fd == -1 to ensure that we never trigger a close of fd
226 * 0.
227 */
228 event->fd = -1;
2c425ff7 229 goto add_list;
5f822d0a
DG
230 }
231
f3ed775e 232 event->fd = ret;
7b395890
DG
233 /* Prevent fd duplication after execlp() */
234 ret = fcntl(event->fd, F_SETFD, FD_CLOEXEC);
235 if (ret < 0) {
df0f840b 236 PERROR("fcntl session fd");
7b395890
DG
237 }
238
2c425ff7 239add_list:
f3ed775e
DG
240 /* Add event to event list */
241 cds_list_add(&event->list, &channel->events_list.head);
cbbbb275
DG
242 channel->event_count++;
243
e953ef25
DG
244 DBG("Event %s created (fd: %d)", ev->name, event->fd);
245
246 return 0;
247
248free_event:
249 free(event);
250error:
d87bfb32 251 return ret;
e953ef25
DG
252}
253
26cc6b4e 254/*
050349bb 255 * Disable a kernel channel.
26cc6b4e
DG
256 */
257int kernel_disable_channel(struct ltt_kernel_channel *chan)
258{
259 int ret;
260
261 ret = kernctl_disable(chan->fd);
262 if (ret < 0) {
df0f840b 263 PERROR("disable chan ioctl");
26cc6b4e
DG
264 ret = errno;
265 goto error;
266 }
267
268 chan->enabled = 0;
269 DBG("Kernel channel %s disabled (fd: %d)", chan->channel->name, chan->fd);
270
271 return 0;
272
273error:
274 return ret;
275}
276
d36b8583 277/*
050349bb 278 * Enable a kernel channel.
d36b8583
DG
279 */
280int kernel_enable_channel(struct ltt_kernel_channel *chan)
281{
282 int ret;
283
284 ret = kernctl_enable(chan->fd);
54d01ffb 285 if (ret < 0 && errno != EEXIST) {
df0f840b 286 PERROR("Enable kernel chan");
d36b8583
DG
287 goto error;
288 }
289
290 chan->enabled = 1;
291 DBG("Kernel channel %s enabled (fd: %d)", chan->channel->name, chan->fd);
292
293 return 0;
294
295error:
296 return ret;
297}
298
19e70852 299/*
050349bb 300 * Enable a kernel event.
19e70852
DG
301 */
302int kernel_enable_event(struct ltt_kernel_event *event)
303{
304 int ret;
305
306 ret = kernctl_enable(event->fd);
42224349
DG
307 if (ret < 0) {
308 switch (errno) {
309 case EEXIST:
f73fabfd 310 ret = LTTNG_ERR_KERN_EVENT_EXIST;
42224349
DG
311 break;
312 default:
313 PERROR("enable kernel event");
314 break;
315 }
19e70852
DG
316 goto error;
317 }
318
319 event->enabled = 1;
320 DBG("Kernel event %s enabled (fd: %d)", event->event->name, event->fd);
321
322 return 0;
323
324error:
d36b8583 325 return ret;
19e70852
DG
326}
327
e953ef25 328/*
050349bb 329 * Disable a kernel event.
e953ef25 330 */
19e70852 331int kernel_disable_event(struct ltt_kernel_event *event)
e953ef25
DG
332{
333 int ret;
19e70852
DG
334
335 ret = kernctl_disable(event->fd);
42224349
DG
336 if (ret < 0) {
337 switch (errno) {
338 case EEXIST:
f73fabfd 339 ret = LTTNG_ERR_KERN_EVENT_EXIST;
42224349
DG
340 break;
341 default:
342 PERROR("disable kernel event");
343 break;
344 }
19e70852 345 goto error;
e953ef25 346 }
f3ed775e 347
19e70852
DG
348 event->enabled = 0;
349 DBG("Kernel event %s disabled (fd: %d)", event->event->name, event->fd);
350
f34daff7
DG
351 return 0;
352
353error:
d36b8583 354 return ret;
f34daff7 355}
aaf26714
DG
356
357/*
050349bb
DG
358 * Create kernel metadata, open from the kernel tracer and add it to the
359 * kernel session.
aaf26714 360 */
a4b92340 361int kernel_open_metadata(struct ltt_kernel_session *session)
aaf26714
DG
362{
363 int ret;
364 struct ltt_kernel_metadata *lkm;
aaf26714 365
54012638 366 /* Allocate kernel metadata */
a4b92340 367 lkm = trace_kernel_create_metadata();
54012638 368 if (lkm == NULL) {
aaf26714
DG
369 goto error;
370 }
371
54012638 372 /* Kernel tracer metadata creation */
f3ed775e 373 ret = kernctl_open_metadata(session->fd, &lkm->conf->attr);
aaf26714
DG
374 if (ret < 0) {
375 goto error;
376 }
377
8c0faa1d 378 lkm->fd = ret;
7b395890
DG
379 /* Prevent fd duplication after execlp() */
380 ret = fcntl(lkm->fd, F_SETFD, FD_CLOEXEC);
381 if (ret < 0) {
df0f840b 382 PERROR("fcntl session fd");
7b395890
DG
383 }
384
aaf26714 385 session->metadata = lkm;
8c0faa1d 386
00e2e675 387 DBG("Kernel metadata opened (fd: %d)", lkm->fd);
8c0faa1d
DG
388
389 return 0;
390
391error:
54012638 392 return -1;
8c0faa1d
DG
393}
394
395/*
050349bb 396 * Start tracing session.
8c0faa1d
DG
397 */
398int kernel_start_session(struct ltt_kernel_session *session)
399{
400 int ret;
401
402 ret = kernctl_start_session(session->fd);
403 if (ret < 0) {
df0f840b 404 PERROR("ioctl start session");
8c0faa1d
DG
405 goto error;
406 }
407
408 DBG("Kernel session started");
409
410 return 0;
411
412error:
413 return ret;
414}
415
f3ed775e 416/*
050349bb 417 * Make a kernel wait to make sure in-flight probe have completed.
f3ed775e
DG
418 */
419void kernel_wait_quiescent(int fd)
420{
421 int ret;
422
423 DBG("Kernel quiescent wait on %d", fd);
424
425 ret = kernctl_wait_quiescent(fd);
426 if (ret < 0) {
df0f840b 427 PERROR("wait quiescent ioctl");
f3ed775e
DG
428 ERR("Kernel quiescent wait failed");
429 }
430}
431
d0254c7c 432/*
050349bb 433 * Kernel calibrate
d0254c7c
MD
434 */
435int kernel_calibrate(int fd, struct lttng_kernel_calibrate *calibrate)
436{
437 int ret;
438
439 ret = kernctl_calibrate(fd, calibrate);
440 if (ret < 0) {
df0f840b 441 PERROR("calibrate ioctl");
d0254c7c
MD
442 return -1;
443 }
444
445 return 0;
446}
447
448
f3ed775e 449/*
f3ed775e
DG
450 * Force flush buffer of metadata.
451 */
452int kernel_metadata_flush_buffer(int fd)
453{
454 int ret;
455
456 ret = kernctl_buffer_flush(fd);
457 if (ret < 0) {
00e2e675 458 ERR("Fail to flush metadata buffers %d (ret: %d)", fd, ret);
f3ed775e
DG
459 }
460
461 return 0;
462}
463
464/*
050349bb 465 * Force flush buffer for channel.
f3ed775e
DG
466 */
467int kernel_flush_buffer(struct ltt_kernel_channel *channel)
468{
469 int ret;
470 struct ltt_kernel_stream *stream;
471
472 DBG("Flush buffer for channel %s", channel->channel->name);
473
474 cds_list_for_each_entry(stream, &channel->stream_list.head, list) {
475 DBG("Flushing channel stream %d", stream->fd);
476 ret = kernctl_buffer_flush(stream->fd);
477 if (ret < 0) {
df0f840b 478 PERROR("ioctl");
f3ed775e
DG
479 ERR("Fail to flush buffer for stream %d (ret: %d)",
480 stream->fd, ret);
481 }
482 }
483
484 return 0;
485}
486
8c0faa1d 487/*
050349bb 488 * Stop tracing session.
8c0faa1d
DG
489 */
490int kernel_stop_session(struct ltt_kernel_session *session)
491{
492 int ret;
493
494 ret = kernctl_stop_session(session->fd);
495 if (ret < 0) {
496 goto error;
497 }
498
499 DBG("Kernel session stopped");
500
501 return 0;
502
503error:
504 return ret;
505}
506
507/*
050349bb
DG
508 * Open stream of channel, register it to the kernel tracer and add it
509 * to the stream list of the channel.
8c0faa1d 510 *
050349bb 511 * Return the number of created stream. Else, a negative value.
8c0faa1d 512 */
f3ed775e 513int kernel_open_channel_stream(struct ltt_kernel_channel *channel)
8c0faa1d 514{
00e2e675 515 int ret, count = 0;
8c0faa1d
DG
516 struct ltt_kernel_stream *lks;
517
5a47c6a2 518 while ((ret = kernctl_create_stream(channel->fd)) >= 0) {
00e2e675 519 lks = trace_kernel_create_stream(channel->channel->name, count);
8c0faa1d 520 if (lks == NULL) {
799e2c4f
MD
521 ret = close(ret);
522 if (ret) {
523 PERROR("close");
524 }
8c0faa1d
DG
525 goto error;
526 }
527
528 lks->fd = ret;
7b395890
DG
529 /* Prevent fd duplication after execlp() */
530 ret = fcntl(lks->fd, F_SETFD, FD_CLOEXEC);
531 if (ret < 0) {
df0f840b 532 PERROR("fcntl session fd");
7b395890
DG
533 }
534
54012638 535 /* Add stream to channe stream list */
8c0faa1d
DG
536 cds_list_add(&lks->list, &channel->stream_list.head);
537 channel->stream_count++;
8c0faa1d 538
00e2e675
DG
539 /* Increment counter which represent CPU number. */
540 count++;
541
542 DBG("Kernel stream %s created (fd: %d, state: %d)", lks->name, lks->fd,
543 lks->state);
54012638 544 }
8c0faa1d
DG
545
546 return channel->stream_count;
547
548error:
54012638 549 return -1;
8c0faa1d
DG
550}
551
552/*
050349bb 553 * Open the metadata stream and set it to the kernel session.
8c0faa1d 554 */
f3ed775e 555int kernel_open_metadata_stream(struct ltt_kernel_session *session)
8c0faa1d
DG
556{
557 int ret;
558
559 ret = kernctl_create_stream(session->metadata->fd);
560 if (ret < 0) {
df0f840b 561 PERROR("kernel create metadata stream");
8c0faa1d
DG
562 goto error;
563 }
564
565 DBG("Kernel metadata stream created (fd: %d)", ret);
566 session->metadata_stream_fd = ret;
7b395890
DG
567 /* Prevent fd duplication after execlp() */
568 ret = fcntl(session->metadata_stream_fd, F_SETFD, FD_CLOEXEC);
569 if (ret < 0) {
df0f840b 570 PERROR("fcntl session fd");
7b395890 571 }
aaf26714
DG
572
573 return 0;
574
575error:
54012638 576 return -1;
aaf26714 577}
2ef84c95
DG
578
579/*
9f19cc17 580 * Get the event list from the kernel tracer and return the number of elements.
2ef84c95 581 */
9f19cc17 582ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
2ef84c95 583{
799e2c4f 584 int fd, pos, ret;
9f19cc17
DG
585 char *event;
586 size_t nbmem, count = 0;
2ef84c95
DG
587 ssize_t size;
588 FILE *fp;
9f19cc17 589 struct lttng_event *elist;
2ef84c95
DG
590
591 fd = kernctl_tracepoint_list(tracer_fd);
592 if (fd < 0) {
df0f840b 593 PERROR("kernel tracepoint list");
2ef84c95
DG
594 goto error;
595 }
596
597 fp = fdopen(fd, "r");
598 if (fp == NULL) {
df0f840b 599 PERROR("kernel tracepoint list fdopen");
61b73b12 600 goto error_fp;
2ef84c95
DG
601 }
602
603 /*
604 * Init memory size counter
605 * See kernel-ctl.h for explanation of this value
606 */
6725fe19 607 nbmem = KERNEL_EVENT_INIT_LIST_SIZE;
ba7f0ae5 608 elist = zmalloc(sizeof(struct lttng_event) * nbmem);
3b870559
MD
609 if (elist == NULL) {
610 PERROR("alloc list events");
611 count = -ENOMEM;
612 goto end;
613 }
2ef84c95 614
9f19cc17 615 while ((size = fscanf(fp, "event { name = %m[^;]; };%n\n", &event, &pos)) == 1) {
6725fe19 616 if (count >= nbmem) {
3b870559
MD
617 struct lttng_event *new_elist;
618
ced2f820 619 DBG("Reallocating event list from %zu to %zu bytes", nbmem,
6725fe19
DG
620 nbmem * 2);
621 /* Double the size */
622 nbmem <<= 1;
3b870559
MD
623 new_elist = realloc(elist, nbmem * sizeof(struct lttng_event));
624 if (new_elist == NULL) {
df0f840b 625 PERROR("realloc list events");
3b870559
MD
626 free(event);
627 free(elist);
61b73b12
MD
628 count = -ENOMEM;
629 goto end;
2ef84c95 630 }
3b870559 631 elist = new_elist;
2ef84c95 632 }
99497cd0
MD
633 strncpy(elist[count].name, event, LTTNG_SYMBOL_NAME_LEN);
634 elist[count].name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
67b9d018 635 elist[count].enabled = -1;
9f19cc17 636 count++;
3b870559 637 free(event);
2ef84c95
DG
638 }
639
9f19cc17 640 *events = elist;
ced2f820 641 DBG("Kernel list events done (%zu events)", count);
61b73b12 642end:
799e2c4f
MD
643 ret = fclose(fp); /* closes both fp and fd */
644 if (ret) {
645 PERROR("fclose");
646 }
9f19cc17 647 return count;
2ef84c95 648
61b73b12 649error_fp:
799e2c4f
MD
650 ret = close(fd);
651 if (ret) {
652 PERROR("close");
653 }
2ef84c95
DG
654error:
655 return -1;
656}
096102bd
DG
657
658/*
659 * Get kernel version and validate it.
660 */
661int kernel_validate_version(int tracer_fd)
662{
663 int ret;
664 struct lttng_kernel_tracer_version version;
665
666 ret = kernctl_tracer_version(tracer_fd, &version);
667 if (ret < 0) {
668 ERR("Failed at getting the lttng-modules version");
669 goto error;
670 }
671
672 /* Validate version */
a62a6556
MD
673 if (version.major != KERN_MODULES_PRE_MAJOR
674 && version.major != KERN_MODULES_MAJOR) {
096102bd 675 goto error_version;
096102bd
DG
676 }
677
a62a6556 678 DBG2("Kernel tracer version validated (major version %d)", version.major);
096102bd
DG
679 return 0;
680
681error_version:
5df0f285 682 ERR("Kernel major version %d is not compatible (supporting <= %d)",
a62a6556 683 version.major, KERN_MODULES_MAJOR)
096102bd
DG
684 ret = -1;
685
686error:
687 return ret;
688}
335a95b7
MD
689
690/*
691 * Kernel work-arounds called at the start of sessiond main().
692 */
693int init_kernel_workarounds(void)
694{
8936c33a 695 int ret;
335a95b7
MD
696 FILE *fp;
697
698 /*
699 * boot_id needs to be read once before being used concurrently
700 * to deal with a Linux kernel race. A fix is proposed for
701 * upstream, but the work-around is needed for older kernels.
702 */
703 fp = fopen("/proc/sys/kernel/random/boot_id", "r");
704 if (!fp) {
705 goto end_boot_id;
706 }
707 while (!feof(fp)) {
708 char buf[37] = "";
709
8936c33a
DG
710 ret = fread(buf, 1, sizeof(buf), fp);
711 if (ret < 0) {
712 /* Ignore error, we don't really care */
713 }
335a95b7 714 }
799e2c4f
MD
715 ret = fclose(fp);
716 if (ret) {
717 PERROR("fclose");
718 }
335a95b7 719end_boot_id:
335a95b7
MD
720 return 0;
721}
2f77fc4b
DG
722
723/*
724 * Complete teardown of a kernel session.
725 */
726void kernel_destroy_session(struct ltt_kernel_session *ksess)
727{
728 if (ksess == NULL) {
729 DBG3("No kernel session when tearing down session");
730 return;
731 }
732
733 DBG("Tearing down kernel session");
734
735 /* Close any relayd session */
736 consumer_output_send_destroy_relayd(ksess->consumer);
737
738 trace_kernel_destroy_session(ksess);
739}
This page took 0.109772 seconds and 4 git commands to generate.