On Thu, 15 Mar 2007 11:06:55 -0800 Andrew Morton wrote:

> > On Wed, 14 Mar 2007 17:48:32 +0530 Balbir Singh <[EMAIL PROTECTED]> wrote:
> > Randy.Dunlap wrote:
> > > Hi,
> > > 
> > > Documentation/accounting/delay-accounting.txt says that the
> > > getdelays program has a "-c cmd" argument, but that option
> > > does not seem to exist in Documentation/account/getdelays.c.
> > > 
> > > Do you have an updated version of getdelays.c?
> > > If not, please correct that documentation.
> > > 
> > 
> > Yes, I did, but then I changed my laptop. I should have it archived
> > at some place, I'll dig it out or correct the documentation.
> > 
> > > Is getdelays.c the best available example of a program
> > > using the taskstats netlink interface?
> > > 
> > 
> > It's the most portable example, since it does not depend on libnl.
> 
> err, what is libnl?

lib-netlink (as already answered, but I wrote this last week)

> If there exists some real userspace infrastructure which utilises
> taskstats, can we please get a referece to it into the kernel
> Documentation?  Perhaps in the TASKSTATS Kconfig entry, thanks.


Balbir, I was working with getdelays.c when I initially wrote
these questions.  Here is a small patch for it.  Hopefully you can
use it when you find the updated version of it.

~Randy

From: Randy Dunlap <[EMAIL PROTECTED]>

1.  add usage() function

2.  add unknown character in %c format (was only in %d, not useful):

./getdelays: invalid option -- h
Unknown option '?' (63)

instead of:

./getdelays: invalid option -- h
Unknown option 63

(or just remove that message)

3.  -v does not use an optarg, so remove ':' in getopt string after 'v';

Signed-off-by: Randy Dunlap <[EMAIL PROTECTED]>
---
 getdelays.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

--- old/Documentation/accounting/getdelays.c
+++ new/Documentation/accounting/getdelays.c
@@ -72,6 +72,15 @@ struct msgtemplate {
 
 char cpumask[100+6*MAX_CPUS];
 
+static void usage(void)
+{
+       fprintf(stderr, "getdelays [-dilv] [-w logfile] [-r bufsize] [-m 
cpumask] [-t tgid] [-p pid]\n");
+       fprintf(stderr, "  -d: print delayacct stats\n");
+       fprintf(stderr, "  -i: print IO accounting\n");
+       fprintf(stderr, "  -l: listen forever\n");
+       fprintf(stderr, "  -v: debug on\n");
+}
+
 /*
  * Create a raw netlink socket and bind
  */
@@ -227,7 +236,7 @@ int main(int argc, char *argv[])
        struct msgtemplate msg;
 
        while (1) {
-               c = getopt(argc, argv, "diw:r:m:t:p:v:l");
+               c = getopt(argc, argv, "diw:r:m:t:p:vl");
                if (c < 0)
                        break;
 
@@ -277,7 +286,8 @@ int main(int argc, char *argv[])
                        loop = 1;
                        break;
                default:
-                       printf("Unknown option %d\n", c);
+                       printf("Unknown option '%c' (%d)\n", c, c);
+                       usage();
                        exit(-1);
                }
        }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to