2
* Copyright Red Hat, Inc. 2009
4
* Author: Vivek Goyal <vgoyal@redhat.com>
5
* Jan Safranek <jsafrane@redhat.com>
7
* This program is free software; you can redistribute it and/or modify it
8
* under the terms of version 2.1 of the GNU Lesser General Public License
9
* as published by the Free Software Foundation.
11
* This program is distributed in the hope that it would be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
#ifndef __TOOLS_COMMON
19
#define __TOOLS_COMMON
22
#include <libcgroup.h>
25
#define cgroup_dbg(x...) printf(x)
27
#define cgroup_dbg(x...) do {} while (0)
31
* Auxiliary specifier of group, used to store parsed command line options.
33
struct cgroup_group_spec {
34
char path[FILENAME_MAX];
35
char *controllers[CG_CONTROLLER_MAX];
40
* Parse command line option with group specifier into provided data structure.
41
* The option must have form of 'controller1,controller2,..:group_name'.
43
* The parsed list of controllers and group name is added at the end of
46
* @param cdptr Target data structure to fill. New item is allocated and added
48
* @param optarg Argument to parse.
49
* @return 0 on success, != 0 on error.
51
int parse_cgroup_spec(struct cgroup_group_spec *cdptr[], char *optarg);
54
* Free a single cgroup_group_spec structure.
55
* @param cl The structure to free from memory
57
void cgroup_free_group_spec(struct cgroup_group_spec *cl);
59
#endif /* TOOLS_COMMON */