| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
Signed-off-by: Steve Olivieri <sjo@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@190 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of using sizeof(path), we should use FILENAME_MAX -
strlen(path) - 1.
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@186 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
| |
I've tested the patch by running the tests available in the tests
directory.
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@185 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
| |
attributes. Test cases have also been updated.
Tested on an x86_64 box with libcg_ba
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@166 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
with a modified version of libcg_ba (basic acceptance tests), that I'll send
out later. I've also fixed a couple of bugs, I'll list them in order and
if desired, I'll split out the patches so that the enhancements can be
separate from the bug fixes
1. Fix cg_create_control_group() to succeed if the directory already exists
2. We can't always append a control_file, we need to open it "r+"
3. It's OK for writing values to a control_file to fail, since some of
them are read-only and some may not exist in hierarchies below the root
4. Skip over directories while trying to read control file's name value pairs
5. In cg_rd_ctlr_file we don't allocate any memory to value, directly fscanf
into it, that's been fixed
6. There might be more fixes that might already be present in trunk, since
I hope I've not redone a lot of the fixes, I had branched of trunk very
recently
Changelog v2
------------
1. Refactor cgroup_free_controllers() and use it in
cgroup_create_cgroup_from_parent()
2. Check for strdup failure
3. Check if dst == src
TODO:
1. Use cg_add_controller() API
2. Use cg_add_value_string() API
I'll send out patches for the TODOs later.
I've also updated the basic acceptance test (libcg_ba.cpp)
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@165 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
| |
Various libcgroup api cleanups as suggested by balbir during code review
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@159 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
| |
We were failing on stat's success. Stupid thing to do really. Fixing
that now.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@154 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
| |
cgroup_attach_task_pid() should return ECGROUPNOTEXIST when we get an
ENOENT from glibc. This patch makes that correction
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@153 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
| |
The code looked ugly. De-uglyfy it.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@151 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sudhir reported a free() issue, it got traced to this issue.
https://sourceforge.net/tracker/index.php?func=detail&aid=2049822&group_id=218421&atid=1043649
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Sudhir Kumar <skumar@linux.vnet.ibm.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@150 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
| |
An almost unused and less tested API. The path was getting
misformed. This was because it had not been set in the first place.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@146 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The delete call was returning a wrong value even on success.
The reason was because in the fallback path, we try to delete
all the groups again. Now it is possible that a group might
have already been deleted and we return a wrong value.
Change the API to check if the group exists before trying to rmdir
it in the error path.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@145 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
| |
cgroup_get_cgroup()
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@143 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
From: Vivek Goyal <vgoyal@redhat.com>
Enhancement to libcg to do following.
- Parse the /etc/cgrules.conf file and place the task in the right cgroup.
- Exported two APIs which can place the task based on /etc/cgrules.conf
or based on cgroup explicitly specified by the caller.
- There can be multiple users.
- PAM module (pam_cgroup)
- cgexec tool
- cgclassify tool
- APIs can be directly used by other cgroup aware user progarams.
- Classification daemon
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@136 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
From: Vivek Goyal <vgoyal@redhat.com>
o Adding a task to a particular cgroup currently does fprintf() and never
check the return code. Modify it to check for the return code in case
fprintf() and fflush() did not succeed.
o I ran into the issues when i can't add migration thread to
/container/admingroup/tasks and it will fail silently.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@133 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that a new API is available which allows a cgroup structure to
be generated with just a name, extend cgroup_get_cgroup to get the
uids and gids from the fs itself.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@127 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An artifact from the time when libcgroup could not handle multiple
cgroup filesystems mounted at multiple points. It is very much possible
a subsystem is not mounted at that point. (FWIW, it is wrong even on a
single mount point, but I am quite surprised that no one hit it yet.)
V1->V2
A minor cleanup possible.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@120 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New API to get the cgroup datastructure from the mounted filesystem.
It accepts the cgroup datastructure with the name of the cgroup
which has to populated across various mountpoints.
TODO:
More testing.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Dan Smith <danms@us.ibm.com>
Cc: Paul Menage <menage@google.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@117 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
| |
From: Vivek Goyal <vgoyal@redhat.com>
o Add some more debug statements
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@115 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
| |
Some errors were not handled, this patch handles those errors.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@114 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
| |
Add rwlock to ensure access to cg_mount_table is serialized.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@110 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch converts functions which have reentrant versions to
use those versions.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Paul Menage <menage@google.com>
Cc: Dan Smith <danms@us.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@109 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
| |
We don't want to return errno as those results. Setting it to
return a libcgroup error value.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@108 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
From: Sudhir Kumar <skumar@linux.vnet.ibm.com>
This patch fixes the segmentation fault in libcg api cgroup_attach_task()
in case of multiple mounts.
Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@103 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
From: Sudhir Kumar <skumar@linux.vnet.ibm.com>
[dhaval@linux.vnet.ibm.com]: correct error codes
Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@102 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes the spell mistake in enum value in the header file
and libcg api file.
Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@84 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Dan Smith reported some segmentation faults. It turns out that we did
not NULL terminate all the structures when we had moved to the wrapper
based approach. With this in mind, the loop checks the index instead
of a NULL structure.
Also remove unwanted NULL terminations.
Thanks to Dan for excellent debugging.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1c@77 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
| |
v0.1c.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1c@76 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
| |
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1b@68 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
| |
spec file based on bugzilla input. Removed %makeinstall
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1b@67 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
| |
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/tags/v0.1b@49 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Works for me on my testing. NOTE: The testing is insufficient as we
only test cg_control_create_cgroup() and not delete_cgroup() or
attach_task(). Sudhir's new test cases should really help
Several coding style fixes and changes, enhancements to make the code
work.
NOTE: Since this is development release -DDEBUG is back in the makefile.
Once this is committed, I'll bump up the version to 0.05 if no one objects.
Test report
-----------
debug log from the library
matched cpuacct:cpuacct
Found cgroup option rw,relatime,cpuacct, count 0
matched cpu:cpu
Found cgroup option rw,relatime,cpu, count 1
tuid 0, tgid 0, cuid 1000, cgid 1000
path is /tmp/container_cpu/database/
path is /tmp/container_cpuacct/database/
NOTE: The database directory was created as expected on both mount points
/tmp/container_cpu and /tmp/container_cpuacct
balbir@localhost:~/deliverables/nextgen/libcg/branches/balbir/tests$ ls -al /tmp/container_cpuacct/
total 424
drwxrwxrwt 5 root root 0 2008-05-17 21:27 .
drwxrwxrwt 32 root root 425984 2008-05-17 21:26 ..
drwxr-xr-x 2 root root 0 2008-05-17 17:09 class1
drwxr-xr-x 2 balbir balbir 0 2008-05-17 17:09 class2
-rw-r--r-- 1 root root 0 2008-05-17 17:09 cpuacct.usage
drwxr-xr-x 2 balbir balbir 0 2008-05-17 21:27 database
-rw-r--r-- 1 root root 0 2008-05-17 17:09 notify_on_release
-rw-r--r-- 1 root root 0 2008-05-17 17:09 releasable
-rw-r--r-- 1 root root 0 2008-05-17 17:09 release_agent
-rwxrwxrwx 1 root root 0 2008-05-17 17:09 tasks
balbir@localhost:~/deliverables/nextgen/libcg/branches/balbir/tests$ ls -al /tmp/container_cpu
total 424
drwxrwxrwt 5 root root 0 2008-05-17 21:27 .
drwxrwxrwt 32 root root 425984 2008-05-17 21:26 ..
drwxr-xr-x 2 root root 0 2008-05-17 17:09 class1
drwxr-xr-x 2 balbir balbir 0 2008-05-17 17:09 class2
-rw-r--r-- 1 root root 0 2008-05-17 17:09 cpu.rt_runtime_us
-rw-r--r-- 1 root root 0 2008-05-17 17:09 cpu.shares
drwxr-xr-x 2 balbir balbir 0 2008-05-17 21:27 database
-rw-r--r-- 1 root root 0 2008-05-17 17:09 notify_on_release
-rw-r--r-- 1 root root 0 2008-05-17 17:09 releasable
-rw-r--r-- 1 root root 0 2008-05-17 17:09 release_agent
-rwxrwxrwx 1 root root 0 2008-05-17 21:10 tasks
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@30 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
| |
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@27 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
| |
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@26 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
| |
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@19 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
| |
Turn off -DDEBUG in Makefile
Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@18 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
libcg.h | 4 ++--
tests/libcg_ba.cpp | 2 +-
Added additional parameters for create and destroy cgroup. Fixed a cg_init
segfault (faulty, if-else check)
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@15 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ownership arguments.
api.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@13 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The first basic acceptance test is under development and first
prototype is released
api.c | 161 +++++++++++++++++++++++++++++++++++++++++++----------
libcg.h | 14 +---
tests/Makefile | 9 ++
tests/libcg_ba.cpp | 127 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 274 insertions(+), 37 deletions(-)
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@12 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
| |
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@8 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
|
|
|
|
|
|
|
|
| |
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
The code is yet to be tested though
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@7 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|
|
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@4 4f4bb910-9a46-0410-90c8-c897d4f1cd53
|