From dcfad339bf776f2f58963b29088438fa79e20662 Mon Sep 17 00:00:00 2001 From: yangsheng <yangsheng> Date: Mon, 18 Aug 2008 05:36:25 +0000 Subject: [PATCH] Branch HEAD b=16283 i=adilger, sheng.yang Handle the new option for rhel5 /proc/mounts. --- lnet/utils/debug.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lnet/utils/debug.c b/lnet/utils/debug.c index e1371c7064..8dfc0fff26 100644 --- a/lnet/utils/debug.c +++ b/lnet/utils/debug.c @@ -787,9 +787,8 @@ static int jt_dbg_modules_2_5(int argc, char **argv) char *path = ""; char *kernel = "linux"; const char *proc = "/proc/modules"; - char modname[128], others[4096]; + char modname[128], buf[4096]; long modaddr; - int rc; FILE *file; if (argc >= 2) @@ -807,15 +806,17 @@ static int jt_dbg_modules_2_5(int argc, char **argv) return 0; } - while ((rc = fscanf(file, "%s %s %s %s %s %lx\n", - modname, others, others, others, others, &modaddr)) == 6) { - for (mp = mod_paths; mp->name != NULL; mp++) { - if (!strcmp(mp->name, modname)) - break; - } - if (mp->name) { - printf("add-symbol-file %s%s%s/%s.o 0x%0lx\n", path, - path[0] ? "/" : "", mp->path, mp->name, modaddr); + while (fgets(buf, sizeof(buf), file) != NULL) { + if (sscanf(buf, "%s %*s %*s %*s %*s %lx", modname, &modaddr) == 2) { + for (mp = mod_paths; mp->name != NULL; mp++) { + if (!strcmp(mp->name, modname)) + break; + } + if (mp->name) { + printf("add-symbol-file %s%s%s/%s.o 0x%0lx\n", + path, path[0] ? "/" : "", + mp->path, mp->name, modaddr); + } } } -- GitLab