diff options
author | Clark Williams <williams@redhat.com> | 2011-09-07 15:32:54 -0500 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2011-09-07 15:32:54 -0500 |
commit | ff044e71420ccaf066adc02d27df53edffc76b5b (patch) | |
tree | c6c68203e9a74bdab65dc44b9c2d916de6bef464 | |
parent | 7c59bf385d7f03ccd324e6cb33a87b97593b7008 (diff) | |
download | rt-tests-ff044e71420ccaf066adc02d27df53edffc76b5b.tar.gz |
handle stupid systemd automount of debugfs
Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r-- | src/lib/rt-utils.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c index 952ad7f..4776c00 100644 --- a/src/lib/rt-utils.c +++ b/src/lib/rt-utils.c @@ -25,6 +25,7 @@ char *get_debugfileprefix(void) char type[100]; FILE *fp; int size; + int found = 0; if (debugfileprefix[0] != '\0') return debugfileprefix; @@ -36,12 +37,19 @@ char *get_debugfileprefix(void) STR(MAX_PATH) "s %99s %*s %*d %*d\n", debugfileprefix, type) == 2) { - if (strcmp(type, "debugfs") == 0) + if (strcmp(type, "debugfs") == 0) { + found = 1; break; + } + if ((strcmp(debugfileprefix, "/sys/kernel/debug") == 0) && + (strcmp(type, "systemd") == 0)) { + found = 1; + break; + } } fclose(fp); - if (strcmp(type, "debugfs") != 0) { + if (!found) { debugfileprefix[0] = '\0'; return debugfileprefix; } @@ -56,15 +64,23 @@ int mount_debugfs(char *path) { char *mountpoint = path; char cmd[MAX_PATH]; + char *prefix; int ret; - if (get_debugfileprefix()) + if (!path) + printf("mount_debugfs: null input\n"); + + prefix = get_debugfileprefix(); + if (strlen(prefix)) { + printf("mount_debugfs: current debug fileprefix: %s\n", prefix); return 0; + } if (!mountpoint) mountpoint = "/sys/kernel/debug"; sprintf(cmd, "mount -t debugfs debugfs %s", mountpoint); + printf("running: %s\n", cmd); ret = system(cmd); if (ret != 0) { fprintf(stderr, "Error mounting debugfs at %s: %s\n", mountpoint, strerror(errno)); |