File: get_controller.c

package info (click to toggle)
libcgroup 0.36.2-3%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,436 kB
  • ctags: 937
  • sloc: sh: 10,789; ansic: 7,684; yacc: 278; cpp: 123; makefile: 96; lex: 25
file content (34 lines) | stat: -rw-r--r-- 668 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <libcgroup.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int error;
	void *handle;
	struct cgroup_mount_point info;

	error = cgroup_init();

	if (error) {
		printf("cgroup_init failed with %s\n", cgroup_strerror(error));
		exit(1);
	}

	error = cgroup_get_controller_begin(&handle, &info);

	while (error != ECGEOF) {
		printf("Controller %s is mounted at %s\n", info.name,
								info.path);
		error = cgroup_get_controller_next(&handle, &info);
		if (error && error != ECGEOF) {
			printf("cgroup_get_contrller_next failed with %s",
							cgroup_strerror(error));
			exit(1);
		}
	}

	error = cgroup_get_controller_end(&handle);

	return 0;
}