added inofficial vc_init_internal_legacy() function
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 14 Oct 2003 18:48:52 +0000 (18:48 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 14 Oct 2003 18:48:52 +0000 (18:48 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@154 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/lib/syscall-legacy.hc

index 79dc78c..d3950b2 100644 (file)
@@ -37,6 +37,7 @@
 #include <errno.h>
 #include <syscall.h>
 #include <asm/unistd.h>
+#include <stdbool.h>
 
 // Here is the trick. We keep a copy of the define, then undef it
 // and then later, we try to locate the value reading /proc/self/status
@@ -78,10 +79,11 @@ static int __NR_chrootsafe=-1;
 static int rev_chrootsafe=-1;
 
 static _syscall1 (int, chrootsafe, const char *, dir)
+
+static bool    is_init = false;
   
 static void init()
 {
-       static int is_init = 0;
        if (!is_init){
                FILE *fin = fopen ("/proc/self/status","r");
                __NR_set_ipv4root_rev0 = def_NR_set_ipv4root;
@@ -128,7 +130,7 @@ static void init()
                        }
                        fclose (fin);
                }
-               is_init = 1;
+               is_init = true;
        }
 }
 
@@ -137,6 +139,21 @@ void vc_init_legacy()
         init();
 }
 
+void vc_init_internal_legacy(int ctx_rev, int ctx_number,
+                            int ipv4_rev, int ipv4_number)
+{      
+  rev_s_context           = ctx_rev;
+  __NR_new_s_context_rev0 = ctx_number;
+
+  rev_ipv4root            = ipv4_rev;
+  __NR_set_ipv4root_rev0  = ipv4_number;
+  __NR_set_ipv4root_rev1  = ipv4_number;
+  __NR_set_ipv4root_rev2  = ipv4_number;
+  __NR_set_ipv4root_rev3  = ipv4_number;
+
+  is_init = true;
+}
+
 static ALWAYSINLINE int
 vc_new_s_context_legacy(int ctx, int remove_cap, int flags)
 {