From 5d10a64fe1e07e240e4e16c8e8aede8dcd552149 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 24 Mar 2010 21:04:36 +0100 Subject: 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 Acked-by: Dhaval Giani Signed-off-by: Dhaval Giani --- src/api.c | 3 +++ src/libcgroup-internal.h | 4 ++-- 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 -- cgit