コード例 #1
0
ファイル: cgroup.c プロジェクト: inokappa/lxc
/*
 * for each mounted cgroup, destroy the cgroup for the container
 */
int lxc_cgroup_destroy(const char *name)
{
	struct mntent *mntent;
	FILE *file = NULL;
	int ret, err = -1;

	file = setmntent(MTAB, "r");
	if (!file) {
		SYSERROR("failed to open %s", MTAB);
		return -1;
	}

	while ((mntent = getmntent(file))) {
		if (!strcmp(mntent->mnt_type, "cgroup")) {
			DEBUG("destroying %s %s\n", mntent->mnt_dir, name);
			ret = lxc_one_cgroup_destroy(mntent->mnt_dir, name);
			if (ret) {
				fclose(file);
				return ret;
			}
			err = 0;
		}
	}

	fclose(file);

	return err;
}
コード例 #2
0
ファイル: cgroup.c プロジェクト: duanbing/lxc-0.9.0-comment
/*
 * for each mounted cgroup, destroy the cgroup for the container
 */
int lxc_cgroup_destroy(const char *cgpath)
{
	struct mntent *mntent;
	FILE *file = NULL;
	int err, retv  = 0;

	file = setmntent(MTAB, "r");
	if (!file) {
		SYSERROR("failed to open %s", MTAB);
		return -1;
	}

	while ((mntent = getmntent(file))) {
		if (strcmp(mntent->mnt_type, "cgroup"))
			continue;
		if (!mount_has_subsystem(mntent))
			continue;

		err = lxc_one_cgroup_destroy(mntent, cgpath);
		if (err)  // keep trying to clean up the others
			retv = -1;
	}

	endmntent(file);
	return retv;
}
コード例 #3
0
ファイル: cgroup.c プロジェクト: coconutpilot/lxc-gentoo-new
/*
 * for each mounted cgroup, destroy the cgroup for the container
 */
int lxc_cgroup_destroy(const char *name)
{
	struct mntent *mntent;
	FILE *file = NULL;
	int err = -1;

	file = setmntent(MTAB, "r");
	if (!file) {
		SYSERROR("failed to open %s", MTAB);
		return -1;
	}

	while ((mntent = getmntent(file))) {
		if (strcmp(mntent->mnt_type, "cgroup"))
			continue;
		if (!mount_has_subsystem(mntent))
			continue;

		err = lxc_one_cgroup_destroy(mntent, name);
		if (err)
			break;
	}

	endmntent(file);
	return err;
}