X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Flib%2Fsyscall-legacy.hc;h=f05daeeb596f9d7e7dbd99b42f00376fcf3e15db;hb=a316ca4686f3dc7ea7382bfb5d48ed296b5c1140;hp=be8983e79052b2fe0ae852cde882816873711a9b;hpb=c53d17ebddae48cfcc4c890da4769ec33c76ada7;p=util-vserver.git diff --git a/util-vserver/lib/syscall-legacy.hc b/util-vserver/lib/syscall-legacy.hc index be8983e..f05daee 100644 --- a/util-vserver/lib/syscall-legacy.hc +++ b/util-vserver/lib/syscall-legacy.hc @@ -50,34 +50,58 @@ static int __NR_set_ipv4root_rev2; static int __NR_set_ipv4root_rev3; static int rev_ipv4root=0; +#ifdef ENSC_SYSCALL_TRADITIONAL +# if defined __dietlibc__ +extern long int syscall (long int __sysno, ...); +# endif -static _syscall1(int, set_ipv4root_rev0, unsigned long, ip) -static _syscall2(int, set_ipv4root_rev1, unsigned long, ip, unsigned long, bcast) -static _syscall3(int, set_ipv4root_rev2, unsigned long *, ip, int, nb, unsigned long, bcast) -static _syscall4(int, set_ipv4root_rev3, unsigned long *, ip, int, nb, unsigned long, bcast, unsigned long *, mask) +inline static int +set_ipv4root_rev0(unsigned long ip) +{ + return syscall(__NR_set_ipv4root_rev0, ip); +} + +inline static int +set_ipv4root_rev1(unsigned long ip, unsigned long bcast) +{ + return syscall(__NR_set_ipv4root_rev1, ip, bcast); +} + +inline static int +set_ipv4root_rev2(unsigned long *ip, int nb, unsigned long bcast) +{ + return syscall(__NR_set_ipv4root_rev2, ip, nb, bcast); +} + +inline static int +set_ipv4root_rev3(unsigned long *ip, int nb, unsigned long bcast, unsigned long * mask) +{ + return syscall(__NR_set_ipv4root_rev3, ip, nb, bcast, mask); +} + +#else // ENSC_SYSCALL_TRADITIONAL +inline static _syscall1(int, set_ipv4root_rev0, unsigned long, ip) +inline static _syscall2(int, set_ipv4root_rev1, unsigned long, ip, unsigned long, bcast) +inline static _syscall3(int, set_ipv4root_rev2, unsigned long *, ip, int, nb, unsigned long, bcast) +inline static _syscall4(int, set_ipv4root_rev3, unsigned long *, ip, int, nb, unsigned long, bcast, unsigned long *, mask) +#endif // ENSC_SYSCALL_TRADITIONAL static int def_NR_new_s_context = 273; #undef __NR_new_s_context static int __NR_new_s_context_rev0; - //static int __NR_new_s_context_rev1; static int rev_s_context=0; -static _syscall3(int, new_s_context_rev0, int, newctx, int, remove_cap, int, flags) - //static _syscall4(int, new_s_context_rev1, int, nbctx, int *, ctxs, int, remove_cap, int, flags) -#if 0 -#undef __NR_set_ctxlimit -static int __NR_set_ctxlimit=-1; -static int rev_set_ctxlimit=-1; - -static _syscall2 (int, set_ctxlimit, int, resource, long, limit) -#endif - -#undef __NR_chrootsafe -static int __NR_chrootsafe=-1; -static int rev_chrootsafe=-1; +#ifdef ENSC_SYSCALL_TRADITIONAL +inline static xid_t +new_s_context_rev0(int newctx, int remove_cap, int flags) +{ + return syscall(__NR_new_s_context_rev0, newctx, remove_cap, flags); +} +#else // ENSC_SYSCALL_TRADITIONAL +inline static _syscall3(int, new_s_context_rev0, int, newctx, int, remove_cap, int, flags) +#endif // ENSC_SYSCALL_TRADITIONAL -static _syscall1 (int, chrootsafe, const char *, dir) static bool is_init = false; @@ -129,16 +153,6 @@ static bool init_internal() __NR_set_ipv4root_rev3 = num; } -#if 0 - SET_TAG_POS("\n__NR_set_ctxlimit: "); - if ( pos!=0 && getNumRevPair(pos, &num, &rev_set_ctxlimit) ) - __NR_set_ctxlimit = num; -#endif - - SET_TAG_POS("\n__NR_chrootsafe: "); - if ( pos!=0 && getNumRevPair(pos, &num, &rev_chrootsafe) ) - __NR_chrootsafe = num; - SET_TAG_POS("\n__NR_new_s_context: "); if ( pos!=0 && getNumRevPair(pos, &num, &rev_s_context) ) __NR_new_s_context_rev0 = num; @@ -183,16 +197,16 @@ void vc_init_internal_legacy(int ctx_rev, int ctx_number, is_init = true; } -static ALWAYSINLINE int +static ALWAYSINLINE xid_t vc_new_s_context_legacy(int ctx, int remove_cap, int flags) { - int ret = -1; + xid_t ret = -1; init(); if (rev_s_context == 0){ return new_s_context_rev0(ctx, remove_cap, flags); }else{ errno = -ENOSYS; - ret = -1; + ret = VC_NOCTX; } return ret; } @@ -229,7 +243,7 @@ vc_set_ipv4root_legacy(uint32_t bcast, size_t nb, struct vc_ip_mask_pair const { unsigned long ip[nb]; unsigned long mask[nb]; - size_t i; + size_t i; for (i=0; i