From c9ddd23f1ed70ce665df990be26ee61bd708c64e Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Tue, 14 Oct 2003 18:48:52 +0000 Subject: [PATCH] added inofficial vc_init_internal_legacy() function git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@154 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/lib/syscall-legacy.hc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/util-vserver/lib/syscall-legacy.hc b/util-vserver/lib/syscall-legacy.hc index 79dc78c..d3950b2 100644 --- a/util-vserver/lib/syscall-legacy.hc +++ b/util-vserver/lib/syscall-legacy.hc @@ -37,6 +37,7 @@ #include #include #include +#include // 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) { -- 1.8.1.5