[Crash-utility] A new option of the new command lscgroup

Dave Anderson anderson at redhat.com
Thu Nov 15 13:37:00 UTC 2012



----- Original Message -----
> Hello, Dave,
> 
> I have read your mail and think over the suggestions and done some
> changes. Firstly, I added a new option "-a" to meet the demand that user
> can enter a cgroup address and it would display its controller/path
> name.
> 
> Secondly, previously, when user specify controller:path to display
> chosen cgroups,there is no option. To make it in accordance with -a
> option, I did a little change, that is when user specify
> controller:path, there should be a option -g. The following example
> illustrates the change.
> Previously, user may run : crash> lscgroup cpu:/
> but now, user should run  : crash > lscgroup -g cpu:/
> 
> Accordingly,the help information was revised. You can refer to the
> help information and attachment to see detailed changes.
> 
> Many thanks
> Yongming Yu

Why bother with -a or -g?  The argument type can easily be
differentiated between a name string and a hexadecimal argument.
Many of the crash commands do that.  In your case, you could
simply do something like this:

        if (args[optind]) {
                do {
			if (hexadecimal(args[optind], 0))
				/* cgroup address */
                                ...
			} else {
                                /* must be a name string */
                                ...
			}
                        optind++;
                } while(args[optind]);
        }

Dave




More information about the Crash-utility mailing list