]> git.ipfire.org Git - thirdparty/libcgroup.git/log
thirdparty/libcgroup.git
13 years agolibcgroup: ignore 'tasks' file when changing permission of control files
Jan Safranek [Tue, 27 Sep 2011 06:50:09 +0000 (08:50 +0200)] 
libcgroup: ignore 'tasks' file when changing permission of control files

When cgroup_create_cgroup() is called with different control_fperm and
task_fperm, libcgroup first changes permissions of *all* files to match
the control_fperm, which includes the also the tasks file and it might
loose some permission bits. The tasks file is then modulated by
control_fperm, but because umask-style of control_fperm, it might get
lower permissions that users would expect.

Therefore 'tasks' file must be skipped when using control_fperm.

Changelog since v1:
  - use list of ignored files, cg_chmod_recursive_controller is called from
    cg_chmod_recursive, which should chmod all files, incl. 'tasks'.

Changelog since v2:
  - renamed the list with ignored files.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
13 years agolibcgroup: fixed chmod cg_chmod_recursive_controller
Jan Safranek [Tue, 27 Sep 2011 06:50:09 +0000 (08:50 +0200)] 
libcgroup: fixed chmod cg_chmod_recursive_controller

fts_read can return NULL in two cases. Either when we have visited all
files in the hierarchy (when errno is set to 0) or when an error
occured. We shouldn't set an error code in the first case obviously.

Changelog since v1:
 - updated log message

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
13 years agocgrulesengd: Fixed processing of symlinked executables.
Jan Safranek [Mon, 22 Aug 2011 08:48:58 +0000 (10:48 +0200)] 
cgrulesengd: Fixed processing of symlinked executables.

when an executable is symlinked and the symlink is executed,
/proc/PID/status contains name of the symlink, while /proc/PID/exe points
to the real executable name. cgrulesengd considered this case as error and
did not trigger any rule for this exec().

With this patch, cgrulesengd uses name of /proc/PID/exe as the executable
in this case.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Remove unreachable code
Jan Safranek [Wed, 24 Aug 2011 09:46:35 +0000 (11:46 +0200)] 
libcgroup: Remove unreachable code

The loop is broken in both if branches above, so it could never reach this
line -> remove it.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Fixed dereferencing of uninitialized variable when modifying a group
Jan Safranek [Wed, 24 Aug 2011 09:46:20 +0000 (11:46 +0200)] 
libcgroup: Fixed dereferencing of uninitialized variable when modifying a group

When group->index == 0, uninitialized variable path might get freed. Path is
always freed in the loop, so it is useless to free it before return.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgclear: Simplified error handling when unmounting controllers
Jan Safranek [Wed, 24 Aug 2011 09:46:08 +0000 (11:46 +0200)] 
cgclear: Simplified error handling when unmounting controllers

Reworked the error handling in cgroup_unload_cgroups.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Added checks for NULL when creating an internal dictionary
Jan Safranek [Wed, 24 Aug 2011 09:41:41 +0000 (11:41 +0200)] 
libcgroup: Added checks for NULL when creating an internal dictionary

Added one check for null when creating an internal dictionary
and fixed checking of calloc result.

Changelog:
  - rephrased the commit message

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agotests: Fixed memory leak in test_functions
Jan Safranek [Wed, 24 Aug 2011 09:41:34 +0000 (11:41 +0200)] 
tests: Fixed memory leak in test_functions

Free the cgroup on error.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agolssubsys: Fixed file descriptor leak on error enumerating controllers.
Jan Safranek [Wed, 24 Aug 2011 09:41:26 +0000 (11:41 +0200)] 
lssubsys: Fixed file descriptor leak on error enumerating controllers.

Close the iterator when cgroup_get_all_controller_next fails. I've
rewritten the loop to have one error check for both
cgroup_get_all_controller_begin and cgroup_get_all_controller_end.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Rework walk_tree iterator to release all resources on error.
Jan Safranek [Wed, 24 Aug 2011 09:41:19 +0000 (11:41 +0200)] 
libcgroup: Rework walk_tree iterator to release all resources on error.

cgroup_walk_tree_begin() can end up with error and in some code paths
'*handle' is not set and in some it is.

The function should free all resources on error + return *handle = NULL

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agocgsnapshot: Fixed file descriptor leak when enumerating controllers
Jan Safranek [Wed, 24 Aug 2011 09:41:11 +0000 (11:41 +0200)] 
cgsnapshot: Fixed file descriptor leak when enumerating controllers

Close the iterators on error. In addition, handling when FL_SILENT flag is
on/off should be the same, except the error output.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agocgsnapshot: Fixed file descriptor leak when getting out of memory
Jan Safranek [Wed, 24 Aug 2011 09:41:04 +0000 (11:41 +0200)] 
cgsnapshot: Fixed file descriptor leak when getting out of memory

Close the iterator when cgroup_new_cgroup fails.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agocgconfigparser: Fixed memory leak when parsing invalid cgconfig.conf
Jan Safranek [Wed, 24 Aug 2011 09:40:57 +0000 (11:40 +0200)] 
cgconfigparser: Fixed memory leak when parsing invalid cgconfig.conf

Free the dictionary when cgroup_dictionary_add fails.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Fixed memory and file descriptor leak when enumerating processes
Jan Safranek [Wed, 24 Aug 2011 09:40:50 +0000 (11:40 +0200)] 
libcgroup: Fixed memory and file descriptor leak when enumerating processes

Free the resources when fopen or realloc fails.
Also remove completelly useless code.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agolibcgroup: Fixed leaked file descriptor when enumerating controllers
Jan Safranek [Wed, 24 Aug 2011 09:40:42 +0000 (11:40 +0200)] 
libcgroup: Fixed leaked file descriptor when enumerating controllers

Close the file when fgets fails.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agolibcgroup: Fixed a memory leak during cgrules.conf parsing
Jan Safranek [Wed, 24 Aug 2011 09:40:35 +0000 (11:40 +0200)] 
libcgroup: Fixed a memory leak during cgrules.conf parsing

Free the newrule on strdup error.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agotests: Check getpwnam() return value
Jan Safranek [Wed, 24 Aug 2011 09:40:28 +0000 (11:40 +0200)] 
tests: Check getpwnam() return value

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agocgrulesengd: Fixed closing of daemon sockets on error
Jan Safranek [Wed, 24 Aug 2011 09:40:21 +0000 (11:40 +0200)] 
cgrulesengd: Fixed closing of daemon sockets on error

When socket() fails, it returns -1 instead of file descriptor and we might pass
this -1 to close() in close_and_exit label -> unexpected result.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agocgconfigparser: Made YY_FATAL_ERROR really fatal when parsing cgconfig.conf
Jan Safranek [Wed, 24 Aug 2011 09:40:13 +0000 (11:40 +0200)] 
cgconfigparser: Made YY_FATAL_ERROR really fatal when parsing cgconfig.conf

The error macro should stop all processing, otherwise some NULL pointers might
get dereferenced (e.g. lex.c:1323). It uses setjmp/longjmp to return from
depths of the bison/lex routines. As obvious consequence, all memory allocated
in the parsers is lost and is never freed. Still, it should be better than
exit() I proposed before.

Changelog:
  - use setjmp/longjmp instead of exit()

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
13 years agolibcgroup: Fixed potential crash when setting a parameter value
Jan Safranek [Wed, 24 Aug 2011 09:40:05 +0000 (11:40 +0200)] 
libcgroup: Fixed potential crash when setting a parameter value

fclose(NULL) dereferences its argument -> sigsegv.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agotests: Check cgroup_init() results
Jan Safranek [Wed, 24 Aug 2011 09:39:58 +0000 (11:39 +0200)] 
tests: Check cgroup_init() results

As found by coverity scan, cgroup_init result is not checked in some tests.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agolssubsys: remove unused variable
Jan Safranek [Wed, 24 Aug 2011 09:39:51 +0000 (11:39 +0200)] 
lssubsys: remove unused variable

Remove one unused variable and add more descriptive comment.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agocgconfigparser: Fixed checking of getpw/grnam_r return codes
Jan Safranek [Wed, 24 Aug 2011 09:39:44 +0000 (11:39 +0200)] 
cgconfigparser: Fixed checking of getpw/grnam_r return codes

It's enough to check *result != NULL after getpwnam_r/getgrnam_r, the error
variable is completely useless.

Changelog:
  - remove error variable completelly

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agocgsnapshot: fixed exit codes when parsing of mountpoints fails
Jan Safranek [Wed, 24 Aug 2011 09:39:33 +0000 (11:39 +0200)] 
cgsnapshot: fixed exit codes when parsing of mountpoints fails

When parse_mountpoints() fails, the error is not propagated to final
cgsnapshot exit code. Also free black&white lists on error.

Changelog:
  - remove whitespace changes

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agocgsnapshot: fixed return value checks in parse_mountpoints()
Jan Safranek [Wed, 24 Aug 2011 09:39:26 +0000 (11:39 +0200)] 
cgsnapshot: fixed return value checks in parse_mountpoints()

The function should return an error when (and only when) something goes
wrong.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
13 years agotests: Check cgroup_add_controller return value in test_functions
Jan Safranek [Wed, 24 Aug 2011 09:39:19 +0000 (11:39 +0200)] 
tests: Check cgroup_add_controller return value in test_functions

Discovered by gcc 4.6 as "warning: variable ‘controller’ set but not used"

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
14 years agoFixed few findings from Coverity scan
Peter Schiffer [Wed, 13 Jul 2011 12:50:41 +0000 (14:50 +0200)] 
Fixed few findings from Coverity scan

In function cgroup_parse_rules() added missing check for getpwuid() result.
In cgroup_get_procs() added missing fclose() on file descriptor.
In load_list() added missing fclose() on file descriptor.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoPermissions settings documentation
Jan Safranek [Fri, 17 Jun 2011 12:54:02 +0000 (14:54 +0200)] 
Permissions settings documentation

fperm and dperm are not described in the man pages yet. Let's add
missing pieces.

This is updated version of patch originally written by Michal Hocko,
<mhocko@suse.cz>

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoapi: cg_set_control_value strncat fix
Ivana Hutarova Varekova [Thu, 16 Jun 2011 13:08:38 +0000 (15:08 +0200)] 
api: cg_set_control_value strncat fix

cg_set_control_value function contains strncat which uses
sizeof(string) for limitation size which is bogus. This patch fixes it.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoapi: cgroup_walk_tree_begin not freeing entry
Ivana Hutarova Varekova [Thu, 16 Jun 2011 13:08:31 +0000 (15:08 +0200)] 
api: cgroup_walk_tree_begin not freeing entry

in a special situation (entry->fts == NULL)
cgroup_walk_tree_begin does not free the entry structure.
This patch fix it.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgsnapshot: in special cases memory/fd is not freed
Ivana Hutarova Varekova [Thu, 16 Jun 2011 13:08:25 +0000 (15:08 +0200)] 
cgsnapshot: in special cases memory/fd is not freed

this patch adds several missing frees in cgsnapshot tool

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoapi: cg_rd_ctrl_file does not free fd
Ivana Hutarova Varekova [Thu, 16 Jun 2011 13:08:18 +0000 (15:08 +0200)] 
api: cg_rd_ctrl_file does not free fd

cg_rd_ctrl_file does not free a fd in a special situation.
This patch fixes it

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgget: fix final cgget cleanup
Ivana Hutarova Varekova [Thu, 16 Jun 2011 13:08:12 +0000 (15:08 +0200)] 
cgget: fix final cgget cleanup

fix final cgget cleanup

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agochmod_file: Introduce intelligent file permissions setting
Michal Hocko [Wed, 15 Jun 2011 15:24:19 +0000 (17:24 +0200)] 
chmod_file: Introduce intelligent file permissions setting

There is no general rule on which permissions make sense for files in
different subsystems. Nevertheless the kernel creates those files with
the maximum allowed permissions for owner so we should use its part as
an umask for group and others permissions as well.
This means that if we specify 777 for file_mode we will end up having
same permissions as owner what ever they are.

The primary intelligence is implemented in cg_chmod_path function which
takes an argument which says whether user permissions should be used
as a template.

This patch adds and exports cgroup_set_permissions which sets
permissions for control and task files into the cgroup descriptor
and cgroup_create_cgroup does the rest.

Example:
/etc/cgconfig.conf:
mount {
        cpu = /cgroup/cpuctl/;
}

group devel {
        perm {
                task {
                        uid = root;
                        gid = cgroup;
                        fperm = 770;
                }
                admin {
                        uid = root;
                        gid = cgroup;
                        dperm = 775;
                        fperm = 770;
                }
        }
        cpu {
                cpu.shares = 5120;
        }
}

cd /cgroup/cpuctl/devel/
ls -la
drwxrwxr-x 2 root cgroup 0 May 19 16:42 .
drwxr-xr-x 4 root root   0 May 19 16:14 ..
-rw-rw---- 1 root cgroup 0 May 19 16:42 cgroup.clone_children
--w--w---- 1 root cgroup 0 May 19 16:42 cgroup.event_control
-r--r----- 1 root cgroup 0 May 19 16:42 cgroup.procs
-rw-rw---- 1 root cgroup 0 May 19 16:42 cpu.rt_period_us
-rw-rw---- 1 root cgroup 0 May 19 16:42 cpu.rt_runtime_us
-rw-rw---- 1 root cgroup 0 May 19 16:42 cpu.shares
-rw-rw---- 1 root cgroup 0 May 19 16:42 notify_on_release
-rw-rw---- 1 root cgroup 0 May 19 16:42 tasks

Signed-off-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgconfig: enable setting file permissions
Michal Hocko [Wed, 15 Jun 2011 15:23:47 +0000 (17:23 +0200)] 
cgconfig: enable setting file permissions

We cannot setup file or directory permissions in (/etc/cgconfig.conf)
configuration file while we can do this with available tools.
This patch adds new two options fperm, dperm.
Task section supports only fperm, because there are no directories
involved while admin section supports both of them.

Example:
/etc/cgconfig.conf:
mount {
        cpu = /dev/cpuctl;
}
group devel {
        perm {
                task {
                        uid = root;
                        gid = cgroup;
                        fperm = 660;
                }
                admin {
                        uid = root;
                        gid = cgroup;
                        dperm = 775;
                }
        }
        cpu {
                cpu.shares = 5120;
        }
}

$ tools/cgconfigparser -l /etc/cgconfig.conf
$ ls -la /dev/cpuctl/devel/
total 0
drwxrwxr-x 2 root cgroup 0 May 13 15:22 .
drwxr-xr-x 3 root root   0 May 13 15:22 ..
-rw-r--r-- 1 root cgroup 0 May 13 15:22 cgroup.clone_children
--w--w--w- 1 root cgroup 0 May 13 15:22 cgroup.event_control
-r--r--r-- 1 root cgroup 0 May 13 15:22 cgroup.procs
-rw-r--r-- 1 root cgroup 0 May 13 15:22 cpu.rt_period_us
-rw-r--r-- 1 root cgroup 0 May 13 15:22 cpu.rt_runtime_us
-rw-r--r-- 1 root cgroup 0 May 13 15:22 cpu.shares
-rw-r--r-- 1 root cgroup 0 May 13 15:22 notify_on_release
-rw-rw---- 1 root cgroup 0 May 13 15:22 tasks

This patch enhances parser callbacks to initialize cgroup->task_fperm
and cgroup->control_[fd]perm and forces chmod at general
cgroup_create_cgroup level. This is safe because everybody who uses
cgroup has those values initialized to -1 unless they are set and then
they should be used.

Signed-off-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoAdd file and directory permissions into cgroup
Michal Hocko [Wed, 15 Jun 2011 15:23:39 +0000 (17:23 +0200)] 
Add file and directory permissions into cgroup

Let's add file permission for tasks and file and directory permissions
for control files into cgroup so that we can add them into configuration
files.
Permissions are initialized to NO_PERMS (unsigned -1 which doesn't
represent any valid permissions) to reflect that no value is set.  Let's
also add a common initialization functions for both cgroup table and
single cgroup.

Signed-off-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgsnapshot: fix return value checks
Ivana Hutarova Varekova [Tue, 7 Jun 2011 11:19:54 +0000 (13:19 +0200)] 
cgsnapshot: fix return value checks

fix return value checks in load_list functions

Changelog:
* thanks jsafrane free proper list structure properly

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgget: fix return value checks
Ivana Hutarova Varekova [Fri, 3 Jun 2011 08:00:33 +0000 (10:00 +0200)] 
cgget: fix return value checks

fix return value check in cgget (strdup and add_record_to_buffer functions)

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoFixed multimount tests
Jan Safranek [Thu, 12 May 2011 04:58:55 +0000 (06:58 +0200)] 
Fixed multimount tests

lssubsys has some problems with named hierarchies, they don't appear in
cgroup_get_all_controller_begin()/next().

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-By: Ivana Hutarova Varekova <varekova@redhat.com>
14 years agoFix the malloc error codes
Ivana Hutarova Varekova [Thu, 2 Jun 2011 12:29:52 +0000 (14:29 +0200)] 
Fix the malloc error codes

If malloc|calloc|strdup function is not succesfull
then ECGOTHER should be returned (not ECGFAIL)

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocg_build_path: use max FILENAME_MAX characters for array in 2nd parameter
Ivana Hutarova Varekova [Thu, 2 Jun 2011 12:29:45 +0000 (14:29 +0200)] 
cg_build_path: use max FILENAME_MAX characters for array in 2nd parameter

The function cg_build_path is internal now. All calls of it (there is one
exception - cgroup_fill_cgc function which uses FILENAME_MAX+1, fixed now too)
have the limited second parameter buffer to FILENAME_MAX.

cg_build_path copy to this buffer, but thhere was no limitation of the size of coppied buffer.
This is fixed in the patch.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoFixed cg_chmod_recursive
Jan Safranek [Wed, 1 Jun 2011 09:10:51 +0000 (11:10 +0200)] 
Fixed cg_chmod_recursive

The function changes permissions only in the first hierarchy, but it should
change it in all of them.

Reproducer:
1) have cpuacct and freezer mounted separately, i.e.:
$ lssubsys -m
cpuacct /sys/fs/cgroup/cpuacct
freezer /sys/fs/cgroup/freezer

2) create a group with specific permissions:
$ cgcreate -f 700  -g freezer,cpuacct:/test

Result:
$ ls -la /sys/fs/cgroup/freezer/test/
-rwx------. 1 jsafrane jsafrane 0 May 31 09:16 cgroup.clone_children
-rwx------. 1 jsafrane jsafrane 0 May 31 09:16 cgroup.event_control
(-> first controller is fine)

$ ls -la /sys/fs/cgroup/cpuacct/test/
-rw-r--r--. 1 jsafrane jsafrane 0 May 31 09:16 cgroup.clone_children
--w--w--w-. 1 jsafrane jsafrane 0 May 31 09:16 cgroup.event_control
(-> second controller is wrong, it should be -rwx------)

Changelog:
 - v2: fixed return code of cg_chmod_recursive_controller when fts_read fails
 - v3: fixed error code when malloc fails

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-By: Ivana Hutarova Varekova<varekova@redhat.com>
14 years agocgconfig: Do not touch subsystems not mounted by cgconfig
Dhaval Giani [Fri, 27 May 2011 06:36:19 +0000 (08:36 +0200)] 
cgconfig: Do not touch subsystems not mounted by cgconfig

cgconfig: Do not touch subsystems not mounted by cgconfig

In its failure path, cgconfig should only touch the subsystems
it had something to do with. Currently, it unmounts all the
subsystems in the config file. Correct this.

Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-By: Ivana Hutarova Varekova <varekova@redhat.com>
14 years agoUpdated cgconfig service descriptions
Jan Safranek [Fri, 20 May 2011 13:53:05 +0000 (15:53 +0200)] 
Updated cgconfig service descriptions

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoFixed cgconfigparser to allow configs with no 'mount' section
Jan Safranek [Fri, 20 May 2011 13:52:58 +0000 (15:52 +0200)] 
Fixed cgconfigparser to allow configs with no 'mount' section

cgconfig service fails when something else mounts cgroup hierarchies during
boot (e.g. systemd). Therefore we should allow cgconfig.conf to have no
'mount' section -> it's up to admin to ensure that controllers are mounted as
needed.

Because 'group' section is already optional, with this patch cgconfigparser
will accept empty configuration file. This is probably the best default
config for distros with systemd.

Changelog:
  - fixed case with empty config file and no mounted controllers
  - reworked the if conditions to be more clear

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agotests: remove not used and obsolete test pathtest
Ivana Hutarova Varekova [Mon, 23 May 2011 07:06:58 +0000 (09:06 +0200)] 
tests: remove not used and obsolete test pathtest

pathtest(.sh) is ot run in the current makefile and it does not work
properly, so there is no reason to add it there. This path removes
pathtest from git.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgget: unify -h|--help output
Ivana Hutarova Varekova [Fri, 20 May 2011 12:13:51 +0000 (14:13 +0200)] 
cgget: unify -h|--help output

this patch unify -h|--help output.
old version:
$ cgget -h
Usage: cgget [-nv] [-r<name>] [-g<controller>] [-a] <path> ...
   or: cgget [-nv] [-r<name>] -g<controller>:<path> ...

new version:
$ cgget -h
Usage: cgget [-nv] [-r <name>] [-g <controller>] [-a] <path> ...
   or: cgget [-nv] [-r <name>] -g <controller>:<path> ...
Print parameter(s) of given group(s).
  -a, --all Print info about all relevant controllers
  -g <controller> Controller which info should be displaied
  -g <controller>:<path> Control group whih info should be displaied
  -h, --help Display this help
  -n Do not print headers
  -r, --variable <name> Define parameter to display
  -v, --values-only Print only values, not parameter names

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgget(1): fix the manual page to describe -g properly
Ivana Hutarova Varekova [Fri, 20 May 2011 12:13:44 +0000 (14:13 +0200)] 
cgget(1): fix the manual page to describe -g properly

Fix the manual page to reflect the additional usage of -g:
old version:
$ cgget -h
Usage: cgget [-nv] [-r<name>] [-g<controller>] [-a] ...<path> ...

new version:
$ ./cgget -h
Usage: cgget [-nv] [-r<name>] [-g<controller>] [-a] <path> ...
   or: cgget [-nv] [-r<name>] -g<controller>:<path> ...

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgget: add the possibility to use -g <controllers>:<path>
Ivana Hutarova Varekova [Fri, 20 May 2011 12:13:37 +0000 (14:13 +0200)] 
cgget: add the possibility to use -g <controllers>:<path>

Most of the tools use <controllers>:<path> together with -g option,
this patch adds this version of usage of -g  option to cgget tool
Older have the possibility to use  -g in form -g <controller> <path>.

--------------
old version:
$ cgget -h
Usage: cgget [-nv] [-r<name>] [-g<controller>] [-a] ...<path> ...

new version:
$ ./cgget -h
Usage: cgget [-nv] [-r<name>] [-g<controller>] [-a] <path> ...
   or: cgget [-nv] [-r<name>] -g<controller>:<path> ...

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoThis Patch is meant to enhance the wording of the man pages
Philipp Thomas [Mon, 16 May 2011 15:23:28 +0000 (20:53 +0530)] 
This Patch is meant to enhance the wording of the man pages

Signed-off-by: Philipp Thomas <pth@suse.de>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
14 years agolscgroup: more verbose output of -h option
Ivana Hutarova Varekova [Mon, 9 May 2011 08:40:15 +0000 (10:40 +0200)] 
lscgroup: more verbose output of -h option

The patch create more verbose help output of lscgroup command

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agolscgroup: add the possibility to use -g <controllers>:<path>
Ivana Hutarova Varekova [Mon, 9 May 2011 08:40:09 +0000 (10:40 +0200)] 
lscgroup: add the possibility to use -g <controllers>:<path>

Most of the tools use <controllers>:<path> together with -g option
(cgcreate, cgget and cgclassify), this patch adds this option to
lscgroups tool

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgcreate: fix help output
Ivana Hutarova Varekova [Mon, 9 May 2011 08:40:01 +0000 (10:40 +0200)] 
cgcreate: fix help output

fix minor typos in help output

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgcreate.1: sort the options in cgcreate.1
Ivana Hutarova Varekova [Mon, 9 May 2011 08:39:54 +0000 (10:39 +0200)] 
cgcreate.1: sort the options in cgcreate.1

This patch sort the options on cgcreate.1 manual page to alphabethic order

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgdelete: do -h output more verbose
Ivana Hutarova Varekova [Mon, 9 May 2011 08:39:48 +0000 (10:39 +0200)] 
cgdelete: do -h output more verbose

The patch creates more verbose help output

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgdelete: add the possibility to use -g <controllers>:<path>
Ivana Hutarova Varekova [Mon, 9 May 2011 08:39:41 +0000 (10:39 +0200)] 
cgdelete: add the possibility to use -g <controllers>:<path>

Most of the tools use <controllers>:<path> together with -g option
    (cgcreate, cgget and cgclassify), this patch adds this option to
cgdelete.

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoAdd -h option to cgexec tool
Ivana Hutarova Varekova [Thu, 28 Apr 2011 08:25:17 +0000 (10:25 +0200)] 
Add -h option to cgexec tool

This patch adds option -h to cgexec tool

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoAdd -h option to cgdelete tool
Ivana Hutarova Varekova [Thu, 28 Apr 2011 08:25:10 +0000 (10:25 +0200)] 
Add -h option to cgdelete tool

This patch adds option -h to cgdelete tool

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgconfigparser_simple test: remove duplicate output message
Ivana Hutarova Varekova [Thu, 21 Apr 2011 09:54:03 +0000 (11:54 +0200)] 
cgconfigparser_simple test: remove duplicate output message

remove duplicate output in cgconfigparser_simple test

CHANGELOG:
  remove unnecessary print - thanks Jan

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agounify lssubsys output
Ivana Hutarova Varekova [Wed, 20 Apr 2011 13:41:55 +0000 (15:41 +0200)] 
unify lssubsys output

fix several problems in lssubsys output
 * not consistent output with and without -i option
 * without this option lssubsys ignore multiple hierarchies on one mount
point
 * lssubsys -i without -a does not show the hierarchy number

in configuration:
$ cat /proc/cgroups
#subsys_name hierarchy num_cgroups enabled
cpuset 609 1 1
ns 0 1 1
cpu 606 1 1
cpuacct 606 1 1
memory 0 1 1
devices 0 1 1
freezer 612 1 1
net_cls 0 1 1
blkio 0 1 1

Old output:
$ lssubsys
cpu,cpuacct
cpuset,freezer
$ ./lssubsys -i
cpu,cpuacct
cpuset,freezer
$ ./lssubsys -ia
ns
memory
devices
net_cls
blkio
cpuset 609
cpu,cpuacct 606
freezer 612

new one:
$lssubsys
cpuset
cpu,cpuacct
freezer
$ ./lssubsys -i
cpuset 609
cpu,cpuacct 606
freezer 612
$ ./lssubsys -a
ns
memory
devices
net_cls
blkio
cpuset
cpu,cpuacct
freezer

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoadd missing arg test to theree api functions
Ivana Hutarova Varekova [Wed, 20 Apr 2011 13:41:49 +0000 (15:41 +0200)] 
add missing arg test to theree api functions

add missing arg test to theree api functions

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agofix a typo in cgget.1
Ivana Hutarova Varekova [Wed, 20 Apr 2011 13:41:42 +0000 (15:41 +0200)] 
fix a typo in cgget.1

fix a typo in cgget.1

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoFix strcpy problems in api funtions
Ivana Hutarova Varekova [Wed, 20 Apr 2011 13:41:36 +0000 (15:41 +0200)] 
Fix strcpy problems in api funtions

Fix strcpy problems in api funtions, missing tests for the variable length

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoUpdated cgconfig.conf man page with named hierarchies.
Jan Safranek [Mon, 18 Apr 2011 12:59:43 +0000 (14:59 +0200)] 
Updated cgconfig.conf man page with named hierarchies.

cgconfig.conf man page should describe how to work with named hierarchies,
including a simple example.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
14 years agoAdded tests for herarcheis mounted several times.
Jan Safranek [Wed, 6 Apr 2011 06:37:52 +0000 (08:37 +0200)] 
Added tests for herarcheis mounted several times.

Two new tests:
 - Test cgsnapshot, cgconfigparser and lssubsys with hierarchies mounted
   several times.
 - Test all the above with *named* hierarchies mounted several times +
   also with named hierarchy with ordinary controllers.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova<varekova@redhat.com>
14 years agoAdded support for named hierarchies to cgconfigparser.
Jan Safranek [Wed, 6 Apr 2011 06:37:45 +0000 (08:37 +0200)] 
Added support for named hierarchies to cgconfigparser.

Add the missing parts to make cgconfigparser able to mount named
hierarchies. It must add 'none' option to mount opts for mount without real
controller and with 'name=xxx' only, the rest (surprisingly) works out of the
box, only quoting needs special care.

Following cgconfig.conf is usable with the patch:
mount {
"name=test" = /cgroup/test;

"name=testwithcpu" = /cgroup/cpu;
cpu = /cgroup/cpu;
}

group foo {
"name=test" { }
"name=testwithcpu" { }
cpu { cpu.shares = 1024; }
}

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoEnhanced cgsnapshot to print named hierarchies.
Jan Safranek [Wed, 6 Apr 2011 06:37:38 +0000 (08:37 +0200)] 
Enhanced cgsnapshot to print named hierarchies.

cgsnapshot should show named hierarchies in 'mount' section. It already shows
their groups in 'group' sections and the output should be consistent.
And take care of quotes in the output, '=' is not valid character in controller
name unless it is in double quotes.

Example:
$ mount -t cgroup -o none,name=hello none /cgroup/named
$ mount -t cgroup -o cpuacct,name=cputest none /cgroup/cpuacct
$ cgsnapshot

mount {
cpuacct = /cgroup/cpuacct;
"name=hello" = /cgroup/named;
"name=cputest" = /cgroup/cpuacct;
}

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova<varekova@redhat.com>
14 years agoFixed cgclear to unmount all hierarchies mounted multiple times.
Jan Safranek [Wed, 6 Apr 2011 06:37:32 +0000 (08:37 +0200)] 
Fixed cgclear to unmount all hierarchies mounted multiple times.

Now we have API to list all mount points, cgclear can unmount them all.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova<varekova@redhat.com>
14 years agoAdded -M option to lssubsys to show multiple mount points of hierarchies.
Jan Safranek [Wed, 6 Apr 2011 06:37:25 +0000 (08:37 +0200)] 
Added -M option to lssubsys to show multiple mount points of hierarchies.

Now libcgroup is aware of hierarchies and all its mount points, let's
extend lssubsys to show them. The patch also renames few variables to be
descriptive, 'name' is not name of controller, it's list of controllers.

Now (and also with the patch, '-m' works the same):
$ lssubsys -m
cpuset,cpuacct /cgroup/cpu
memory /cgroup/memory

With the patch:
$ lssubsys -M
cpuset,cpuacct /cgroup/cpu
cpuset,cpuacct /cgroup/cpu2
memory /cgroup/memory

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova<varekova@redhat.com>
14 years agoUpdated cgsnapshot to show multiple mount points of hierarchies.
Jan Safranek [Wed, 6 Apr 2011 06:37:18 +0000 (08:37 +0200)] 
Updated cgsnapshot to show multiple mount points of hierarchies.

Take advantage of the new API and show all mount points in cgsnapshot output.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova<varekova@redhat.com>
14 years agoAdded iterators to go through all mount points of a hierarchy.
Jan Safranek [Wed, 6 Apr 2011 06:37:11 +0000 (08:37 +0200)] 
Added iterators to go through all mount points of a hierarchy.

Add new iterators, which return all mount points of given hierarchy. The order
of the mount points is the same as in /proc/mounts, The first returned mount
point is the same as cgroup_get_subsys_mount_point().

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova<varekova@redhat.com>
14 years agoFixed libcgroup to be aware of hierarchies mounted multiple times.
Jan Safranek [Wed, 6 Apr 2011 06:37:04 +0000 (08:37 +0200)] 
Fixed libcgroup to be aware of hierarchies mounted multiple times.

Current libcgroup design handles each hierarchy only once. If a hierarchy
is mounted twice or more times, only the first mount point is taken into
account and the others are 'invisible' to libcgroup.

This causes cgsnapshot and lssubsys to show only one mount point for a
hierarchy and especially in case of cgsnapshot it's not what user expects.
The patch below adds a list of all mount points to cg_mount_table_s structure.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova<varekova@redhat.com>
14 years agoFixed parsing of mount options
Jan Safranek [Wed, 6 Apr 2011 06:36:58 +0000 (08:36 +0200)] 
Fixed parsing of mount options

hasmntopt() returns start of the matching string, i.e. when looking for
'cpuacct' option it can return 'cpuacct,cpuset' if these two are mounted
together. So, don't use result of this function, use internal table of
controllers instead when checking for duplicates.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova<varekova@redhat.com>
14 years agoFixed cgrules.conf restore in testenv.sh
Jan Safranek [Tue, 5 Apr 2011 06:22:32 +0000 (08:22 +0200)] 
Fixed cgrules.conf restore in testenv.sh

The testenv.sh backs up and restores /etc/cgrules.conf. But when there is
no /etc/cgrules.conf when the test starts, the file is not removed when the
test ends.

Changelog:
  - redirected 'rm' output to /dev/null

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova<varekova@redhat.com>
14 years agoAdded README for the tool test suite
Jan Safranek [Tue, 5 Apr 2011 06:22:18 +0000 (08:22 +0200)] 
Added README for the tool test suite

Added README for the tool test suite

Changelog:
  - fixed spelling errors reported by Ivana

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova<varekova@redhat.com>
14 years agoAdded tests for cgclassify tool
Jan Safranek [Tue, 5 Apr 2011 06:22:07 +0000 (08:22 +0200)] 
Added tests for cgclassify tool

Various tests for cgclassify tool, including error cases and testing with
/etc/cgrules.conf. The tests will produce error messages to output, but it's
expected, reaction of cgclassify to wrong input is being tested as well.

Changelog: nothing since v1

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova<varekova@redhat.com>
14 years agocgclassify: add -h option
Ivana Hutarova Varekova [Fri, 11 Mar 2011 11:01:26 +0000 (12:01 +0100)] 
cgclassify: add -h option

this patch adds -h option to cgclassify tool

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgclassify: improve(unify) the usage output
Ivana Hutarova Varekova [Fri, 11 Mar 2011 11:01:19 +0000 (12:01 +0100)] 
cgclassify: improve(unify) the usage output

put the usage output to separate function

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agocgclassify: add argument check
Ivana Hutarova Varekova [Fri, 11 Mar 2011 11:01:13 +0000 (12:01 +0100)] 
cgclassify: add argument check

Fix the problem described in https://bugzilla.redhat.com/show_bug.cgi?id=667968
cgclassify accepts invalid non-numeric arguments, testcase:

$ cgclassify -g cpu:/ xxx; echo $?
0

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoFix configure --enable-debug
Jan Safranek [Fri, 4 Mar 2011 11:22:31 +0000 (12:22 +0100)] 
Fix configure --enable-debug

I've noticed that the debugging info is compiled in even if --disable-debug
is provided. Following patch adds explicit check that --enable-debug or
 --enable-debug=yes is provided to configure script.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agotestsuite: new cgconfigparser test
Ivana Hutarova Varekova [Thu, 10 Mar 2011 15:52:45 +0000 (16:52 +0100)] 
testsuite: new cgconfigparser test

This patch adds new test for cgconfig0parser tool

 This script tests the examples 1-4 from cgconfig.conf man pages - for each one tests whether the configuration which is created using described configuration file is identical with the example described below

changelog:
 * variables renamed
 * added conf files to Makefile.am

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agotestsuite: add TESTDIR variable to testenv
Ivana Hutarova Varekova [Thu, 10 Mar 2011 15:52:39 +0000 (16:52 +0100)] 
testsuite: add TESTDIR variable to testenv

add TESTDIR variable to testenv

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agotestsuite: fix tests Makefile to parse tools subdirectory
Ivana Hutarova Varekova [Thu, 10 Mar 2011 15:52:32 +0000 (16:52 +0100)] 
testsuite: fix tests Makefile to parse tools subdirectory

fix the Makefile.am variable to parse tools subdirectory

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoRemove unnecessary blacklisted variables
Ivana Hutarova Varekova [Wed, 2 Mar 2011 09:28:49 +0000 (10:28 +0100)] 
Remove unnecessary blacklisted variables

This patch removes blacklisted variables, which are now obsolete:
memory.force_empty
cpu.shares

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agotestsuite: cgconfigparser simple sanity test
Ivana Hutarova Varekova [Mon, 7 Mar 2011 09:48:25 +0000 (10:48 +0100)] 
testsuite: cgconfigparser simple sanity test

simple sanity test for cgconfigparser, cgsnapshot and cgclear tool

changelog:
 * test moved to separate subdirectory tools
changelog v2:
 * add hardcoded blacklist
changelog v3:
 * use $TMP instead of tmp

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agotestsuite: add test environment script
Ivana Hutarova Varekova [Mon, 7 Mar 2011 09:48:19 +0000 (10:48 +0100)] 
testsuite: add test environment script

changelog:
 * test moved to separate subdirectory tools

changelog v2:
 * set the directory in makefile
 * add CONFIGDIR variable

This patch create general functions and variables (made by Jan Safranek):
functions:
die:
# Print an error message and exit
# Usage:
#   cgclear || die "cgclear failed"

cleanup()
# Clear everything that was created at loading this script, i.e.
# remove the temporary directory
# Usage:
#   cleanup

prepare_config
# Copies a file to $TMP and replaces all occurrences of TMP in the file with
# value of $TMP. The function prints the name of the new file to its std.
# output.
#
# Usage:
#    cgconfigparser -l `prepare_config config/sample.conf`

variables:
TMP
# unique temporary dir
TOOLSDIR
# tools directory
CONFIGDIR
# config files directory

Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoFix cgclear to continue unmounting on error
Jan Safranek [Fri, 4 Mar 2011 11:06:37 +0000 (12:06 +0100)] 
Fix cgclear to continue unmounting on error

Currently when the cgclear stumbles upon a mount point which cannot be
removed it exits immediatelly. IMHO it should continue clearing the rest
and unmount as much as possible.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
14 years agodoc: fix cgconfig manpage
Jiri Slaby [Thu, 3 Mar 2011 10:46:16 +0000 (11:46 +0100)] 
doc: fix cgconfig manpage

529627fbbca cmomit left ' at the start of a line causing it to be a
command. Reformat not to be the first character on the line.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoRelease v0.37.1 v0.37.1
Jan Safranek [Tue, 1 Mar 2011 12:11:36 +0000 (13:11 +0100)] 
Release v0.37.1

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoFix buffer overflow when processing list of controllers from command line (CVE-2011...
Jan Safranek [Tue, 1 Mar 2011 12:11:35 +0000 (13:11 +0100)] 
Fix buffer overflow when processing list of controllers from command line (CVE-2011-1006).

Thanks to Nelson Elhage for reporting this issue.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoCheck length of netlink addresses.
Jan Safranek [Tue, 1 Mar 2011 12:11:35 +0000 (13:11 +0100)] 
Check length of netlink addresses.

Folow up on CVE-2011-1022, add check for length of address of incoming
netlink packet, just to be sure.

Pointed out by Steve Grubb.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agolex: get rid of two warnings
Jiri Slaby [Tue, 1 Mar 2011 09:41:14 +0000 (10:41 +0100)] 
lex: get rid of two warnings

Add a lex option to avoid:
lex.c:1173:17: warning: ‘yyunput’ defined but not used
lex.c:1214:16: warning: ‘input’ defined but not used

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoscripts: set executable the init scripts
Jiri Slaby [Tue, 1 Mar 2011 09:45:56 +0000 (10:45 +0100)] 
scripts: set executable the init scripts

When installing the init scripts, mark them as executable so that they
may be used immediately.

[v2]
* use INSTALL and INSTALL_SCRIPT to be autoconf-safe.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoconfigure.in: fix autoconf error
Jiri Slaby [Mon, 28 Feb 2011 16:39:59 +0000 (17:39 +0100)] 
configure.in: fix autoconf error

Autoconf expects an email in AC_INIT, otherwise it screams:
configure.in:18: warning: AC_INIT: not a literal: http://sourceforge.net/tracker/?group_id=218421&atid=1043649

Remove the URL, "/" and "&" are not allowed there.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoscripts/init.d: little cleanup cgred.in
Jiri Slaby [Mon, 28 Feb 2011 16:39:58 +0000 (17:39 +0100)] 
scripts/init.d: little cleanup cgred.in

Merge most of suse changes into these scripts to lower the maintanance
burden for us:
* define lockfile and use all over the code
* RETVAL should be used only in the big switch
* use quotes in some places

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoscripts/init.d: cgconfig, cleanup
Jiri Slaby [Mon, 28 Feb 2011 16:39:57 +0000 (17:39 +0100)] 
scripts/init.d: cgconfig, cleanup

* get rid of some unneeded bashisms
* remove unused variables
* define lockfile to be used all over the file
* define restart, to not duplicate code

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agodocco fixes
Jiri Slaby [Wed, 12 Jan 2011 13:53:41 +0000 (14:53 +0100)] 
docco fixes

Some typos, articles and similar crap.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoscripts: cgconfig, cleanup
Jiri Slaby [Wed, 12 Jan 2011 13:53:43 +0000 (14:53 +0100)] 
scripts: cgconfig, cleanup

* get rid of some unneeded bashisms
* remove unused variables

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoupdate .gitignore's
Jiri Slaby [Wed, 12 Jan 2011 13:53:42 +0000 (14:53 +0100)] 
update .gitignore's

Some files were not in .gitignore files, add them properly to not show
up in the status list.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>
14 years agoAllow commas for cpu sets in cgconfig.conf
James M Leddy [Wed, 23 Feb 2011 15:39:42 +0000 (10:39 -0500)] 
Allow commas for cpu sets in cgconfig.conf

We set disjoint cpu sets with the following command:

cgset -r cpuset.cpus=0,2 slot1

However, we don't allow commas that as part of the grammar when used
in the configuration file at cgconfig.conf. This patch seeks to
address that.

Signed-off-by: James M Leddy <james.leddy@redhat.com>
Signed-off-by: Jan Safranek <jsafrane@redhat.com>