lex.yy.c: lex.l
$(LEX) lex.l
-libcgroup.so: api.c libcgroup.h
- $(CXX) $(CFLAGS) -shared -fPIC -Wl,--soname,$@.$(VERSION) -o $@ api.c
+libcgroup.so: api.c libcgroup.h wrapper.c
+ $(CXX) $(CFLAGS) -shared -fPIC -Wl,--soname,$@.$(VERSION) -o $@ api.c \
+ wrapper.c
ln -sf $@ $@.$(VERSION)
install: libcgroup.so
lex.yy.c: lex.l
$(LEX) lex.l
-libcgroup.so: api.c libcgroup.h
- $(CXX) $(CFLAGS) -shared -fPIC -Wl,--soname,$@.$(VERSION) -o $@ api.c
+libcgroup.so: api.c libcgroup.h wrapper.c
+ $(CXX) $(CFLAGS) -shared -fPIC -Wl,--soname,$@.$(VERSION) -o $@ api.c \
+ wrapper.c
ln -sf $@ $@.$(VERSION)
install: libcgroup.so
int cgroup_init()
{
FILE *proc_mount;
- struct mntent *ent, *found_ent = NULL;
+ struct mntent *ent;
int found_mnt = 0;
int ret = 0;
- char *mntent_tok;
static char *controllers[CG_CONTROLLER_MAX];
FILE *proc_cgroup;
char subsys_name[FILENAME_MAX];
return ret;
}
-static char **get_mounted_controllers(char *mountpoint)
-{
- char **controllers;
- int i, j;
-
- i = 0;
- j = 0;
-
- controllers = (char **) malloc(sizeof(char *) * CG_CONTROLLER_MAX);
-
- for (i = 0; i < CG_CONTROLLER_MAX && cg_mount_table[i].name != NULL;
- i++) {
- if (strcmp(cg_mount_table[i].name, mountpoint) == 0) {
- controllers[j] = (char *)malloc(sizeof(char) *
- FILENAME_MAX);
- strcpy(controllers[j], cg_mount_table[i].name);
- j++;
- }
- }
- controllers[j] = (char *)malloc(sizeof(char) * FILENAME_MAX);
- controllers[j][0] = '\0';
-
- return controllers;
-}
-
static int cg_test_mounted_fs()
{
FILE *proc_mount;
*/
static int cg_set_control_value(char *path, char *val)
{
- int error;
FILE *control_file;
if (!cg_test_mounted_fs())
return ECGROUPNOTMOUNTED;
if (!ignore_ownership) {
strcpy(path, base);
strcat(path, "/tasks");
- chown(path, cgroup->tasks_uid, cgroup->tasks_gid);
+ error = chown(path, cgroup->tasks_uid,
+ cgroup->tasks_gid);
+ if (!error) {
+ error = ECGFAIL;
+ goto err;
+ }
}
}
ECGVALUEEXISTS,
ECGINVAL,
ECGCONTROLLERCREATEFAILED,
+ ECGFAIL,
};
#define CG_MAX_MSG_SIZE 256
%package devel
Summary: Development libraries to develop applications that utilize control groups
Group: Development/Libraries
-Requires: libcgroup >= 0.1b
+Requires: libcgroup >= @PACKAGE_VERSION@
%description devel
It provides API to create/delete and modify cgroup nodes. It will also in the
%install
rm -rf $RPM_BUILD_ROOT
-%makeinstall
+make DESTDIR=$RPM_BUILD_ROOT install
%clean
rm -rf $RPM_BUILD_ROOT
-CXXFLAGS = -g -O2 -Wall -DDEBUG
LDFLAGS = -L ..
LIBS = -lcgroup
+INC = -I ..
+CXXFLAGS = -g -O2 -Wall -DDEBUG $(INC)
libcg_ba: libcg_ba.cpp
$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) $(LIBS)