diff options
author | Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> | 2009-06-26 14:49:36 +0900 |
---|---|---|
committer | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2009-06-29 16:28:38 +0530 |
commit | d297b6fc17d51b8c2f6cdc094ada378d49e9a583 (patch) | |
tree | 9ce840be0a666a8ad1f13756639c13c886306728 /src/libcgroup-internal.h | |
parent | 404007be1a80ab2ab75f64195fb692d520df0623 (diff) | |
download | libcg-d297b6fc17d51b8c2f6cdc094ada378d49e9a583.tar.gz libcg-d297b6fc17d51b8c2f6cdc094ada378d49e9a583.tar.xz libcg-d297b6fc17d51b8c2f6cdc094ada378d49e9a583.zip |
Add the parser of process name in /etc/cgrules.conf.
Hi,
Changelog of v6:
================
* The definations of CGROUP_RULE_MAXKEY and CGROUP_RULE_MAXLINE are
moved to libcgroup-internal.h since no one from outside should be
using them.
Changelog of v5:
================
* Rebase the patch to the latest code.
Changelog of v4:
================
* Use more safety length of a user name for the buffer "username".
* Move the macros min()/max() to src/libcgroup-internal.h for using
in src/api.c also.
Changelog of v3:
================
* Fix unclear buffer of user by memset().
Changelog of v2:
================
* Remove unnecessary memset().
* Some cleanups.
Description:
============
This patch adds the parser of process name in /etc/cgrules.conf.
A new rule based on process name is as the following, and the process
name is stored into the member "procname" in struct cgroup_rule.
<user>:<process name> <controllers> <destination>
Thanks
Ken'ichi Ohmichi
Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Diffstat (limited to 'src/libcgroup-internal.h')
-rw-r--r-- | src/libcgroup-internal.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libcgroup-internal.h b/src/libcgroup-internal.h index fac82a1..fa92048 100644 --- a/src/libcgroup-internal.h +++ b/src/libcgroup-internal.h @@ -30,12 +30,22 @@ __BEGIN_DECLS #define CGROUP_BUFFER_LEN (5 * FILENAME_MAX) +/* Maximum length of a key(<user>:<process name>) in the daemon config file */ +#define CGROUP_RULE_MAXKEY (LOGIN_NAME_MAX + FILENAME_MAX + 1) + +/* Maximum length of a line in the daemon config file */ +#define CGROUP_RULE_MAXLINE (FILENAME_MAX + CGROUP_RULE_MAXKEY + \ + CG_CONTROLLER_MAX + 3) + #ifdef CGROUP_DEBUG #define cgroup_dbg(x...) printf(x) #else #define cgroup_dbg(x...) do {} while (0) #endif +#define max(x,y) ((y)<(x)?(x):(y)) +#define min(x,y) ((y)>(x)?(x):(y)) + struct control_value { char name[FILENAME_MAX]; char value[CG_VALUE_MAX]; @@ -77,6 +87,7 @@ struct cgroup_rules_data { struct cgroup_rule { uid_t uid; gid_t gid; + char *procname; char username[LOGIN_NAME_MAX]; char destination[FILENAME_MAX]; char *controllers[MAX_MNT_ELEMENTS]; |