On 6/18/2012 2:32 PM, John Fastabend wrote: > On 6/18/2012 2:08 PM, John Fastabend wrote: >> Add routine to scan rules.conf file and move matching running tasks >> in /proc/pid/* into configured control groups. >> >> Without this adding control group after cgrulesengd has started >> does not work correctly and processes running before cgrulesengd >> is started are not managed. >> >> This new routine is called at init time and also after inotify events >> on control groups. >> >> Signed-off-by: John Fastabend <john.r.fastab...@intel.com> >> --- >> >> include/libcgroup/tasks.h | 1 + >> src/api.c | 77 >> +++++++++++++++++++++++++++++++++++++++++++++ >> src/daemon/cgrulesengd.c | 75 >> +++++++++++++++++++++++++++++++++++++++++--- >> src/libcgroup.map | 1 + >> 4 files changed, 149 insertions(+), 5 deletions(-) >> >> diff --git a/include/libcgroup/tasks.h b/include/libcgroup/tasks.h >> index fb728f4..120af69 100644 >> --- a/include/libcgroup/tasks.h >> +++ b/include/libcgroup/tasks.h >> @@ -107,6 +107,7 @@ int cgroup_reload_cached_rules(void); >> * @param fp Destination file, where the rules will be printed. >> */ >> void cgroup_print_rules_config(FILE *fp); >> +void cgroup_search_rules_config(void); >> >> /** >> * @} >> diff --git a/src/api.c b/src/api.c >> index 29de777..ebf53ee 100644 >> --- a/src/api.c >> +++ b/src/api.c >> @@ -2837,6 +2837,83 @@ int cgroup_change_cgroup_path(const char *dest, >> pid_t pid, >> return ret; >> } >> >> +static int cg_get_pid_from_flags(int uid, int gid, char *procname, >> int *pid) >> +{ >> + DIR *dir; >> + struct dirent *pid_dir = NULL; >> + char *path = "/proc/"; >> + char pid_path[100]; >> + char pid_name[100]; >> + char buff[80]; > > Oops caught one small nit I should use the correct defines for the > buffer and path sizes here: > > char pid_path[FILENAME_MAX]; > char pid_name[FILENAME_MAX]; > char buff[CGROUP_RULE_MAXLINE]; > > Thanks, > John
Also need to be sure to fclose(proc_mount) (Thanks Mark!) and fix the title cglib->libcg. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel