On 08/13/2010 03:00 PM, 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
>
>
>
> Signed-off-by: Ivana Hutarova Varekova<[email protected]>
Acked-By: Jan Safranek <[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;
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> Libcg-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libcg-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to