diff options
author | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2010-01-07 16:24:35 +0530 |
---|---|---|
committer | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2010-01-07 21:09:08 +0530 |
commit | 99ccdf671e9df5b13f646e1487393d562aa7fa62 (patch) | |
tree | 0e27f0b05ddcbb157dd48e2cfa24485dd1ad25b2 /src/api.c | |
parent | e1cc4cb97e00a1878541cc78bc3e5103a266da2e (diff) | |
download | libcg-99ccdf671e9df5b13f646e1487393d562aa7fa62.tar.gz libcg-99ccdf671e9df5b13f646e1487393d562aa7fa62.tar.xz libcg-99ccdf671e9df5b13f646e1487393d562aa7fa62.zip |
libcgroup: Setup the namespace datastructures
This patch handles the validation of the newer configuration files.
Some of the rules to be followed
1. We cannot have more controllers in the namespcae section than
already mounted.
2. If more than one controller are mounted at the same point, then
they will have the same namespace. In case it is not explicitly
mentioned, the subsystems at the mount point will be set to the
same namespace. This does not mean that controllers mounted at different
points need to have the same namespace.
Changes from v4:
1. Changed a variable name from mount to mount_path
2. Added more comments
Changes from v3:
1. Removed most of the strdups
2. Fixed return values for errors
Changes from v2:
1. mount and namespace keyword cannot come in the same file.
Changes from v1:
1. Fix a bug where if a namespace was not defined, we were not exiting
2. Comment the validate namespace function
3. Make some of the variables more descriptive
4. Make namespace thread specific
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Diffstat (limited to 'src/api.c')
-rw-r--r-- | src/api.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -64,9 +64,6 @@ __thread char errtext[MAXLEN]; /* Task command name length */ #define TASK_COMM_LEN 16 -struct cg_mount_table_s cg_mount_table[CG_CONTROLLER_MAX]; -static pthread_rwlock_t cg_mount_table_lock = PTHREAD_RWLOCK_INITIALIZER; - /* Check if cgroup_init has been called or not. */ static int cgroup_initialized; @@ -82,6 +79,9 @@ static struct cgroup_rule_list trl; /* Lock for the list of rules (rl) */ static pthread_rwlock_t rl_lock = PTHREAD_RWLOCK_INITIALIZER; +/* Namespace */ +__thread char *cg_namespace_table[CG_CONTROLLER_MAX]; + char *cgroup_strerror_codes[] = { "Cgroup is not compiled in", "Cgroup is not mounted", @@ -108,6 +108,10 @@ char *cgroup_strerror_codes[] = { "The config file can not be opened", "Sentinel" "End of File or iterator", + "Failed to parse config file", + "Have multiple paths for the same namespace", + "Controller in namespace does not exist", + "Cannot have mount and namespace keyword in the same configuration file", }; static int cg_chown_file(FTS *fts, FTSENT *ent, uid_t owner, gid_t group) |