On Fri 20-05-11 14:25:09, Jan Safranek wrote: > On 05/13/2011 02:01 PM, Michal Hocko wrote: > > Let's add file permission for tasks and file and directory permissions > > for control files into cgroup so that we can add them into configuration > > files. > > Permissions are initialized to -1U to reflect that no value is set. > > Mo magic numbers please... use #define or enum
In which header file should I put it? > > > Let's also add a common initialization functions for both cgroup table > > and single cgroup. > > > > Signed-off-by: Michal Hocko <mho...@suse.cz> > > --- > > src/config.c | 6 ++++++ > > src/libcgroup-internal.h | 3 +++ > > src/wrapper.c | 15 ++++++++++++++- > > 3 files changed, 23 insertions(+), 1 deletions(-) > > > > diff --git a/src/config.c b/src/config.c > > index f1873ea..7abec84 100644 > > --- a/src/config.c > > +++ b/src/config.c > > @@ -105,6 +105,7 @@ int cgroup_config_insert_cgroup(char *cg_name) > > > > memset(newblk + oldlen, 0, (MAX_CGROUPS - oldlen) * > > sizeof(struct cgroup)); > > + init_cgroup_table(newblk + oldlen, MAX_CGROUPS - oldlen); > > config_cgroup_table = newblk; > > cgroup_dbg("MAX_CGROUPS %d\n", MAX_CGROUPS); > > cgroup_dbg("reallocated config_cgroup_table to %p\n", > > config_cgroup_table); > > @@ -712,6 +713,11 @@ int cgroup_config_load_config(const char *pathname) > > } > > > > config_cgroup_table = calloc(MAX_CGROUPS, sizeof(struct cgroup)); > > + if (!config_cgroup_table) > > + return ENOMEM; > > ECGFAIL, this is not kernel :) OK, I have seen ENOMEM being used (e.g. cgroup_config_insert_cgroup). Should I just return ECGFAIL and set last_error to ENOMEM? Thanks -- Michal Hocko SUSE Labs SUSE LINUX s.r.o. Lihovarska 1060/12 190 00 Praha 9 Czech Republic ------------------------------------------------------------------------------ What Every C/C++ and Fortran developer Should Know! Read this article and learn how Intel has extended the reach of its next-generation tools to help Windows* and Linux* C/C++ and Fortran developers boost performance applications - including clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel