]> git.ipfire.org Git - thirdparty/libcgroup.git/log
thirdparty/libcgroup.git
14 years agoUpdate cgsnapshot_blacklist.conf to 2.6.36
Ivana Hutarova Varekova [Wed, 27 Oct 2010 04:38:23 +0000 (06:38 +0200)] 
Update cgsnapshot_blacklist.conf to 2.6.36

In 2.3.36 there is new variable (memory.oom_control)
in memory controller, this variable should be blacklisted now
(cgsnapshot should have some additonal logic for it)

Signed-off-by: Ivana Hutarova Varekova<varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
14 years agoFix wrong formating in cgset man page
Ivana Hutarova Varekova [Wed, 27 Oct 2010 05:32:14 +0000 (07:32 +0200)] 
Fix wrong formating in cgset man page

This patch fixes man-page formating in cgset man page

man-page without the fix:
SYNOPSIS
       cgset [-r <name=value>] <cgroup_path> ...  cgset --copy-from <source_cgrup_path> <cgroup_path> ...

man-page with the fix:
SYNOPSIS
       cgset [-r <name=value>] <cgroup_path> ...
       cgset --copy-from <source_cgrup_path> <cgroup_path> ...

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
14 years ago'service cgred start' should print some meaningful error message when
Jan Safranek [Wed, 10 Nov 2010 15:09:55 +0000 (16:09 +0100)] 
'service cgred start' should print some meaningful error message when
there are no cgroups on the system.

Before:
Starting CGroup Rules Engine Daemon:              [FAILED]
After:
Starting CGroup Rules Engine Daemon:
Cannot find cgroups, is cgconfig service running? [FAILED]

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
14 years agoBefore: Error: libcgroup initialization failed, 50001
Jan Safranek [Wed, 10 Nov 2010 15:09:55 +0000 (16:09 +0100)] 
Before: Error: libcgroup initialization failed, 50001
Now:    Error: libcgroup initialization failed, Cgroup is not mounted

Changelog:
  - point to /etc/cgrules/conf when loading of the rules failed
    Before: Error: libcgroup failed to initialize rulescache, No such file or
            directory
    Now:    Error: libcgroup failed to initialize rulescache from
            /etc/cgrules.conf. No such file or directory

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
14 years agoThis patch fixes init script to use -f and -d options for cgcreate when it creates
Ivana Hutarova Varekova [Wed, 10 Nov 2010 15:08:21 +0000 (16:08 +0100)] 
This patch fixes init script to use -f and -d options for cgcreate when it creates
sysdefault control groups

CHANGELOG:
* fix the permission tags (used the permission numbers which jan suggested)

Signed-off-by: Ivana Hutarova Varekova<varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoThis patch add options -f and -d to cgcreate, it cause the permission change of the...
Ivana Hutarova Varekova [Wed, 10 Nov 2010 15:08:21 +0000 (16:08 +0100)] 
This patch add options -f and -d to cgcreate, it cause the permission change of the files of the created group
-d, --dperm mode
              sets the permission mode of control groups directory.  The mode have to be set using octal numbers e.g.  -d 775.
-f, --fperm mode
              sets the permission mode of control groups files.  The mode have to be set using octal numbers e.g.  -f 775.

CHANGELOG v1:
* fix jsafrane foodback thanks for it)

EXAMPLE:
#cgcreate -f 775 -d 775 -g devices:with
#cgcreate -g devices:without
# ll /cgroup/devices/ | grep with
drwxrwxr-x. 2 root root 0 Oct 29 06:55 with
drwxr-xr-x. 2 root root 0 Oct 29 06:55 without
# ll /cgroup/devices/with
total 0
-rwxrwxr-x. 1 root root 0 Oct 29 06:55 cgroup.event_control
-rwxrwxr-x. 1 root root 0 Oct 29 06:55 cgroup.procs
-rwxrwxr-x. 1 root root 0 Oct 29 06:55 devices.allow
-rwxrwxr-x. 1 root root 0 Oct 29 06:55 devices.deny
-rwxrwxr-x. 1 root root 0 Oct 29 06:55 devices.list
-rwxrwxr-x. 1 root root 0 Oct 29 06:55 notify_on_release
-rwxrwxr-x. 1 root root 0 Oct 29 06:55 tasks
# ll /cgroup/devices/without/
total 0
--w--w--w-. 1 root root 0 Oct 29 06:55 cgroup.event_control
-r--r--r--. 1 root root 0 Oct 29 06:55 cgroup.procs
--w-------. 1 root root 0 Oct 29 06:55 devices.allow
--w-------. 1 root root 0 Oct 29 06:55 devices.deny
-r--r--r--. 1 root root 0 Oct 29 06:55 devices.list
-rw-r--r--. 1 root root 0 Oct 29 06:55 notify_on_release
-rw-r--r--. 1 root root 0 Oct 29 06:55 tasks

Signed-off-by: Ivana Hutarova Varekova<varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoThis patch adds permission change function
Ivana Hutarova Varekova [Wed, 10 Nov 2010 15:08:20 +0000 (16:08 +0100)] 
This patch adds permission change function
int cg_chmod_recursive(struct cgroup *cgroup, mode_t dir_mode,
       int dirm_change, mode_t file_mode, int filem_change);

It changes the directory and files permissions to the given values.
If dirm_change is nonzero, then directory permissions will be set to the second parameter
dir_mode.
If filem_change is nonzero, then directory permissions will be set to the second parameter
file_mode.

CHANGELOG v2:
* fix the return value check for cg_chmod_file procedure

CHANGELOG v1:
* improve the patch description and typo in comment
* fix the problems jsafrane reported

Signed-off-by: Ivana Hutarova Varekova<varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoThis patch removes the permission change from control_group_create function
Ivana Hutarova Varekova [Wed, 10 Nov 2010 15:08:20 +0000 (16:08 +0100)] 
This patch removes the permission change from control_group_create function
It should be done only if the caller needs it not by default.

EXAMPLE:
before the change:
# ./tools/cgcreate -g devices:/test1
# ll /cgroup/cpu3/test1
total 0
-rwxrwxr-x. 1 root root 0 2010-11-02 08:05 cgroup.procs
-rwxrwxr-x. 1 root root 0 2010-11-02 08:05 devices.allow
-rwxrwxr-x. 1 root root 0 2010-11-02 08:05 devices.deny
-rwxrwxr-x. 1 root root 0 2010-11-02 08:05 devices.list
-rwxrwxr-x. 1 root root 0 2010-11-02 08:05 notify_on_release
-rwxrwxr-x. 1 root root 0 2010-11-02 08:05 tasks
# ll /cgroup/cpu3/ | grep test1
drwxrwxr-x. 2 root root 0 2010-11-02 08:05 test1

after the change:
# ./tools/cgcreate -g devices:/test2
# ll /cgroup/cpu3/test2
total 0
-r--r--r--. 1 root root 0 2010-11-02 08:04 cgroup.procs
--w-------. 1 root root 0 2010-11-02 08:04 devices.allow
--w-------. 1 root root 0 2010-11-02 08:04 devices.deny
-r--r--r--. 1 root root 0 2010-11-02 08:04 devices.list
-rw-r--r--. 1 root root 0 2010-11-02 08:04 notify_on_release
-rw-r--r--. 1 root root 0 2010-11-02 08:04 tasks
# ll /cgroup/cpu3/ | grep test2
drwxr-xr-x. 2 root root 0 2010-11-02 08:04 test2

Signed-off-by: Ivana Hutarova Varekova<varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoThis patch adds help option to cgcreate tool
Ivana Hutarova Varekova [Wed, 10 Nov 2010 15:08:20 +0000 (16:08 +0100)] 
This patch adds help option to cgcreate tool
and unified the cgget error messages

CHANGELOG v1:
* fix the typo (thanks jsafrane)

Signed-off-by: Ivana Hutarova Varekova<varekova@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoAdd cgsnapshot to .spec file
Jan Safranek [Tue, 2 Nov 2010 11:27:01 +0000 (12:27 +0100)] 
Add cgsnapshot to .spec file

Add new cgsnapshot tool to libcgroup.spec.

14 years agov0.37.rc
Dhaval Giani [Mon, 1 Nov 2010 23:03:16 +0000 (00:03 +0100)] 
v0.37.rc

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
14 years agocgget output patch
Ivana Hutarova Varekova [Tue, 26 Oct 2010 06:51:57 +0000 (08:51 +0200)] 
cgget output patch

This patch fixes cgget to put newline character to the end of all lines

--------------------------------
EXAMPLE:
OLD:
$ ./cgget -g devices //CBSFxx/Zcz6
//CBSFxx/Zcz6:
devices.list: a *:* rwm
devices.deny: devices.allow:

NEW:
$ ./cgget -g devices //CBSFxx/Zcz6
//CBSFxx/Zcz6:
devices.list: a *:* rwm
devices.deny:
devices.allow:

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
14 years agocgroup_read_value_begin return value patch
Ivana Hutarova Varekova [Tue, 26 Oct 2010 06:51:39 +0000 (08:51 +0200)] 
cgroup_read_value_begin return value patch

there is a typo in cgroup_read_value_begin
return value, this patch fixes it

----------------
EXAMPLE:
OLD:
$ cgget -g devices //CBSFxx/Zcz6
//CBSFxx/Zcz6:
devices.list: a *:* rwm
devices.deny: a *:* rwm
devices.allow: a *:* rwm
$

NEW:
$ cgget -g devices //CBSFxx/Zcz6
//CBSFxx/Zcz6:
devices.list: a *:* rwm
devices.deny: devices.allow: $

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
14 years agoremove cpuacct.usage_percpu from the blacklist
Ivana Hutarova Varekova [Thu, 21 Oct 2010 12:35:36 +0000 (14:35 +0200)] 
remove cpuacct.usage_percpu from the blacklist

This patch removes cpuacct.usage_percpu from the blacklist
(the variable should not be output because it is read-only one)

Signed-off-by: Ivana Hutarova Varekova<varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agofixes the cgsnapshot problem with pfile permisssions
Ivana Hutarova Varekova [Mon, 25 Oct 2010 10:27:08 +0000 (12:27 +0200)] 
fixes the cgsnapshot problem with pfile permisssions

cgpconfigparser changes the permissions of all files. That's why to test whether the variable file is writable, there have to be used the variable file from the root group.

  CHANGELOG:
* add the information why root group is used for finding which variable is writable

Signed-off-by: Ivana Hutarova Varekova<varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoremove cpuacct.stat from the blacklist
Ivana Hutarova Varekova [Thu, 21 Oct 2010 12:35:20 +0000 (14:35 +0200)] 
remove cpuacct.stat from the blacklist

This patch removes cpuacct.stat from the blacklist
(the variable should not be output because it is read-only one)

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoadd devices controller logic to cgsnapshot tool
Ivana Hutarova Varekova [Mon, 25 Oct 2010 10:32:19 +0000 (12:32 +0200)] 
add devices controller logic to cgsnapshot tool

This patch adds devices controller logic to cgsnapshot tool
so now it is able to parse devices.

CHANGELOG:
 * incorporate Jan's feedback

EXAMPLE:
# cgget -g devices /dev
/dev:
devices.list=c 1:* wm
devices.deny=
devices.allow=

# cgsnapshot -b samples/blacklist.conf -w samples/whitelist.conf
# Configuration file generated by cgsnapshot
mount {
cpuset = /cgroup/1;
cpu = /cgroup/2;
cpuacct = /cgroup/3;
memory = /cgroup/4;
devices = /cgroup/5;
freezer = /cgroup/6;
net_cls = /cgroup/7;
}

group dev {
perm {
admin {
uid = root;
gid = root;
}
task {
uid = root;
gid = root;
}
}
devices {
devices.deny="a *:* rwm";
devices.allow="c 1:* wm";
}
}

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoMerge branch 'master' of ssh://libcg.git.sourceforge.net/gitroot/libcg/libcg
Balbir Singh [Wed, 20 Oct 2010 14:20:14 +0000 (19:50 +0530)] 
Merge branch 'master' of ssh://libcg.git.sourceforge.net/gitroot/libcg/libcg

14 years agoCHANGELOG v3
Ivana Hutarova Varekova [Wed, 20 Oct 2010 13:41:14 +0000 (19:11 +0530)] 
CHANGELOG v3
    * change the structure of blacklist to be relevant to cgsnapshot changes
 * remove =n/y part of record
 * remove =y records

CHANGELOG v2
* whitelist -> blacklist

CHANGELOG v1
* fix balbir comments: remove devices.(deny/allow)

the default cgsnapshot configuration file
contains is relevant to kernel  2.6.34

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
14 years agoCHANGELOG v3
Ivana Hutarova Varekova [Wed, 20 Oct 2010 13:41:14 +0000 (19:11 +0530)] 
CHANGELOG v3
    * change the structure of blacklist to be relevant to cgsnapshot changes
 * remove =n/y part of record
 * remove =y records

CHANGELOG v2
* whitelist -> blacklist

CHANGELOG v1
* fix balbir comments: remove devices.(deny/allow)

the default cgsnapshot configuration file
contains is relevant to kernel  2.6.34

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
14 years agoCHANGELOG v4
Ivana Hutarova Varekova [Wed, 20 Oct 2010 13:39:15 +0000 (19:09 +0530)] 
CHANGELOG v4
* fix the description of the default behavior of -w option

CHANGELOG v3
* fix the man page to show the actual cgsnapshot options

CHANGELOG v2
* incorporate dhaval?? feedback
whitelist -> blacklist

    CHANGELOG v1
* fix jsafranek comments

This patch adds cgsnapshot man page

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
14 years agoMerge branch 'master' of ssh://libcg.git.sourceforge.net/gitroot/libcg/libcg
Balbir Singh [Wed, 20 Oct 2010 14:03:42 +0000 (19:33 +0530)] 
Merge branch 'master' of ssh://libcg.git.sourceforge.net/gitroot/libcg/libcg

14 years agoCHANGELOG v3
Ivana Hutarova Varekova [Wed, 20 Oct 2010 13:41:14 +0000 (19:11 +0530)] 
CHANGELOG v3
    * change the structure of blacklist to be relevant to cgsnapshot changes
 * remove =n/y part of record
 * remove =y records

CHANGELOG v2
* whitelist -> blacklist

CHANGELOG v1
* fix balbir comments: remove devices.(deny/allow)

the default cgsnapshot configuration file
contains is relevant to kernel  2.6.34

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
14 years agothe default cgsnapshot configuration file
Balbir Singh [Wed, 20 Oct 2010 13:41:49 +0000 (19:11 +0530)] 
the default cgsnapshot configuration file
    contains all variables from  2.6.34

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
14 years agoCHANGELOG v3
Balbir Singh [Wed, 20 Oct 2010 13:41:14 +0000 (19:11 +0530)] 
CHANGELOG v3
    * change the structure of blacklist to be relevant to cgsnapshot changes
 * remove =n/y part of record
 * remove =y records

CHANGELOG v2
* whitelist -> blacklist

CHANGELOG v1
* fix balbir comments: remove devices.(deny/allow)

the default cgsnapshot configuration file
contains is relevant to kernel  2.6.34

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
14 years agoCHANGELOG v4
Balbir Singh [Wed, 20 Oct 2010 13:39:15 +0000 (19:09 +0530)] 
CHANGELOG v4
* fix the description of the default behavior of -w option

CHANGELOG v3
* fix the man page to show the actual cgsnapshot options

CHANGELOG v2
* incorporate dhaval?? feedback
whitelist -> blacklist

    CHANGELOG v1
* fix jsafranek comments

This patch adds cgsnapshot man page

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
14 years agoThis patch adds cgsnapshot tool
Ivana Hutarova Varekova [Wed, 20 Oct 2010 13:37:52 +0000 (19:07 +0530)] 
This patch adds cgsnapshot tool

CHANGELOGS:
CHANGELOG v7
* fix the warnings, remove the root path variable at all, free the name

CHANGELOG v6
* remove the default whitelist (now default state is no whitelist is used)
* incorporate jan's feedback
 * dynamic allocation of variable names in lists
 * fix the path names and reading

CHANGELOG v5
 * add the default blacklist and  whitelist
 * -w, -b: there is options for setting both blacklist and whitelist configuration files
 * -t: add the possibility to read the whitelist strictly

CHANGELOG v4
* incorporate dhaval feedback:
* whitelist -> blacklist
* add cgroup_free_cgroup

CHANGELOG v3
* white/blacklist is cached
* incorporate jsafraneks feedback

CHANGELOG v2
* add whitelist which describe the set of variables which can be dealt by
cgsnapshot without any problem (the values which with which have cgsnapshot
the problems are there with TODO comment and the reason) without -s option
the skipped variables are output with the warning text
* add the possibility to set the whitelist file
* add the possibility to redirect the output

CHANGELOG v1
* more verbose comments
* tune the variable names/description/usage in display_controller_data
function
* remove unnecessary .stat exception

    SYNOPSIS:
cgsnapshot [-h] [-s] [-t] [-b file] [-w file] [-f output_file] [controller] [...]
Generate the configuration file from the given controllers of control groups
  -b,--blacklist file  Set the blacklist configuration file (default /etc/cgsnapshot_blacklist.conf)
  -f,--file            Redirect the output to output_file
  -h,--help            Display this help
  -s,--silent          Ignore all warnings
  -t,--strict          Don't show the variables which are not on the whitelist
  -w,--whitelist file  Set the whitelist configuration file (don't used by default)

    EXAMPLE:
    $ /home/varekova/bg/libcgroup/20100719/libcg/src/tools/cgsnapshot -n
    # Configuration file generated by cgsnapshot
    mount {
         cpuset = /cgroup/cpuset;
         cpu = /cgroup/devices;
         cpuacct = /cgroup/memoryd;
         memory = /cgroup/memory;
         devices = /cgroup/devices;
         freezer = /cgroup/freezer;
         net_cls = /cgroup/net_cls;
    }

    group daemons {
        perm {
                admin {
                        uid = root;
                        gid = root;
                }
                task {
                        uid = root;
                        gid = root;
                }
        }
        cpuset {
                cpuset.memory_spread_slab="0";
                cpuset.memory_spread_page="0";
                cpuset.memory_migrate="0";
                cpuset.sched_relax_domain_level="-1";
                cpuset.sched_load_balance="1";
                cpuset.mem_hardwall="0";
                cpuset.mem_exclusive="0";
                cpuset.cpu_exclusive="0";
        }
    }

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
14 years agoIf cgconfigparser fails, it tries to delete created groups. But if they are
Jan Safranek [Tue, 5 Oct 2010 07:51:10 +0000 (13:21 +0530)] 
If cgconfigparser fails, it tries to delete created groups. But if they are
in the config file in wrong order, it tries to remove a parent group before
its children are destroyed, resulting into error.

The roll back should use recursive delete. And in addition, it should
delete as much as possible, not to stop on first error.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Reviewed-By: Ivana Hutarova Varekova <varekova@redhat.com>
Tested-By: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
14 years agoAdd the flag CGROUP_DAEMON_CANCEL_UNCHANGE_PROCESS.
Ken'ichi Ohmichi [Thu, 16 Sep 2010 05:08:59 +0000 (14:08 +0900)] 
Add the flag CGROUP_DAEMON_CANCEL_UNCHANGE_PROCESS.

A new flag CGROUP_DAEMON_CANCEL_UNCHANGE_PROCESS cancels the unchanged process.
If specifying this flag as the argument of cgroup_register_unchanged_process,
a cgrulesengd daemon can move the specified process to right cgroup based on
/etc/cgrules.conf.

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
14 years agoAdd the flag CGROUP_DAEMON_CANCEL_UNCHANGE_PROCESS.
Ken'ichi Ohmichi [Thu, 16 Sep 2010 05:08:59 +0000 (14:08 +0900)] 
Add the flag CGROUP_DAEMON_CANCEL_UNCHANGE_PROCESS.

Hi,

A new flag CGROUP_DAEMON_CANCEL_UNCHANGE_PROCESS cancels the unchanged process.
If specifying this flag as the argument of cgroup_register_unchanged_process,
a cgrulesengd daemon can move the specified process to right cgroup based on
/etc/cgrules.conf.

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
14 years agoThere is a problem in cgroup_init function
Ivana Hutarova Varekova [Fri, 24 Sep 2010 05:38:12 +0000 (11:08 +0530)] 
There is a problem in cgroup_init function
   Now if the function strtok_r get at first the controller which
precedes some other controllers on the mount-point option list,
then it removes all next controllers from the list and they are omitted.
   The test which is done by strtok_r is redundant (there is already
hasmntopt test), so the patch is removing it at all.

 E.G. use commands:

$ mount -t cgroup -o cpu,memory,net_cls lab1 /cgroup/lab1
$ mount -t cgroup -o remount,cpuset,cpu,memory,net_cls lab1 /cgroup/lab1
$ lssubsys -ma

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
14 years agofix two warning problems in programs in tests section
Ivana Hutarova Varekova [Mon, 6 Sep 2010 13:15:31 +0000 (15:15 +0200)] 
fix two warning problems in programs in tests section

This patch fixes these two warnings:

setuid.c: In function ‘main’:
setuid.c:38: warning: ‘ret’ may be used uninitialized in this function

get_procs.c: In function ‘main’:
get_procs.c:15: warning: unused variable ‘test’

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoadd the long options to cgget
Ivana Hutarova Varekova [Thu, 2 Sep 2010 10:17:41 +0000 (12:17 +0200)] 
add the long options to cgget

This patch adds the long options parsing to cgget
to be consistent with the other tools

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agouse the new iterators in cgget tool
Ivana Hutarova Varekova [Thu, 2 Sep 2010 13:57:17 +0000 (15:57 +0200)] 
use the new iterators in cgget tool

changelog
 incorporate Jan's feedback
 - test the return value of cgroup_read_value_next
 - output \t character only after the whole row of the output

This patch rework cgget to use cgroup_read_vars_{begin/next/end}
iterators - it fix the problem with long variables (like e.g. devices.list)
it also fixes the bug in stat file reading (it shows the variables in root
directory all time)

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agosmall cgget tool cleanup
Ivana Hutarova Varekova [Thu, 2 Sep 2010 13:26:18 +0000 (15:26 +0200)] 
small cgget tool cleanup

changelog
- adds missing if

small cgget tool cleanup

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoadd test for empty controller/variable stack
Ivana Hutarova Varekova [Thu, 2 Sep 2010 10:17:21 +0000 (12:17 +0200)] 
add test for empty controller/variable stack

add test for empty controller/variable stack

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agonew iterator api for reading variables
Ivana Hutarova Varekova [Thu, 2 Sep 2010 10:17:14 +0000 (12:17 +0200)] 
new iterator api for reading variables

This patch adds three iterators api function
cgroup_read_vars_begin
cgroup_read_vars_next
cgroup_read_vars_end

 They read the values of the given variable for the specified
 controller and control group. The string with the maximal
 length max is returned line is returned per
 cgroup_read_stats_begin() and cgroup_read_stats_next() call.

(there already are _stat_ versions of function which can read only stat
variables)

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoAdd missing test to cgroup_read_stats_end
Ivana Hutarova Varekova [Tue, 7 Sep 2010 18:06:54 +0000 (23:36 +0530)] 
Add missing test to cgroup_read_stats_end

This patch adds the missing test to cgroup_read_stats_end
Sorry for the misstake.
Fixed the test - it should return the error

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
14 years agoRewrite cg_mkdir_p so it does not change current working directory.
Jan Safranek [Tue, 7 Sep 2010 18:04:52 +0000 (23:34 +0530)] 
Rewrite cg_mkdir_p so it does not change current working directory.

Old sequence of operations when creating e.g. /cgroup/cpu
$OLDCWD=$PWD
cd /
mkdir cgroup
cd cgroup
mkdir cpu
cd $OLDCWD

New sequence is:
mkdir /cgroup
mkdir /cgroup/cpu

Some tools, namely those used in /etc/init.d/cgconfig, might be executed with
security constrained context, which does not allow them to access certain
directories (like /var/log/audit). And when e.g. cgconfigparser is executed in
/var/log/audit as current working directory, chdir("/var/log/audit") in
cg_mkdir_p() fails. As consequence, "/etc/init.d/cgconfig start" randomly fails
or succeeds, depending on current working directory and current SELinux policy.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
14 years agoIt might be useful to allow empty values in cgconfig.conf, like:
Jan Safranek [Tue, 7 Sep 2010 15:02:56 +0000 (20:32 +0530)] 
It might be useful to allow empty values in cgconfig.conf, like:

devices {
devices.deny = "";
}

I know, it sounds weird, but Ivana is preparing cgsnapshot tool, which
saves current cgroups into a cgconfig.conf file, and empty values might
occur there.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
14 years agoChange the return value to more informative one
Ivana Hutarova Varekova [Wed, 18 Aug 2010 09:22:54 +0000 (11:22 +0200)] 
Change the return value to more informative one

Change the return value to more informative one
 the previous error message:
# /sbin/cgconfigparser -l /tmp/cgconfig.conf
can't create group "CBSFxx/Zcz6": Loading configuration file /etc/cgconfig.conf failed
Cgroup values are not equal

 the new error message
#/sbin/cgconfigparser -l /etc/cgconfig.conf
can't create group "CBSFxx/Zcz6": Loading configuration file /etc/cgconfig.conf failed
Value setting does not succeed

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoFix build breakage with --enable-debug after dict changes
Balbir Singh [Mon, 30 Aug 2010 08:00:02 +0000 (13:30 +0530)] 
Fix build breakage with --enable-debug after dict changes

The dictionary changes broke the build with --enable-debug.
Fixing all breakage under this commit. See diff for details

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
14 years agoFix build with --enable-debug
Eric Brower [Mon, 30 Aug 2010 07:54:54 +0000 (13:24 +0530)] 
Fix build with --enable-debug

cgroup_dbg(%s) is broken in src/lex.l. This patch fixes
it to use fprintf(stderr, ...)

Signed-off-by: Eric Brower <ebrower@gmail.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
14 years agoadds option -i description to lssubsys man page
Ivana Hutarova Varekova [Fri, 13 Aug 2010 13:01:18 +0000 (15:01 +0200)] 
adds option -i description to lssubsys man page

Changelog:
- fixed the typos from Eric Brower comment

This patch adds  -i option description to lssubsys man-page
(example included too)

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoAdds option to lssubsys tool for unmount controllers in hierrachy
Ivana Hutarova Varekova [Fri, 13 Aug 2010 13:00:54 +0000 (15:00 +0200)] 
Adds option to lssubsys tool for unmount controllers in hierrachy

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 <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoupdates lssubsys man page
Ivana Hutarova Varekova [Fri, 13 Aug 2010 13:00:39 +0000 (15:00 +0200)] 
updates lssubsys man page

Changelog from previous version
- fixed jsafranek's comments

this fix updatest the man page
- the information about -a option behavior
- added a example related to this change

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoMerge branch 'master' of ssh://libcg.git.sourceforge.net/gitroot/libcg/libcg
Jan Safranek [Thu, 19 Aug 2010 10:27:29 +0000 (12:27 +0200)] 
Merge branch 'master' of ssh://libcg.git.sourceforge.net/gitroot/libcg/libcg

15 years agoSome parameters (like devices.allow) shall include a space in their values.
Jan Safranek [Tue, 10 Aug 2010 09:38:14 +0000 (15:08 +0530)] 
Some parameters (like devices.allow) shall include a space in their values.
This patch adds possibility to specify parameters names in double quotes,
like:
devices {
devices.allow="c 1:3 mr";
}

The double quotes are not mandatory, old  behavior is still there.

As side effect, also parameter names, group names, user names, controller names
etc. can be (optionally) in double quotes and can contain weird characters
- it's a feature, not a bug :). Of course, I could change the grammar to allow
double quotes only in param. values, that shouldn't be a problem.

There is also no advance handling of escape sequences - \", \n, \t does not work
here. That means that parameter values cannot contain newline or double quote
characters - are they required by any controllers?

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
15 years agoCurrent implementation of cgconfig.conf parser stores parameter values in
Jan Safranek [Tue, 10 Aug 2010 09:38:14 +0000 (15:08 +0530)] 
Current implementation of cgconfig.conf parser stores parameter values in
ugly string (name-value pairs separated by ':', name and value themselves
separated by ' '), which does not allow users to have ' ' and ':' in
parameter values. Both are desired for devices.allow and devices.deny.

Let's rewrite the parser to store the parsed name-value pairs in a
dictionary, without any limitation on characters allowed in names and
values.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
15 years agoChangelog:
Jan Safranek [Tue, 10 Aug 2010 09:36:18 +0000 (15:06 +0530)] 
Changelog:
 - update comments:
  - emphasize that 'dictionary' is not hash
  - emphasize that order is important
  - better describe what CG_DICT_DONT_FREE_ITEMS frees

For subsequent patch (update cgconfig parser to accept quoted-strings as
parameter values), I need a simple storage of name-value pairs, so let's
create simple linked-list framework. It's internal only, these functions
should probably never get public,

It is indeed very simple, it can only add items to the end and iterate
through the items, while preserving their order. It does *not* provide
random access to its items and it is *not* based on hash structure (at least for
now).

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
15 years agoadd the return value check in lssubsys II
Ivana Hutarova Varekova [Tue, 10 Aug 2010 07:59:00 +0000 (13:29 +0530)] 
add the return value check in lssubsys II

This patch add one return value check for lssubsys

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
15 years agoadd the return value check in lssubsys I
Ivana Hutarova Varekova [Tue, 10 Aug 2010 07:58:41 +0000 (13:28 +0530)] 
add the return value check in lssubsys I

This patch add one return value check for lssubsys

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
15 years agolssubsys patch - adds omit controllers
Ivana Hutarova Varekova [Tue, 10 Aug 2010 07:58:13 +0000 (13:28 +0530)] 
lssubsys patch - adds omit controllers

Changes from previous version:
* put the return value check to separate subpackages
* change the test (info.hierarchy == hierarchy) to
 (info.hierarchy != hierarchy) to decrease the nesting depth
* use memset

This patch fixes lssubsys output - it fixes two problems:
1/ if there was subsystem attached to not-mounted hierarchy then
lssubsys -a
does not show this subsystems
EXAMPLE:

BROKEN:
$ ./lssubsys -am
cpuset
cpuacct /cgroup/memoryd
memory /cgroup/memory
freezer
net_cls /cgroup/net_cls

FIXED:
$ ./lssubsys -am
cpuset
ns <- controller is in hierarchy but it is not mounted
cpu,devices <- controller is in hierarchy but it is not mounted
cpuacct /cgroup/memoryd
memory /cgroup/memory
freezer
net_cls /cgroup/net_cls

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
15 years agoadd the return value check in lssubsys II
Ivana Hutarova Varekova [Wed, 28 Jul 2010 12:11:53 +0000 (14:11 +0200)] 
add the return value check in lssubsys II

This patch add one return value check for lssubsys

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
15 years agoadd the return value check in lssubsys I
Ivana Hutarova Varekova [Wed, 28 Jul 2010 12:11:45 +0000 (14:11 +0200)] 
add the return value check in lssubsys I

This patch add one return value check for lssubsys

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
15 years agolssubsys patch - adds omit controllers
Ivana Hutarova Varekova [Wed, 28 Jul 2010 12:11:33 +0000 (14:11 +0200)] 
lssubsys patch - adds omit controllers

Changes from previous version:
* put the return value check to separate subpackages
* change the test (info.hierarchy == hierarchy) to
 (info.hierarchy != hierarchy) to decrease the nesting depth
* use memset

This patch fixes lssubsys output - it fixes two problems:
1/ if there was subsystem attached to not-mounted hierarchy then
lssubsys -a
does not show this subsystems
EXAMPLE:

BROKEN:
$ ./lssubsys -am
cpuset
cpuacct /cgroup/memoryd
memory /cgroup/memory
freezer
net_cls /cgroup/net_cls

FIXED:
$ ./lssubsys -am
cpuset
ns <- controller is in hierarchy but it is not mounted
cpu,devices <- controller is in hierarchy but it is not mounted
cpuacct /cgroup/memoryd
memory /cgroup/memory
freezer
net_cls /cgroup/net_cls

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
15 years agoFix initscript exit codes.
Jan Safranek [Mon, 2 Aug 2010 14:30:45 +0000 (16:30 +0200)] 
Fix initscript exit codes.

Fix initscript exit codes
 - propagate errors from functions to final exit status
 - use exit status '1' for generic errors
 - return status '2' when the service is called with unknown arguments

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
15 years agolibcgroup: Test case for get_procs
Dhaval Giani [Tue, 27 Jul 2010 11:55:55 +0000 (13:55 +0200)] 
libcgroup: Test case for get_procs

Test for the get_procs API.

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcgroup: Get the list of procs
Dhaval Giani [Tue, 27 Jul 2010 11:51:36 +0000 (13:51 +0200)] 
libcgroup: Get the list of procs

This patch adds a new API to get a list of procs. This is
guaranteed to be sorted.

TODO:
1. Ensure only unique values make it through

[balbir@linux.vnet.ibm.com: Add a missing EOF check]
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
15 years agoUpdate documentation with the new return values
Eric Brower [Tue, 27 Jul 2010 05:49:37 +0000 (22:49 -0700)] 
Update documentation with the new return values

Header file documentation changes; cgroup_create_cgroup() and
cgroup_create_cgroup_from_parent() return ECGROUPNOTEQUAL when create
is successful, but not all controller parameters are successfully
copied.

Signed-off-by: Eric Brower <ebrower@gmail.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agocheck for unconfigured cgroup in cgroup_find_parent
Eric Brower [Tue, 27 Jul 2010 05:51:23 +0000 (22:51 -0700)] 
check for unconfigured cgroup in cgroup_find_parent

Check for cgroup without controllers to prevent segfault, as the
current implementation depends upon a controller being configured.

Signed-off-by: Eric Brower <ebrower@gmail.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agosplit on-disk cgroup validation from parent name generation
Eric Brower [Tue, 27 Jul 2010 05:50:40 +0000 (22:50 -0700)] 
split on-disk cgroup validation from parent name generation

Split cgroup_find_parent cgroup/parent on-disk validation from cgroup parent
name generation.  This solves a chicken-and-egg problem for callers that need
to obtain a parent name from a cgroup that has not yet been created, such as
cgroup_create_cgroup_from_parent().  The new function enforces the documented
behavior (return NULL) when a "root" cgroup is specified.

Modify cgroup_create_cgroup_from_parent() to use this new function, and clean up
a few possibly-erroneous return values.

Signed-off-by: Eric Brower <ebrower@gmail.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoReturn ECGROUPNOTEQUAL to indicate partial create success
Eric Brower [Tue, 27 Jul 2010 05:49:16 +0000 (22:49 -0700)] 
Return ECGROUPNOTEQUAL to indicate partial create success

Return ECGROUPNOTEQUAL when copying controller parameters fails--
this allows callers to differentiate between cgroup creation failures and
controller configuration failures, and makes explicit that this function
can return an error code but still have created the cgroup.  Callers,
such as cgroup_create_cgroup_from_parent(), can now explicitly ignore
(the unfortunately expected) controller configuration errors.

Signed-off-by: Eric Brower <ebrower@gmail.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoInit scripts patch
Ivana Hutarova Varekova [Wed, 14 Jul 2010 12:30:48 +0000 (14:30 +0200)] 
Init scripts patch

This patch fixes the return values to meet the standarts.

changed values are:
cgconfig:
 * start  action: 6: program is not configured
 * status action: 3: program is not running

cgred:
 * start  action: 7: program is not running
 * start  action: 6: program is not configured
 * status action: 3: program is not running
 * status action: 2: program is dead and /var/run pid file exists
 * stop   action: 0: if the service is not running

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoFix overlaping src and dest buffers in sprintf()
Jan Safranek [Mon, 7 Jun 2010 09:58:46 +0000 (11:58 +0200)] 
Fix overlaping src and dest buffers in sprintf()

libcgroup compiled with various optimization flags produce strange results
when sprintf's destination and source pointers overlap or are the same.

In addition, use strncpy() instead. This is more or less useless, because
cg_build_path() does not check sizes either, but just for my personal feeling
of correct C code...

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoCheck return value of cgroup_read_stats_begin
Jan Safranek [Mon, 7 Jun 2010 09:58:37 +0000 (11:58 +0200)] 
Check return value of cgroup_read_stats_begin

Check return value of cgroup_read_stats_begin.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoFix memory leak in cgroup_read_stats iterator
Jan Safranek [Mon, 7 Jun 2010 09:58:19 +0000 (11:58 +0200)] 
Fix memory leak in cgroup_read_stats iterator

getline(&line, ...) can return -1 *and* allocate memory for returned (empty)
line - so be sure to free it.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoFix return code of cgroup_read_stats_XXX iterator
Jan Safranek [Mon, 7 Jun 2010 09:58:28 +0000 (11:58 +0200)] 
Fix return code of cgroup_read_stats_XXX iterator

Fix return code of cgroup_read_stats_XXX iterator.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agov0.36.2 v0.36.2
Dhaval Giani [Mon, 21 Jun 2010 10:26:32 +0000 (12:26 +0200)] 
v0.36.2

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoFix a bug in lscgroup which prevent it from reading cgroups from
Balbir Singh [Thu, 17 Jun 2010 14:04:21 +0000 (19:34 +0530)] 
Fix a bug in lscgroup which prevent it from reading cgroups from
output.

Signed-off-by: Ivana Hutarova Varekova<varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
15 years agoMerge branch 'master' of ssh://libcg.git.sf.net/gitroot/libcg/libcg
Balbir Singh [Mon, 7 Jun 2010 10:35:42 +0000 (16:05 +0530)] 
Merge branch 'master' of ssh://libcg.git.sf.net/gitroot/libcg/libcg

15 years agov0.36.2.rc
Dhaval Giani [Fri, 4 Jun 2010 11:42:29 +0000 (13:42 +0200)] 
v0.36.2.rc

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcgroup: open files with O_CLOEXEC
Dhaval Giani [Fri, 4 Jun 2010 11:30:59 +0000 (13:30 +0200)] 
libcgroup: open files with O_CLOEXEC

We don't want file handles to remain open across execs.
Therefore open files with the O_CLOEXEC flag which closes
the files on exec.

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcgroup: Do not call exit from within the main library
Dhaval Giani [Fri, 4 Jun 2010 11:30:58 +0000 (13:30 +0200)] 
libcgroup: Do not call exit from within the main library

The autogenerated code fromt the lexer was calling exit on a
fatal error. Do not do that. Instead log the message.

While it is still not clear if this is the correct response
for YY_FATAL_ERROR, we need to gracefully handle errors, and
since this is a path which is very rarely hit, this is still
a low risk change and so we will merge it.

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoAdd configure option to set destination directory of pam module.
Jan Safranek [Mon, 31 May 2010 15:15:22 +0000 (17:15 +0200)] 
Add configure option to set destination directory of pam module.

Add configure option to set destination directory of pam module. The module
can be used right after 'make install', no moving of libraries is required.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoMake the installation of init scripts optional
Jan Safranek [Mon, 31 May 2010 15:15:15 +0000 (17:15 +0200)] 
Make the installation of init scripts optional

Some distros do not like 'make install' to install also initscripts. So
let's make it configurable with --enable-initscripts-install.

The default behavior is not to install them - they probably work only on
Fedora.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoRework the way how the libraries are installed.
Jan Safranek [Mon, 31 May 2010 15:15:08 +0000 (17:15 +0200)] 
Rework the way how the libraries are installed.

As pointed out by Kay Sievers on IRC, the pkgconfig file should point to
/usr/lib, where libcgroup.so symlink is located, not to /lib, where is the
real library libcgroup.so.1.0.36.

Therefore it's better to install libraries to /usr/lib, which generated
the right libcgroup.pc and then move all necessary libs to /lib.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcgroup: Return correct values in parse.y
Dhaval Giani [Tue, 1 Jun 2010 15:36:38 +0000 (17:36 +0200)] 
libcgroup: Return correct values in parse.y

Instead of returning a valid error on failure in parse.y, we
were returning 0. Fix that up.

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoreplace /etc with $(sysconfdir) to pass 'make distcheck'
Kay Sievers [Mon, 31 May 2010 22:07:28 +0000 (00:07 +0200)] 
replace /etc with $(sysconfdir) to pass 'make distcheck'

Distcheck checks for correct use of DESTDIR and prefix. We need to
include a path that contains prefix instead of plain /etc.

Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Dhaval Giani <dhaval@gondor.retis>
15 years agoadd generated file to CLEANFILES
Kay Sievers [Mon, 31 May 2010 15:21:32 +0000 (17:21 +0200)] 
add generated file to CLEANFILES

Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Dhaval Giani <dhaval@gondor.retis>
15 years agosrcdir -> builddir to fix 'make distcheck'
Kay Sievers [Mon, 31 May 2010 15:08:38 +0000 (17:08 +0200)] 
srcdir -> builddir to fix 'make distcheck'

Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Dhaval Giani <dhaval@gondor.retis>
15 years agodepend on parse.h to allow 'make -j'
Kay Sievers [Mon, 31 May 2010 14:53:53 +0000 (16:53 +0200)] 
depend on parse.h to allow 'make -j'

Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Dhaval Giani <dhaval@gondor.retis>
15 years agoAdd several man-pages to their Makefile
Ivana Hutarova Varekova [Wed, 26 May 2010 09:30:49 +0000 (11:30 +0200)] 
Add several man-pages to their Makefile

This patch adds several man-pages which already are in git to
Makefile.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@gondor.retis>
15 years agov0.36.1 v0.36.1
Dhaval Giani [Fri, 21 May 2010 12:31:01 +0000 (14:31 +0200)] 
v0.36.1

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agov0.36.1.rc1
Dhaval Giani [Tue, 18 May 2010 13:30:42 +0000 (15:30 +0200)] 
v0.36.1.rc1

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcg trivial compile errors/warnings
Kay Sievers [Tue, 18 May 2010 05:23:17 +0000 (07:23 +0200)] 
libcg trivial compile errors/warnings

libcgroup: Fix a few cosmetic issues and missing include

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoMerge branch 'master' of ssh://libcg.git.sf.net/gitroot/libcg/libcg
Balbir Singh [Tue, 18 May 2010 13:23:04 +0000 (18:53 +0530)] 
Merge branch 'master' of ssh://libcg.git.sf.net/gitroot/libcg/libcg

15 years agolibcgroup tests: Fix build issue with the named hierarchy test case
Dhaval Giani [Mon, 17 May 2010 22:30:12 +0000 (00:30 +0200)] 
libcgroup tests: Fix build issue with the named hierarchy test case

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agov0.36 v0.36
Dhaval Giani [Mon, 17 May 2010 21:53:33 +0000 (23:53 +0200)] 
v0.36

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcgroup: Test the modified cgroup_init
Dhaval Giani [Mon, 17 May 2010 16:54:49 +0000 (18:54 +0200)] 
libcgroup: Test the modified cgroup_init

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcgroup: Add support for named hierarchies.
Dhaval Giani [Mon, 17 May 2010 16:54:48 +0000 (18:54 +0200)] 
libcgroup: Add support for named hierarchies.

This feature has been available in the kernel for sometime, but was missed by
libcgroup.

Add support for named hierarchies. The controller is identified as
name=<name> and used in such fashion.

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcgroup: Introduce cgroup_basename and modify the functions to use it.
Dhaval Giani [Mon, 17 May 2010 16:15:59 +0000 (18:15 +0200)] 
libcgroup: Introduce cgroup_basename and modify the functions to use it.

basename() is not safe as it modifies the pointers from time to time.

In order to prevent it, write a safe version of basename which uses basename
internally.

As a side effect, it also clears up the following warning,

api.c: In function ‘cgroup_find_matching_rule’:
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’
api.c:2201: warning: passing argument 1 of ‘__xpg_basename’ discards qualifiers from pointer target type
/usr/include/libgen.h:35: note: expected ‘char *’ but argument is of type ‘const char *’

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcgroup: Fix warnings warning about comparisions between signed and unsigned integers
Dhaval Giani [Mon, 17 May 2010 16:15:58 +0000 (18:15 +0200)] 
libcgroup: Fix warnings warning about comparisions between signed and unsigned integers

Fix warnings such as

api.c:539: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
api.c:539: warning: signed and unsigned type in conditional expression [-Wsign-compare]

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcgroup: Fix warnings warning of shadowed declaration
Dhaval Giani [Mon, 17 May 2010 16:15:57 +0000 (18:15 +0200)] 
libcgroup: Fix warnings warning of shadowed declaration

Fixes warnings such as

api.c:2764: warning: declaration of ‘stat’ shadows a global declaration [-Wshadow]
/usr/include/sys/stat.h:453: warning: shadowed declaration is here [-Wshadow]

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcgroup: Fix warnings warning about mixed declarations
Dhaval Giani [Mon, 17 May 2010 16:15:56 +0000 (18:15 +0200)] 
libcgroup: Fix warnings warning about mixed declarations

Fix warnings like

api.c: In function ‘cgroup_walk_tree_begin’:
api.c:2647: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcgroup: cast CGRULE macros to uid_t
Dhaval Giani [Mon, 17 May 2010 16:15:55 +0000 (18:15 +0200)] 
libcgroup: cast CGRULE macros to uid_t

Clears up a few warnings.

api.c:2366: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
api.c:2368: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
api.c:2373: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
api.c:2375: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agolibcgroup: Compress the large_cgconfig.conf file
Dhaval Giani [Thu, 6 May 2010 15:47:57 +0000 (17:47 +0200)] 
libcgroup: Compress the large_cgconfig.conf file

The large_cgconfig.conf file is 276kb in size. Compress it
so that it takes lesser space.

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoAllow cgroup_config_table to be dynamically handled
Balbir Singh [Fri, 30 Apr 2010 17:23:18 +0000 (22:53 +0530)] 
Allow cgroup_config_table to be dynamically handled

Allow cgconfigparser to create groups > MAX_GROUPS

From: Balbir Singh <balbir@linux.vnet.ibm.com>

Rafael Tinoco <rafael.tinoco@locaweb.com.br> noticed that the maximum
number of cgroups created using cgconfigparser fell short of 2000. Balbir
found a limitation in the code, that limited this number to a predefined
maximum. This patch fixes the limitation, although not in the most
optimized way, since we want to avoid double parsing of the configuraiton
file.

This patch realloc's the data structure that holds parsed cgroups.

Tested via setting MAX_CGROUPS=1 and loading a configuration file with
2 groups defined. Also tested with a large cgroup file

Test results after loading large_cgconfig.conf (generated using a
script). The size is large, but I wanted to send out the test case
since it adds to our regression bucket.

#subsys_name    hierarchy       num_cgroups     enabled
cpuset  0       1       1
ns      0       1       1
cpu     1       2021    1
cpuacct 1       2021    1
memory  2       2021    1
devices 0       1       1
freezer 0       1       1
net_cls 0       1       1

NOTE: Be careful, such a large number of groups could slow
down your system. This needs further investigation at the cgroups
layer in the kernel.

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agomanpages: Fix whitespace in cgred.conf manpage
Dhaval Giani [Thu, 6 May 2010 12:46:12 +0000 (14:46 +0200)] 
manpages: Fix whitespace in cgred.conf manpage

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
15 years agoSeveral man-page fixes
Ivana Hutarova Varekova [Thu, 6 May 2010 12:44:48 +0000 (14:44 +0200)] 
Several man-page fixes

This patch fixes several man pages (typos, syntax problems)

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>