From c53d17ebddae48cfcc4c890da4769ec33c76ada7 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Thu, 16 Oct 2003 14:00:58 +0000 Subject: [PATCH] removed all traces of usage git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@174 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/lib/syscall-legacy.hc | 118 +++++++++++++++++++++++-------------- 1 file changed, 73 insertions(+), 45 deletions(-) diff --git a/util-vserver/lib/syscall-legacy.hc b/util-vserver/lib/syscall-legacy.hc index d3950b2..be8983e 100644 --- a/util-vserver/lib/syscall-legacy.hc +++ b/util-vserver/lib/syscall-legacy.hc @@ -31,7 +31,6 @@ */ #include "safechroot-internal.hc" -#include #include #include #include @@ -81,55 +80,85 @@ static int rev_chrootsafe=-1; static _syscall1 (int, chrootsafe, const char *, dir) static bool is_init = false; + +#include "utils-legacy.h" + +#ifndef WRITE_MSG +# define WRITE_MSG(FD,X) (void)(write(FD,X,sizeof(X)-1)) +#endif + + +static bool +getNumRevPair(char const *str, int *num, int *rev) +{ + char const * blank_pos = strchr(str, ' '); + char const * eol_pos = strchr(str, '\n'); + + *num = atoi(str); + if (*num==0) return false; + + if (blank_pos!=0 && eol_pos!=0 && blank_pos=2){ - if (strcmp(title,"__NR_set_ipv4root:")==0){ - __NR_set_ipv4root_rev0 = num; - __NR_set_ipv4root_rev1 = num; - __NR_set_ipv4root_rev2 = num; - __NR_set_ipv4root_rev3 = num; - if (strncmp(rev,"rev",3)==0){ - rev_ipv4root = atoi(rev+3); - } -#if 0 - }else if (strcmp(title,"__NR_set_ctxlimit:")==0){ - __NR_set_ctxlimit = num; - if (strncmp(rev,"rev",3)==0){ - rev_set_ctxlimit = atoi(rev+3); - } -#endif - }else if (strcmp(title,"__NR_chrootsafe:")==0){ - __NR_chrootsafe = num; - if (strncmp(rev,"rev",3)==0){ - rev_chrootsafe = atoi(rev+3); - } - }else if (strcmp(title,"__NR_new_s_context:")==0){ - __NR_new_s_context_rev0 = num; - //__NR_new_s_context_rev1 = num; - if (strncmp(rev,"rev",3)==0){ - rev_s_context = atoi(rev+3); - } - } - } - } - fclose (fin); - } + + while (!init_internal() && errno==EAGAIN) {} + is_init = true; } } @@ -178,12 +207,12 @@ vc_set_ipv4root_legacy_internal ( init(); if (rev_ipv4root == 0){ if (nb > 1){ - fprintf (stderr,"set_ipv4root: Several IP number specified, but this kernel only supports one. Ignored\n"); + WRITE_MSG(2,"set_ipv4root: Several IP number specified, but this kernel only supports one. Ignored\n"); } return set_ipv4root_rev0 (ip[0]); }else if (rev_ipv4root == 1){ if (nb > 1){ - fprintf (stderr,"set_ipv4root: Several IP number specified, but this kernel only supports one. Ignored\n"); + WRITE_MSG(2,"set_ipv4root: Several IP number specified, but this kernel only supports one. Ignored\n"); } return set_ipv4root_rev1 (ip[0],bcast); }else if (rev_ipv4root == 2){ @@ -220,8 +249,7 @@ vc_chrootsafe_legacy (const char *dir) }else if (rev_chrootsafe == 0){ return chrootsafe (dir); }else{ - fprintf (stderr,"chrootsafe: kernel support version %d, application expects version 0\n" - ,rev_chrootsafe); + WRITE_MSG(2, "chrootsafe: kernel supports wrong version, application expects version 0\n"); } errno = EINVAL; return -1; -- 1.8.1.5