bindir=${exec_prefix}/bin
libdir=${exec_prefix}/lib
includedir=${prefix}/include
-prefix=/usr
+prefix=/usr/local
exec_prefix=${prefix}
INSTALL=install
INSTALL_DATA=install -m 644
-PACKAGE_VERSION=0.1b
+PACKAGE_VERSION=0.1c
CFLAGS=-g -O2 $(INC) -DPACKAGE_VERSION=$(PACKAGE_VERSION)
VERSION=1
struct cg_mount_table_s cg_mount_table[CG_CONTROLLER_MAX];
+/* Check if cgroup_init has been called or not. */
+static int cgroup_initialized;
+
static int cg_chown_file(FTS *fts, FTSENT *ent, uid_t owner, gid_t group)
{
int ret = 0;
return ret;
}
+static int cgroup_test_subsys_mounted(const char *name)
+{
+ int i;
+
+ for (i = 0; cg_mount_table[i].name[0] != '\0'; i++) {
+ if (strncmp(cg_mount_table[i].name, name,
+ sizeof(cg_mount_table[i].name)) == 0) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
/**
* cgroup_init(), initializes the MOUNT_POINT.
* This code is not currently thread safe (hint: getmntent is not thread safe).
if (!strncmp(ent->mnt_type, "cgroup", strlen("cgroup"))) {
for (i = 0; controllers[i] != NULL; i++) {
mntopt = hasmntopt(ent, controllers[i]);
+ mntopt = strtok(mntopt, ",");
if (mntopt &&
strcmp(mntopt, controllers[i]) == 0) {
dbg("matched %s:%s\n", mntopt,
found_mnt++;
cg_mount_table[found_mnt].name[0] = '\0';
-
fclose(proc_mount);
+ cgroup_initialized = 1;
return ret;
}
if (strcmp(cg_mount_table[i].name, type) == 0) {
strcpy(path, cg_mount_table[i].path);
strcat(path, "/");
- strcat(path, name);
- strcat(path, "/");
+ if (name) {
+ strcat(path, name);
+ strcat(path, "/");
+ }
return path;
}
}
FILE *tasks;
int i;
+ if (!cgroup_initialized)
+ return ECGROUPNOTINITALIZED;
+
if(!cgroup)
{
for(i = 0; i < CG_CONTROLLER_MAX &&
cg_mount_table[i].name[0]!='\0'; i++) {
- if (!cg_build_path(cgroup->name, path, NULL))
+ if (!cg_build_path(NULL, path, cg_mount_table[i].name))
continue;
strcat(path, "/tasks");
fclose(tasks);
}
} else {
- for( i = 0; i <= CG_CONTROLLER_MAX &&
+ for (i = 0; i <= CG_CONTROLLER_MAX &&
+ cgroup->controller[i] != NULL; i++) {
+ if (!cgroup_test_subsys_mounted(cgroup->controller[i]->name))
+ return ECGROUPSUBSYSNOTMOUNTED;
+ }
+ for (i = 0; i <= CG_CONTROLLER_MAX &&
cgroup->controller[i] != NULL ; i++) {
if (!cg_build_path(cgroup->name, path,
cgroup->controller[i]->name))
int i;
int error;
+ if (!cgroup_initialized)
+ return ECGROUPNOTINITALIZED;
+
+ for (i = 0; i <= CG_CONTROLLER_MAX && cgroup->controller[i] != NULL;
+ i++) {
+ if (!cgroup_test_subsys_mounted(cgroup->controller[i]->name))
+ return ECGROUPSUBSYSNOTMOUNTED;
+ }
+
for (i = 0; i < CG_CONTROLLER_MAX && cgroup->controller[i];
i++, strcpy(path, base)) {
int j;
int cgroup_create_cgroup(struct cgroup *cgroup, int ignore_ownership)
{
char *fts_path[2], base[FILENAME_MAX], *path;
- int j, k;
+ int i, j, k;
int error = 0;
+ if (!cgroup_initialized)
+ return ECGROUPNOTINITALIZED;
+
+ for (i = 0; i <= CG_CONTROLLER_MAX && cgroup->controller[i] != NULL;
+ i++) {
+ if (!cgroup_test_subsys_mounted(cgroup->controller[i]->name))
+ return ECGROUPSUBSYSNOTMOUNTED;
+ }
+
fts_path[0] = (char *)malloc(FILENAME_MAX);
if (!fts_path[0])
return ENOMEM;
int error = ECGROUPNOTALLOWED;
int i, ret;
+ if (!cgroup_initialized)
+ return ECGROUPNOTINITALIZED;
+
+ for (i = 0; i <= CG_CONTROLLER_MAX && cgroup->controller[i] != NULL;
+ i++) {
+ if (!cgroup_test_subsys_mounted(cgroup->controller[i]->name))
+ return ECGROUPSUBSYSNOTMOUNTED;
+ }
+
for (i = 0; i < CG_CONTROLLER_MAX && cgroup->controller; i++) {
if (!cg_build_path(cgroup->name, path,
cgroup->controller[i]->name))
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for control groups library and utilities 0.1b.
+# Generated by GNU Autoconf 2.61 for control groups library and utilities 0.1c.
#
# Report bugs to <http://sourceforge.net/tracker/?group_id=218421&atid=1043649>.
#
# Identity of this package.
PACKAGE_NAME='control groups library and utilities'
PACKAGE_TARNAME='control-groups-library-and-utilities'
-PACKAGE_VERSION='0.1b'
-PACKAGE_STRING='control groups library and utilities 0.1b'
+PACKAGE_VERSION='0.1c'
+PACKAGE_STRING='control groups library and utilities 0.1c'
PACKAGE_BUGREPORT='http://sourceforge.net/tracker/?group_id=218421&atid=1043649'
ac_unique_file="wrapper.c"
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures control groups library and utilities 0.1b to adapt to many kinds of systems.
+\`configure' configures control groups library and utilities 0.1c to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of control groups library and utilities 0.1b:";;
+ short | recursive ) echo "Configuration of control groups library and utilities 0.1c:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-control groups library and utilities configure 0.1b
+control groups library and utilities configure 0.1c
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by control groups library and utilities $as_me 0.1b, which was
+It was created by control groups library and utilities $as_me 0.1c, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by control groups library and utilities $as_me 0.1b, which was
+This file was extended by control groups library and utilities $as_me 0.1c, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-control groups library and utilities config.status 0.1b
+control groups library and utilities config.status 0.1c
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
cat "$ac_result"
fi
rm -f "$tmp/out12"
-# Compute $ac_file's index in $config_headers.
-_am_arg=$ac_file
-_am_stamp_count=1
-for _am_header in $config_headers :; do
- case $_am_header in
- $_am_arg | $_am_arg:* )
- break ;;
- * )
- _am_stamp_count=`expr $_am_stamp_count + 1` ;;
- esac
-done
-echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
-$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$_am_arg" : 'X\(//\)[^/]' \| \
- X"$_am_arg" : 'X\(//\)$' \| \
- X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$_am_arg" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`/stamp-h$_am_stamp_count
;;
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
AC_PREREQ(2.61)
-AC_INIT([control groups library and utilities], 0.1b,
+AC_INIT([control groups library and utilities], 0.1c,
[http://sourceforge.net/tracker/?group_id=218421&atid=1043649])
AC_CONFIG_SRCDIR([wrapper.c])
AC_CONFIG_HEADER([config.h])
ECGINVAL,
ECGCONTROLLERCREATEFAILED,
ECGFAIL,
+ ECGROUPNOTINITALIZED,
};
#define CG_MAX_MSG_SIZE 256
Summary: Tools and libraries to control and monitor control groups
Group: Development/Libraries
Version: @PACKAGE_VERSION@
-Release: 3%{?dist}
+Release: 1%{?dist}
License: LGPLv2+
URL: http://libcg.sourceforge.net/
Source0: http://downloads.sourceforge.net/libcg/%{name}-%{version}.tar.bz2
%changelog
+* Wed Jun 11 2008 Dhaval Giani <dhaval@linux.vnet.ibm.com> 0.1c-1
+- Update to latest upstream version
* Tue Jun 3 2008 Balbir Singh <balbir@linux.vnet.ibm.com> 0.1b-3
- Add post and postun. Also fix Requires for devel to depend on base n-v-r
* Sat May 31 2008 Balbir Singh <balbir@linux.vnet.ibm.com> 0.1b-2