Commit 28f2ae83 by Christian Seiler Committed by Daniel Lezcano

cgroup: Make cgroup_attach a public function

lxc-attach needs to be able to attach a process to specific cgroup, so cgroup_attach is renamed to lxc_cgroup_attach and now also defined in the header file. Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 3ea24eb8
...@@ -170,7 +170,7 @@ static int cgroup_enable_clone_children(const char *path) ...@@ -170,7 +170,7 @@ static int cgroup_enable_clone_children(const char *path)
return ret; return ret;
} }
static int cgroup_attach(const char *path, pid_t pid) int lxc_cgroup_attach(const char *path, pid_t pid)
{ {
FILE *f; FILE *f;
char tasks[MAXPATHLEN]; char tasks[MAXPATHLEN];
...@@ -250,7 +250,7 @@ static int lxc_one_cgroup_create(const char *name, ...@@ -250,7 +250,7 @@ static int lxc_one_cgroup_create(const char *name,
} }
/* Let's add the pid to the 'tasks' file */ /* Let's add the pid to the 'tasks' file */
if (cgroup_attach(cgname, pid)) { if (lxc_cgroup_attach(cgname, pid)) {
SYSERROR("failed to attach pid '%d' to '%s'", pid, cgname); SYSERROR("failed to attach pid '%d' to '%s'", pid, cgname);
rmdir(cgname); rmdir(cgname);
return -1; return -1;
......
...@@ -30,5 +30,6 @@ extern int lxc_cgroup_create(const char *name, pid_t pid); ...@@ -30,5 +30,6 @@ extern int lxc_cgroup_create(const char *name, pid_t pid);
extern int lxc_cgroup_destroy(const char *name); extern int lxc_cgroup_destroy(const char *name);
extern int lxc_cgroup_path_get(char **path, const char *subsystem, const char *name); extern int lxc_cgroup_path_get(char **path, const char *subsystem, const char *name);
extern int lxc_cgroup_nrtasks(const char *name); extern int lxc_cgroup_nrtasks(const char *name);
extern int lxc_cgroup_attach(const char *path, pid_t pid);
extern int lxc_ns_is_mounted(void); extern int lxc_ns_is_mounted(void);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment