From: Lennart Poettering Date: Wed, 24 Mar 2010 20:04:36 +0000 (+0100) Subject: api: don't keep one copy of the mount table per .c file X-Git-Tag: v0.36~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d10a64fe1e07e240e4e16c8e8aede8dcd552149;p=thirdparty%2Flibcgroup.git 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 --- diff --git a/src/api.c b/src/api.c index 41f6d3e2..605137b9 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 722bc65d..d9838e9c 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