On 07/29/2010 01:56 PM, Jan Safrane wrote:
> On 07/29/2010 10:45 AM, Ivana Hutarova Varekova wrote:
>> This patch adds option new option "-i" to lssubsys tool. This option 
>> displays for mount controllers
>> the number of hierarchie in which they are:
>>
>>
>> SEMANTIC:
>>         lssubsys  [-m|--mount-points] [-i|--hierarchies] [-a|--all]
>>
>>         -i, --hierrachies
>>                Display attached hierarchy number, if the subsystem is 
>> in a hierrachy.
>>         If the option -m is used too, then the hierarchy number is 
>> shown only for not mounted hierarchies.
>>
>> EXAMPLE:
>>          $ lssubsys -ami
>>          ns
>>          cpuset 5
>>          cpu,devices 6
>>          cpuacct /cgroup/cpuacct
>>          memory /cgroup/memory
>>          freezer /cgroup/freezer
>>          net_cls /cgroup/net_cls
>>
>>          $ lssubsys -ai
>>          ns
>>          cpuset 5
>>          cpu,devices 6
>>          cpuacct 7
>>          memory 8
>>          freezer 9
>>          net_cls 4
>
> I am not sure if it is a bug or feature:
> $ lssubsys -i
> cpuacct
> memory
> devices
> freezer
> net_cls
> -> no hierarchy numbers
>
> $lssubsys -ai
> ns
> blkio
> cpuset,cpu 29
> cpuacct 30
> memory 31
> devices 32
> freezer 33
> net_cls 34
> -> shows hierarchy numbers of controllers listed before without these 
> numbers
>
> Is this an intention?

Yep this is intentional, the option -i is parsed only if -a is used 
(described in man-page and --help output).
Ivana
>
>>
>>
>> Signed-off-by: Ivana Hutarova Varekova<[email protected]>
>> ---
>>
>>   src/tools/lssubsys.c |   16 +++++++++++++---
>>   1 files changed, 13 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/tools/lssubsys.c b/src/tools/lssubsys.c
>> index e48daa6..f1225be 100644
>> --- a/src/tools/lssubsys.c
>> +++ b/src/tools/lssubsys.c
>> @@ -22,7 +22,8 @@
>>   enum flag{
>>       FL_MOUNT = 1,    /* show the mount points */
>>       FL_LIST = 2,
>> -    FL_ALL = 4        /* show all subsystems - not mounted too */
>> +    FL_ALL = 4,        /* show all subsystems - not mounted too */
>> +    FL_HIERARCHY = 8    /* show info about hierarchies */
>>   };
>>
>>   typedef char cont_name_t[FILENAME_MAX];
>> @@ -46,6 +47,8 @@ static void usage(int status, const char 
>> *program_name)
>>           fprintf(stdout, "  -a, --all        "\
>>               "Display information about all controllers "\
>>               "(including not mounted ones) \n");
>> +        fprintf(stdout, "  -i, --hierarchies    Display information "\
>> +            "about hierarchies\n");
>>       }
>>   }
>>
>> @@ -246,7 +249,10 @@ next:
>>       }
>>
>>       cgroup_get_all_controller_end(&handle);
>> -    printf("\n");
>> +    if (flags&  FL_HIERARCHY)
>> +        printf(" %d\n", hierarchy);
>> +    else
>> +        printf("\n");
>>
>>       if (ret == ECGEOF)
>>           ret = 0;
>> @@ -323,6 +329,7 @@ int main(int argc, char *argv[])
>>           {"help", 0, 0, 'h'},
>>           {"mount-points", 0, 0, 'm'},
>>           {"all", 0, 0, 'a'},
>> +        {"hierarchies", 0, 0, 'i'},
>>           {0, 0, 0, 0}
>>       };
>>
>> @@ -330,7 +337,7 @@ int main(int argc, char *argv[])
>>           cont_name[i][0] = '\0';
>>
>>       /* parse arguments */
>> -    while ((c = getopt_long(argc, argv, "mha", options, NULL))>  0) {
>> +    while ((c = getopt_long(argc, argv, "mhai", options, NULL))>  0) {
>>           switch (c) {
>>           case 'h':
>>               usage(0, argv[0]);
>> @@ -341,6 +348,9 @@ int main(int argc, char *argv[])
>>           case 'a':
>>               flags |= FL_ALL;
>>               break;
>> +        case 'i':
>> +            flags |= FL_HIERARCHY;
>> +            break;
>>           default:
>>               usage(1, argv[0]);
>>               return -1;
>>
>>
>> ------------------------------------------------------------------------------
>>  
>>
>> The Palm PDK Hot Apps Program offers developers who use the
>> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
>> of $1 Million in cash or HP Products. Visit us here for more details:
>> http://p.sf.net/sfu/dev2dev-palm
>> _______________________________________________
>> Libcg-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/libcg-devel
>>
>


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to