summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-03-24 21:04:36 +0100
committerDhaval Giani <dhaval.giani@gmail.com>2010-03-26 12:56:44 +0100
commit5d10a64fe1e07e240e4e16c8e8aede8dcd552149 (patch)
tree78438268e8a00d6b84cb56b265b17d048adab3a1
parent162e7612f623fe69437ef258b033e4c1518a5cc8 (diff)
downloadlibcg-5d10a64fe1e07e240e4e16c8e8aede8dcd552149.tar.gz
libcg-5d10a64fe1e07e240e4e16c8e8aede8dcd552149.tar.xz
libcg-5d10a64fe1e07e240e4e16c8e8aede8dcd552149.zip
api: don't keep one copy of the mount table per .c file
The mount table variables need to be declared in the header file and defined in the .c file. If we don't do that every .o file will end up with its own copy of those variables. Signed-off-by: Lennart Poettering <lennart@poettering.net> Acked-by: Dhaval Giani <dhaval.giani@gmail.com> Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
-rw-r--r--src/api.c3
-rw-r--r--src/libcgroup-internal.h4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/api.c b/src/api.c
index 41f6d3e..605137b 100644
--- a/src/api.c
+++ b/src/api.c
@@ -83,6 +83,9 @@ static pthread_rwlock_t rl_lock = PTHREAD_RWLOCK_INITIALIZER;
/* Namespace */
__thread char *cg_namespace_table[CG_CONTROLLER_MAX];
+pthread_rwlock_t cg_mount_table_lock = PTHREAD_RWLOCK_INITIALIZER;
+struct cg_mount_table_s cg_mount_table[CG_CONTROLLER_MAX];
+
const char const *cgroup_strerror_codes[] = {
"Cgroup is not compiled in",
"Cgroup is not mounted",
diff --git a/src/libcgroup-internal.h b/src/libcgroup-internal.h
index 722bc65..d9838e9 100644
--- a/src/libcgroup-internal.h
+++ b/src/libcgroup-internal.h
@@ -143,8 +143,8 @@ struct cgroup *create_cgroup_from_name_value_pairs(const char *name,
/*
* Main mounting structures
*/
-struct cg_mount_table_s cg_mount_table[CG_CONTROLLER_MAX];
-static pthread_rwlock_t cg_mount_table_lock = PTHREAD_RWLOCK_INITIALIZER;
+extern struct cg_mount_table_s cg_mount_table[CG_CONTROLLER_MAX];
+extern pthread_rwlock_t cg_mount_table_lock;
/*
* config related structures