lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0905300935570.14994@gandalf.stny.rr.com>
Date:	Sat, 30 May 2009 09:36:51 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	GeunSik Lim <leemgs1@...il.com>
cc:	Greg KH <greg@...ah.com>,
	linux-kernel <linux-kernel@...r.kernel.org>, trivial@...nel.org,
	balagi@...tmail.de, bgamari@...il.com, Ingo Molnar <mingo@...e.hu>,
	inaky.perez-gonzalez@...el.com
Subject: Re: [RFC V2 PATCH]debugfs:Fix terminology inconsistency of dir name
  to mount debugfs filesystem.


On Sat, 30 May 2009, GeunSik Lim wrote:
> > Here's the function I use:
> >
> > #define _STR(x) x
> > #define STR(x) _STR(x)
> > #define MAX_PATH 256
> >
> > const char *find_debugfs(void)
> > {
> >        static char debugfs[MAX_PATH+1];
> >        static int debugfs_found;
> >        char type[100];
> >        FILE *fp;
> >
> >        if (debugfs_found)
> >                return debugfs;
> >
> >
> >        if ((fp = fopen("/proc/mounts","r")) == NULL) {
> >                perror("/proc/mounts");
> >                return NULL;
> >        }
> >
> >        while (fscanf(fp, "%*s %"
> >                      STR(MAX_PATH)
> >                      "s %99s %*s %*d %*d\n",
> >                      debugfs, type) == 2) {
> >                if (strcmp(type, "debugfs") == 0)
> >                        break;
> >        }
> >        fclose(fp);
> >
> >        if (strcmp(type, "debugfs") != 0) {
> >                fprintf(stderr, "debugfs not mounted");
> >                return NULL;
> >        }
> >
> >        debugfs_found = 1;
> >
> >        return debugfs;
> > }
> >
> > This might be a good idea to show it. This is the most robust since it
> > does not hard code the debugfs directory.
> Yes, I think so. I have one opinion in the above find_debugfs() function.
> Default directory  is "/sys/kernel/debug/tracing" in ftrace.txt file
> as you mentioned.
> I will append  below code for "***/tracing/" directory name.
> 
>          int size;
>          [...]
>          size = MAX_PATH - strlen(debugfs);
>          strncat(debugfs, "/tracing/", size);
>          return debugfs;

Heh, I usually have another function to add the /tracing part. But sure, 
we could do that too.

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ