ltt-sessiond: use short options for modprobe in order to support Busybox
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 3 Nov 2011 11:51:21 +0000 (12:51 +0100)
committerDavid Goulet <david.goulet@polymtl.ca>
Thu, 3 Nov 2011 13:49:10 +0000 (09:49 -0400)
Many embedded systems are based on Busybox, and therefore use the
Busybox implementation of modprobe. This implementation does not
support long options such as --remove and --quiet, only short options
such as -r and -q are supported.

This patches changes ltt-sessiond to use the short options, which are
more widely available, and allows lttng to work easily on a
Busybox-based system.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
ltt-sessiond/main.c

index 334af53a4347a97be408045aebb7ed83007c0f27..2c2fe44bf52771c54415e58766f03bd385e4c9ec 100644 (file)
@@ -211,16 +211,16 @@ static int modprobe_remove_kernel_modules(void)
 
        for (i = ARRAY_SIZE(kernel_modules_list) - 1; i >= 0; i--) {
                ret = snprintf(modprobe, sizeof(modprobe),
-                               "/sbin/modprobe --remove --quiet %s",
+                               "/sbin/modprobe -r -q %s",
                                kernel_modules_list[i].name);
                if (ret < 0) {
-                       perror("snprintf modprobe --remove");
+                       perror("snprintf modprobe -r");
                        goto error;
                }
                modprobe[sizeof(modprobe) - 1] = '\0';
                ret = system(modprobe);
                if (ret == -1) {
-                       ERR("Unable to launch modprobe --remove for module %s",
+                       ERR("Unable to launch modprobe -r for module %s",
                                        kernel_modules_list[i].name);
                } else if (kernel_modules_list[i].required
                                && WEXITSTATUS(ret) != 0) {
@@ -1490,7 +1490,7 @@ static int modprobe_kernel_modules(void)
        for (i = 0; i < ARRAY_SIZE(kernel_modules_list); i++) {
                ret = snprintf(modprobe, sizeof(modprobe),
                        "/sbin/modprobe %s%s",
-                       kernel_modules_list[i].required ? "" : "--quiet ",
+                       kernel_modules_list[i].required ? "" : "-q ",
                        kernel_modules_list[i].name);
                if (ret < 0) {
                        perror("snprintf modprobe");
This page took 0.028509 seconds and 4 git commands to generate.