Fix: lttng: -Wshadow error in cmd_snapshot
[lttng-tools.git] / src / bin / lttng-sessiond / modprobe.c
1 /*
2 * Copyright (C) 2011 David Goulet <dgoulet@efficios.com>
3 * Copyright (C) 2014 Jan Glauber <jan.glauber@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 */
8
9 /**
10 * @file modprobe.c
11 *
12 * @brief modprobe related functions.
13 *
14 */
15
16 #define _LGPL_SOURCE
17 #include <assert.h>
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <sys/wait.h>
21
22 #include <common/common.h>
23 #include <common/utils.h>
24
25 #include "modprobe.h"
26 #include "kern-modules.h"
27 #include "lttng-sessiond.h"
28
29 /* LTTng kernel tracer mandatory core modules list */
30 struct kern_modules_param kern_modules_control_core[] = {
31 {
32 .name = (char *) "lttng-ring-buffer-client-discard",
33 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED,
34 },
35 {
36 .name = (char *) "lttng-ring-buffer-client-overwrite",
37 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED,
38 },
39 {
40 .name = (char *) "lttng-ring-buffer-metadata-client",
41 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED,
42 },
43 {
44 .name = (char *) "lttng-ring-buffer-client-mmap-discard",
45 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED,
46 },
47 {
48 .name = (char *) "lttng-ring-buffer-client-mmap-overwrite",
49 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED,
50 },
51 {
52 .name = (char *) "lttng-ring-buffer-metadata-mmap-client",
53 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED,
54 },
55 {
56 .name = (char *) "lttng-ring-buffer-event_notifier-client",
57 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
58 },
59 {
60 .name = (char *) "lttng-counter-client-percpu-64-modular",
61 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
62 },
63 {
64 .name = (char *) "lttng-counter-client-percpu-32-modular",
65 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
66 },
67 };
68
69 /* LTTng kerneltracer probe modules list */
70 struct kern_modules_param kern_modules_probes_default[] = {
71 {
72 .name = (char *) "lttng-probe-asoc",
73 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
74 },
75 {
76 .name = (char *) "lttng-probe-block",
77 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
78 },
79 {
80 .name = (char *) "lttng-probe-btrfs",
81 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
82 },
83 {
84 .name = (char *) "lttng-probe-compaction",
85 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
86 },
87 {
88 .name = (char *) "lttng-probe-ext3",
89 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
90 },
91 {
92 .name = (char *) "lttng-probe-ext4",
93 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
94 },
95 {
96 .name = (char *) "lttng-probe-gpio",
97 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
98 },
99 {
100 .name = (char *) "lttng-probe-i2c",
101 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
102 },
103 {
104 .name = (char *) "lttng-probe-irq",
105 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
106 },
107 {
108 .name = (char *) "lttng-probe-jbd",
109 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
110 },
111 {
112 .name = (char *) "lttng-probe-jbd2",
113 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
114 },
115 {
116 .name = (char *) "lttng-probe-kmem",
117 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
118 },
119 {
120 .name = (char *) "lttng-probe-kvm",
121 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
122 },
123 {
124 .name = (char *) "lttng-probe-kvm-x86",
125 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
126 },
127 {
128 .name = (char *) "lttng-probe-kvm-x86-mmu",
129 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
130 },
131 {
132 .name = (char *) "lttng-probe-lock",
133 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
134 },
135 {
136 .name = (char *) "lttng-probe-module",
137 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
138 },
139 {
140 .name = (char *) "lttng-probe-napi",
141 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
142 },
143 {
144 .name = (char *) "lttng-probe-net",
145 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
146 },
147 {
148 .name = (char *) "lttng-probe-power",
149 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
150 },
151 {
152 .name = (char *) "lttng-probe-preemptirq",
153 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
154 },
155 {
156 .name = (char *) "lttng-probe-printk",
157 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
158 },
159 {
160 .name = (char *) "lttng-probe-random",
161 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
162 },
163 {
164 .name = (char *) "lttng-probe-rcu",
165 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
166 },
167 {
168 .name = (char *) "lttng-probe-regmap",
169 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
170 },
171 {
172 .name = (char *) "lttng-probe-regulator",
173 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
174 },
175 {
176 .name = (char *) "lttng-probe-rpm",
177 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
178 },
179 {
180 .name = (char *) "lttng-probe-sched",
181 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
182 },
183 {
184 .name = (char *) "lttng-probe-scsi",
185 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
186 },
187 {
188 .name = (char *) "lttng-probe-signal",
189 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
190 },
191 {
192 .name = (char *) "lttng-probe-skb",
193 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
194 },
195 {
196 .name = (char *) "lttng-probe-sock",
197 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
198 },
199 {
200 .name = (char *) "lttng-probe-statedump",
201 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
202 },
203 {
204 .name = (char *) "lttng-probe-sunrpc",
205 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
206 },
207 {
208 .name = (char *) "lttng-probe-timer",
209 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
210 },
211 {
212 .name = (char *) "lttng-probe-udp",
213 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
214 },
215 {
216 .name = (char *) "lttng-probe-vmscan",
217 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
218 },
219 {
220 .name = (char *) "lttng-probe-v4l2",
221 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
222 },
223 {
224 .name = (char *) "lttng-probe-workqueue",
225 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
226 },
227 {
228 .name = (char *) "lttng-probe-writeback",
229 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
230 },
231 {
232 .name = (char *) "lttng-probe-x86-irq-vectors",
233 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
234 },
235 {
236 .name = (char *) "lttng-probe-x86-exceptions",
237 .load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL,
238 },
239 };
240
241 /* dynamic probe modules list */
242 static struct kern_modules_param *probes;
243 static int nr_probes;
244 static int probes_capacity;
245
246 #if HAVE_KMOD
247 #include <libkmod.h>
248
249 /**
250 * @brief Logging function for libkmod integration.
251 */
252 static void log_kmod(void *data, int priority, const char *file, int line,
253 const char *fn, const char *format, va_list args)
254 {
255 char *str;
256
257 if (vasprintf(&str, format, args) < 0) {
258 return;
259 }
260
261 DBG("libkmod: %s", str);
262 free(str);
263 }
264
265 /**
266 * @brief Setup the libkmod context.
267 *
268 * Create the context, add a custom logging function and preload the
269 * ressources for faster operation.
270 *
271 * @returns \c 0 on success
272 * \c < 0 on error
273 */
274 static int setup_kmod_ctx(struct kmod_ctx **ctx)
275 {
276 int ret = 0;
277
278 *ctx = kmod_new(NULL, NULL);
279 if (!ctx) {
280 PERROR("Unable to create kmod library context");
281 ret = -ENOMEM;
282 goto error;
283 }
284
285 kmod_set_log_fn(*ctx, log_kmod, NULL);
286 ret = kmod_load_resources(*ctx);
287 if (ret < 0) {
288 ERR("Failed to load kmod library resources");
289 goto error;
290 }
291
292 error:
293 return ret;
294 }
295
296 /**
297 * @brief Loads the kernel modules in \p modules
298 *
299 * @param modules List of modules to load
300 * @param entries Number of modules in the list
301 *
302 * If the modules are required, we will return with error after the
303 * first failed module load, otherwise we continue loading.
304 *
305 * @returns \c 0 on success
306 * \c < 0 on error
307 */
308 static int modprobe_lttng(struct kern_modules_param *modules,
309 int entries)
310 {
311 int ret = 0, i;
312 struct kmod_ctx *ctx;
313
314 ret = setup_kmod_ctx(&ctx);
315 if (ret < 0) {
316 goto error;
317 }
318
319 for (i = 0; i < entries; i++) {
320 struct kmod_module *mod = NULL;
321
322 ret = kmod_module_new_from_name(ctx, modules[i].name, &mod);
323 if (ret < 0) {
324 PERROR("Failed to create kmod module for %s", modules[i].name);
325 goto error;
326 }
327
328 ret = kmod_module_probe_insert_module(mod, 0,
329 NULL, NULL, NULL, NULL);
330 if (ret == -EEXIST) {
331 DBG("Module %s is already loaded", modules[i].name);
332 ret = 0;
333 } else if (ret < 0) {
334 if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED) {
335 ERR("Unable to load required module %s",
336 modules[i].name);
337 goto error;
338 } else {
339 DBG("Unable to load optional module %s; continuing",
340 modules[i].name);
341 ret = 0;
342 }
343 } else {
344 DBG("Modprobe successfully %s", modules[i].name);
345 modules[i].loaded = true;
346 }
347
348 kmod_module_unref(mod);
349 }
350
351 error:
352 if (ctx) {
353 kmod_unref(ctx);
354 }
355 return ret;
356 }
357
358 /**
359 * @brief Recursively unload modules.
360 *
361 * This function implements the same modules unloading behavior as
362 * 'modprobe -r' or rmmod, it will recursevily go trought the \p module
363 * dependencies and unload modules with a refcount of 0.
364 *
365 * @param mod The module to unload
366 *
367 * @returns \c 0 on success
368 * \c < 0 on error
369 */
370 static int rmmod_recurse(struct kmod_module *mod) {
371 int ret = 0;
372 struct kmod_list *deps, *itr;
373
374 if (kmod_module_get_initstate(mod) == KMOD_MODULE_BUILTIN) {
375 DBG("Module %s is builtin", kmod_module_get_name(mod));
376 return ret;
377 }
378
379 ret = kmod_module_remove_module(mod, 0);
380
381 deps = kmod_module_get_dependencies(mod);
382 if (deps != NULL) {
383 kmod_list_foreach(itr, deps) {
384 struct kmod_module *dep = kmod_module_get_module(itr);
385 if (kmod_module_get_refcnt(dep) == 0) {
386 DBG("Recursive remove module %s",
387 kmod_module_get_name(dep));
388 rmmod_recurse(dep);
389 }
390 kmod_module_unref(dep);
391 }
392 kmod_module_unref_list(deps);
393 }
394
395 return ret;
396 }
397
398 /**
399 * @brief Unloads the kernel modules in \p modules
400 *
401 * @param modules List of modules to unload
402 * @param entries Number of modules in the list
403 *
404 */
405 static void modprobe_remove_lttng(const struct kern_modules_param *modules,
406 int entries)
407 {
408 int ret = 0, i;
409 struct kmod_ctx *ctx;
410
411 ret = setup_kmod_ctx(&ctx);
412 if (ret < 0) {
413 goto error;
414 }
415
416 for (i = entries - 1; i >= 0; i--) {
417 struct kmod_module *mod = NULL;
418
419 if (!modules[i].loaded) {
420 continue;
421 }
422
423 ret = kmod_module_new_from_name(ctx, modules[i].name, &mod);
424 if (ret < 0) {
425 PERROR("Failed to create kmod module for %s", modules[i].name);
426 goto error;
427 }
428
429 ret = rmmod_recurse(mod);
430 if (ret == -EEXIST) {
431 DBG("Module %s is not in kernel.", modules[i].name);
432 } else if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED && ret < 0) {
433 ERR("Unable to remove module %s", modules[i].name);
434 } else {
435 DBG("Modprobe removal successful %s",
436 modules[i].name);
437 }
438
439 kmod_module_unref(mod);
440 }
441
442 error:
443 if (ctx) {
444 kmod_unref(ctx);
445 }
446 }
447
448 #else /* HAVE_KMOD */
449
450 static int modprobe_lttng(struct kern_modules_param *modules,
451 int entries)
452 {
453 int ret = 0, i;
454 char modprobe[256];
455
456 for (i = 0; i < entries; i++) {
457 ret = snprintf(modprobe, sizeof(modprobe),
458 "/sbin/modprobe %s%s",
459 modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED ? "" : "-q ",
460 modules[i].name);
461 if (ret < 0) {
462 PERROR("snprintf modprobe");
463 goto error;
464 }
465 modprobe[sizeof(modprobe) - 1] = '\0';
466 ret = system(modprobe);
467 if (ret == -1) {
468 if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED) {
469 ERR("Unable to launch modprobe for required module %s",
470 modules[i].name);
471 goto error;
472 } else {
473 DBG("Unable to launch modprobe for optional module %s; continuing",
474 modules[i].name);
475 ret = 0;
476 }
477 } else if (WEXITSTATUS(ret) != 0) {
478 if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED) {
479 ERR("Unable to load required module %s",
480 modules[i].name);
481 goto error;
482 } else {
483 DBG("Unable to load optional module %s; continuing",
484 modules[i].name);
485 ret = 0;
486 }
487 } else {
488 DBG("Modprobe successfully %s", modules[i].name);
489 modules[i].loaded = true;
490 }
491 }
492
493 error:
494 return ret;
495 }
496
497 static void modprobe_remove_lttng(const struct kern_modules_param *modules,
498 int entries)
499 {
500 int ret = 0, i;
501 char modprobe[256];
502
503 for (i = entries - 1; i >= 0; i--) {
504 if (!modules[i].loaded) {
505 continue;
506 }
507 ret = snprintf(modprobe, sizeof(modprobe),
508 "/sbin/modprobe -r -q %s",
509 modules[i].name);
510 if (ret < 0) {
511 PERROR("snprintf modprobe -r");
512 return;
513 }
514 modprobe[sizeof(modprobe) - 1] = '\0';
515 ret = system(modprobe);
516 if (ret == -1) {
517 if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED) {
518 ERR("Unable to launch modprobe -r for required module %s",
519 modules[i].name);
520 } else {
521 DBG("Unable to launch modprobe -r for optional module %s",
522 modules[i].name);
523 }
524 } else if (WEXITSTATUS(ret) != 0) {
525 if (modules[i].load_policy == KERNEL_MODULE_PROPERTY_LOAD_POLICY_REQUIRED) {
526 ERR("Unable to remove required module %s",
527 modules[i].name);
528 } else {
529 DBG("Unable to remove optional module %s",
530 modules[i].name);
531 }
532 } else {
533 DBG("Modprobe removal successful %s", modules[i].name);
534 }
535 }
536 }
537
538 #endif /* HAVE_KMOD */
539
540 /*
541 * Remove control kernel module(s) in reverse load order.
542 */
543 void modprobe_remove_lttng_control(void)
544 {
545 modprobe_remove_lttng(kern_modules_control_core,
546 ARRAY_SIZE(kern_modules_control_core));
547 }
548
549 static void free_probes(void)
550 {
551 int i;
552
553 if (!probes) {
554 return;
555 }
556 for (i = 0; i < nr_probes; ++i) {
557 free(probes[i].name);
558 }
559 free(probes);
560 probes = NULL;
561 nr_probes = 0;
562 }
563
564 /*
565 * Remove data kernel modules in reverse load order.
566 */
567 void modprobe_remove_lttng_data(void)
568 {
569 if (!probes) {
570 return;
571 }
572
573 modprobe_remove_lttng(probes, nr_probes);
574 free_probes();
575 }
576
577 /*
578 * Remove all kernel modules in reverse order.
579 */
580 void modprobe_remove_lttng_all(void)
581 {
582 modprobe_remove_lttng_data();
583 modprobe_remove_lttng_control();
584 }
585
586 /*
587 * Load control kernel module(s).
588 */
589 int modprobe_lttng_control(void)
590 {
591 return modprobe_lttng(kern_modules_control_core,
592 ARRAY_SIZE(kern_modules_control_core));
593 }
594
595 /**
596 * Grow global list of probes (double capacity or set it to 1 if
597 * currently 0 and copy existing data).
598 */
599 static int grow_probes(void)
600 {
601 int i;
602 struct kern_modules_param *tmp_probes;
603
604 /* Initialize capacity to 1 if 0. */
605 if (probes_capacity == 0) {
606 probes = zmalloc(sizeof(*probes));
607 if (!probes) {
608 PERROR("malloc probe list");
609 return -ENOMEM;
610 }
611
612 probes_capacity = 1;
613 return 0;
614 }
615
616 /* Double size. */
617 probes_capacity *= 2;
618
619 tmp_probes = zmalloc(sizeof(*tmp_probes) * probes_capacity);
620 if (!tmp_probes) {
621 PERROR("malloc probe list");
622 return -ENOMEM;
623 }
624
625 for (i = 0; i < nr_probes; ++i) {
626 /* Ownership of 'name' field is transferred. */
627 tmp_probes[i] = probes[i];
628 }
629
630 /* Replace probes with larger copy. */
631 free(probes);
632 probes = tmp_probes;
633
634 return 0;
635 }
636
637 /*
638 * Appends a comma-separated list of probes to the global list
639 * of probes.
640 */
641 static int append_list_to_probes(const char *list)
642 {
643 char *next;
644 int ret;
645 char *tmp_list, *cur_list, *saveptr;
646
647 assert(list);
648
649 cur_list = tmp_list = strdup(list);
650 if (!tmp_list) {
651 PERROR("strdup temp list");
652 return -ENOMEM;
653 }
654
655 for (;;) {
656 size_t name_len;
657 struct kern_modules_param *cur_mod;
658
659 next = strtok_r(cur_list, ",", &saveptr);
660 if (!next) {
661 break;
662 }
663 cur_list = NULL;
664
665 /* filter leading spaces */
666 while (*next == ' ') {
667 next++;
668 }
669
670 if (probes_capacity <= nr_probes) {
671 ret = grow_probes();
672 if (ret) {
673 goto error;
674 }
675 }
676
677 /* Length 13 is "lttng-probe-" + \0 */
678 name_len = strlen(next) + 13;
679
680 cur_mod = &probes[nr_probes];
681 cur_mod->name = zmalloc(name_len);
682 if (!cur_mod->name) {
683 PERROR("malloc probe list");
684 ret = -ENOMEM;
685 goto error;
686 }
687
688 ret = snprintf(cur_mod->name, name_len, "lttng-probe-%s", next);
689 if (ret < 0) {
690 PERROR("snprintf modprobe name");
691 ret = -ENOMEM;
692 goto error;
693 }
694
695 cur_mod->load_policy = KERNEL_MODULE_PROPERTY_LOAD_POLICY_OPTIONAL;
696
697 nr_probes++;
698 }
699
700 free(tmp_list);
701 return 0;
702
703 error:
704 free(tmp_list);
705 free_probes();
706 return ret;
707 }
708
709 /*
710 * Load data kernel module(s).
711 */
712 int modprobe_lttng_data(void)
713 {
714 int ret, i;
715 char *list;
716
717 /*
718 * Base probes: either from command line option, environment
719 * variable or default list.
720 */
721 list = the_config.kmod_probes_list.value;
722 if (list) {
723 /* User-specified probes. */
724 ret = append_list_to_probes(list);
725 if (ret) {
726 return ret;
727 }
728 } else {
729 /* Default probes. */
730 int def_len = ARRAY_SIZE(kern_modules_probes_default);
731
732 probes = zmalloc(sizeof(*probes) * def_len);
733 if (!probes) {
734 PERROR("malloc probe list");
735 return -ENOMEM;
736 }
737
738 nr_probes = probes_capacity = def_len;
739
740 for (i = 0; i < def_len; ++i) {
741 char* name = strdup(kern_modules_probes_default[i].name);
742
743 if (!name) {
744 PERROR("strdup probe item");
745 ret = -ENOMEM;
746 goto error;
747 }
748
749 probes[i].name = name;
750 probes[i].load_policy = kern_modules_probes_default[i].load_policy;
751 }
752 }
753
754 /*
755 * Extra modules? Append them to current probes list.
756 */
757 list = the_config.kmod_extra_probes_list.value;
758 if (list) {
759 ret = append_list_to_probes(list);
760 if (ret) {
761 goto error;
762 }
763 }
764
765 /*
766 * Load probes modules now.
767 */
768 ret = modprobe_lttng(probes, nr_probes);
769 if (ret) {
770 goto error;
771 }
772 return ret;
773
774 error:
775 free_probes();
776 return ret;
777 }
This page took 0.051274 seconds and 4 git commands to generate.