+ int i, ret;
+ int entries = ARRAY_SIZE(kern_modules_probes_default);
+ char *list, *next;
+
+ /*
+ * First take command line option, if not available take environment
+ * variable.
+ */
+ if (kmod_probes_list) {
+ list = kmod_probes_list;
+ } else {
+ list = utils_get_kmod_probes_list();
+ }
+ /* The default is to load ALL probes */
+ if (!list) {
+ return modprobe_lttng(kern_modules_probes_default, entries,
+ LTTNG_MOD_OPTIONAL);
+ }
+
+ /*
+ * A probe list is available, so use it.
+ * The number of probes is limited by the number of probes in the
+ * default list.
+ */
+ probes = zmalloc(sizeof(struct kern_modules_param *) * entries);
+ if (!probes) {
+ PERROR("malloc probe list");
+ return -ENOMEM;
+ }
+
+ for (i = 0; i < entries; i++) {
+ size_t name_len;
+
+ next = strtok(list, ",");
+ if (!next) {
+ goto out;
+ }
+ list = NULL;
+
+ /* filter leading spaces */
+ while (*next == ' ') {
+ next++;
+ }
+
+ /* Length 13 is "lttng-probe-" + \0 */
+ name_len = strlen(next) + 13;
+
+ probes[i].name = zmalloc(name_len);
+ if (!probes[i].name) {
+ PERROR("malloc probe list");
+ return -ENOMEM;
+ }
+
+ ret = snprintf(probes[i].name, name_len, "lttng-probe-%s", next);
+ if (ret < 0) {
+ PERROR("snprintf modprobe name");
+ goto out;
+ }
+ }
+
+out:
+ nr_probes = i;
+ return modprobe_lttng(probes, nr_probes, LTTNG_MOD_OPTIONAL);