aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/lxc/namespace.c')
-rw-r--r--src/lxc/namespace.c47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/lxc/namespace.c b/src/lxc/namespace.c
index 6512685..3e6fc3a 100644
--- a/src/lxc/namespace.c
+++ b/src/lxc/namespace.c
@@ -34,8 +34,6 @@
#include "namespace.h"
#include "log.h"
-#include "setns.h"
-
lxc_log_define(lxc_namespace, lxc);
struct clone_arg {
@@ -43,16 +41,6 @@ struct clone_arg {
void *arg;
};
-int setns(int fd, int nstype)
-{
-#ifndef __NR_setns
- errno = ENOSYS;
- return -1;
-#else
- return syscall(__NR_setns, fd, nstype);
-#endif
-}
-
static int do_clone(void *arg)
{
struct clone_arg *clone_arg = arg;
@@ -81,38 +69,3 @@ pid_t lxc_clone(int (*fn)(void *), void *arg, int flags)
return ret;
}
-
-int lxc_attach(pid_t pid)
-{
- char path[MAXPATHLEN];
- char *ns[] = { "pid", "mnt", "net", "ipc", "uts" };
- const int size = sizeof(ns) / sizeof(char *);
- int fd[size];
- int i;
-
- sprintf(path, "/proc/%d/ns", pid);
- if (access(path, X_OK)) {
- ERROR("Does this kernel version support 'attach' ?");
- return -1;
- }
-
- for (i = 0; i < size; i++) {
- sprintf(path, "/proc/%d/ns/%s", pid, ns[i]);
- fd[i] = open(path, O_RDONLY);
- if (fd[i] < 0) {
- SYSERROR("failed to open '%s'", path);
- return -1;
- }
- }
-
- for (i = 0; i < size; i++) {
- if (setns(fd[i], 0)) {
- SYSERROR("failed to set namespace '%s'", ns[i]);
- return -1;
- }
-
- close(fd[i]);
- }
-
- return 0;
-}