merged with 0.26.90
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 30 Dec 2003 15:56:40 +0000 (15:56 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 30 Dec 2003 15:56:40 +0000 (15:56 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@509 94cd875c-1c1d-0410-91d2-eb244daf1a30

28 files changed:
util-vserver/compat.h
util-vserver/lib/getctx-compat.hc
util-vserver/lib/getctx-legacy.hc
util-vserver/lib/getctx.c
util-vserver/lib/getversion-internal.hc
util-vserver/lib/getversion.c
util-vserver/lib/getvserverbyctx.c
util-vserver/lib/getvserverctx.c
util-vserver/lib/syscall-compat.hc
util-vserver/lib/syscall-legacy.hc
util-vserver/lib/syscall.c
util-vserver/lib/syscall_rlimit-v11.hc
util-vserver/lib/syscall_rlimit.c
util-vserver/lib/virtual.h
util-vserver/lib/vserver-internal.h
util-vserver/lib/vserver.h
util-vserver/scripts/Makefile-files
util-vserver/scripts/vps.pathsubst
util-vserver/scripts/vserver-legacy
util-vserver/src/.cvsignore
util-vserver/src/ctx-kill.c
util-vserver/src/rpm-fake-resolver.c
util-vserver/src/rpm-fake.c
util-vserver/src/save_ctxinfo.c
util-vserver/src/vlimit.c
util-vserver/src/vserver-stat.c
util-vserver/src/wrappers-vserver.h
util-vserver/tests/getctx.c

index 125d875..a58eaa2 100644 (file)
@@ -54,9 +54,9 @@
 #  define MS_MOVE              8192
 #endif
 
-#ifndef HAVE_CTX_T
+#ifndef HAVE_XID_T
 #include <stdint.h>
-typedef uint32_t               ctx_t;
+typedef uint32_t               xid_t;
 #endif
 
 #if defined(__dietlibc__)
index 96de609..e0dfd0b 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "getctx-legacy.hc"
 
-static inline ALWAYSINLINE ctx_t
+static inline ALWAYSINLINE xid_t
 vc_X_getctx_compat(pid_t pid)
 {
   return vc_X_getctx_legacy(pid);
index 0f18bab..7d52b56 100644 (file)
@@ -30,7 +30,7 @@
 #include <errno.h>
 #include <sys/types.h>
 
-static ctx_t
+static xid_t
 vc_X_getctx_legacy_internal(pid_t pid)
 {
   size_t                       bufsize = utilvserver_getProcEntryBufsize();
@@ -43,10 +43,10 @@ vc_X_getctx_legacy_internal(pid_t pid)
   else        return VC_NOCTX;
 }
 
-static ctx_t
+static xid_t
 vc_X_getctx_legacy(pid_t pid)
 {
-  ctx_t                res;
+  xid_t                res;
   do {
     res = vc_X_getctx_legacy_internal(pid);
   } while (res==VC_NOCTX && errno==EAGAIN);
index 4018133..c8c5b77 100644 (file)
@@ -34,7 +34,7 @@
 
 #include <sys/types.h>
 
-ctx_t
+xid_t
 vc_X_getctx(pid_t pid)
 {
   CALL_VC(CALL_VC_COMPAT(vc_X_getctx, pid),
index 22a3168..4706b0c 100644 (file)
@@ -22,7 +22,6 @@
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
-#include "compat.h"
 
 #include "vserver-internal.h"
 
@@ -32,7 +31,7 @@
 static inline ALWAYSINLINE UNUSED int
 vc_get_version_internal(int cat)
 {
-  return sys_virtual_context(VC_CMD(VERSION, 0, 0), cat, 0);
+  return vserver(VC_CMD(VERSION, 0, 0), cat, 0);
 }
 
 #endif //  H_UTIL_VSERVER_LIB_GETVERSION_INTERNAL_H
index 94e4168..bbdb513 100644 (file)
@@ -26,5 +26,5 @@
 int
 vc_get_version(int cat)
 {
-  return vc_get_version(cat);
+  return vc_get_version_internal(cat);
 }
index 6205e50..5759f1c 100644 (file)
@@ -29,7 +29,7 @@
 #include <unistd.h>
 
 char *
-vc_getVserverByCtx(ctx_t ctx, vcCfgStyle *style, char const *revdir)
+vc_getVserverByCtx(xid_t ctx, vcCfgStyle *style, char const *revdir)
 {
   if (revdir==0) revdir = DEFAULT_PKGSTATEREVDIR;
 
index 3052c7a..774c80f 100644 (file)
@@ -31,7 +31,7 @@
 #include <string.h>
 #include <unistd.h>
 
-static ctx_t
+static xid_t
 getCtxFromFile(char const *pathname)
 {
   int          fd;
@@ -48,7 +48,7 @@ getCtxFromFile(char const *pathname)
   BS;
   char         buf[len+1];
   char         *errptr;
-  ctx_t                res;
+  xid_t                res;
   
   if (TEMP_FAILURE_RETRY(read(fd, buf, len+1))!=len)
     return VC_NOCTX;
@@ -60,7 +60,7 @@ getCtxFromFile(char const *pathname)
   BE;
 }
 
-ctx_t
+xid_t
 vc_getVserverCtx(char const *id, vcCfgStyle style)
 {
   size_t               l1 = strlen(id);
index a3cdcba..fb07d4d 100644 (file)
 #include <unistd.h>
 
 static inline ALWAYSINLINE int
-vc_new_s_context_compat(ctx_t ctx, unsigned int remove_cap, unsigned int flags)
+vc_new_s_context_compat(xid_t ctx, unsigned int remove_cap, unsigned int flags)
 {
   struct vcmd_new_s_context_v1 msg;
   msg.remove_cap = remove_cap;
   msg.flags      = flags;
 
-  return sys_virtual_context(VC_CMD(COMPAT, 1, 1), CTX_USER2KERNEL(ctx), &msg);
+  return vserver(VC_CMD(COMPAT, 1, 1), CTX_USER2KERNEL(ctx), &msg);
 }
 
 static inline ALWAYSINLINE int
@@ -56,7 +56,7 @@ vc_set_ipv4root_compat(uint32_t  bcast, size_t nb, struct vc_ip_mask_pair const
     msg.ip_mask_pair[i].mask = ips[i].mask;
   }
 
-  return sys_virtual_context(VC_CMD(COMPAT, 2, 3), nb, &msg);
+  return vserver(VC_CMD(COMPAT, 2, 3), nb, &msg);
 }
 
 static inline ALWAYSINLINE int
index 198bf0a..7ba077d 100644 (file)
@@ -50,11 +50,41 @@ static int __NR_set_ipv4root_rev2;
 static int __NR_set_ipv4root_rev3;
 static int rev_ipv4root=0;
 
+#if (defined(__pic__) && defined(__i386)) || defined(__hppa__)
+#if defined __dietlibc__
+extern long int syscall (long int __sysno, ...);
+#endif
+
+inline static int
+set_ipv4root_rev0(unsigned long ip)
+{
+  return syscall(__NR_set_ipv4root_rev0, ip);
+}
 
-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_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
+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
 
 static int def_NR_new_s_context = 273;
 #undef __NR_new_s_context
@@ -62,8 +92,16 @@ 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)
+#if defined(__pic__) && defined(__i386)
+inline static int
+new_s_context_rev0(int newctx, int remove_cap, int flags)
+{
+  return syscall(__NR_new_s_context_rev0, newctx, remove_cap, flags);
+}
+#else
+inline 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)
+#endif
 
 #if 0
 #undef __NR_set_ctxlimit
@@ -73,12 +111,6 @@ 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;
-
-static _syscall1 (int, chrootsafe, const char *, dir)
-
 static bool    is_init = false;
 
 #include "utils-legacy.h"
@@ -129,16 +161,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;
@@ -238,19 +260,3 @@ vc_set_ipv4root_legacy(uint32_t  bcast, size_t nb, struct vc_ip_mask_pair const
 
   return vc_set_ipv4root_legacy_internal(ip, nb, bcast, mask);
 }
-
-static ALWAYSINLINE int
-vc_chrootsafe_legacy (const char *dir)
-{
-       init();
-       if (rev_chrootsafe == -1){
-               vc_tell_unsafe_chroot();
-               return chroot(dir);
-       }else if (rev_chrootsafe == 0){
-               return chrootsafe (dir);
-       }else{
-               WRITE_MSG(2, "chrootsafe: kernel supports wrong version, application expects version 0\n");
-       }
-       errno = EINVAL;
-       return -1;
-}
index ba995ba..52134c8 100644 (file)
@@ -43,7 +43,7 @@
 #if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY)
 
 int
-vc_new_s_context(ctx_t ctx, unsigned int remove_cap, unsigned int flags)
+vc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags)
 {
   CALL_VC(CALL_VC_COMPAT(vc_new_s_context, ctx, remove_cap, flags),
          CALL_VC_LEGACY(vc_new_s_context, ctx, remove_cap, flags));
@@ -56,11 +56,4 @@ vc_set_ipv4root(uint32_t  bcast, size_t nb, struct vc_ip_mask_pair const *ips)
          CALL_VC_LEGACY(vc_set_ipv4root, bcast, nb, ips));
 }
 
-int
-vc_chrootsafe(char const *dir)
-{
-  CALL_VC(CALL_VC_COMPAT(vc_chrootsafe, dir),
-         CALL_VC_LEGACY(vc_chrootsafe, dir));
-}
-
 #endif
index 8148ba5..46c35aa 100644 (file)
    ((LIMIT)==VC_LIM_KEEP)     ? CRLIM_KEEP     : (LIMIT))
 
 static inline ALWAYSINLINE int
-vc_get_rlimit_v11(ctx_t ctx, int resource, struct vc_rlimit *lim)
+vc_get_rlimit_v11(xid_t ctx, int resource, struct vc_rlimit *lim)
 {
   struct vcmd_ctx_rlimit_v0    vc_lim;
   int                          rc;
 
   vc_lim.id        = resource;
-  rc = sys_virtual_context(VC_CMD(RLIMIT, 1, 0), CTX_USER2KERNEL(ctx), &vc_lim);
+  rc = vserver(VC_CMD(RLIMIT, 1, 0), CTX_USER2KERNEL(ctx), &vc_lim);
   lim->min  = KERN2USR(vc_lim.minimum);
   lim->soft = KERN2USR(vc_lim.softlimit);
   lim->hard = KERN2USR(vc_lim.maximum);
@@ -44,7 +44,7 @@ vc_get_rlimit_v11(ctx_t ctx, int resource, struct vc_rlimit *lim)
 }
 
 static inline ALWAYSINLINE int
-vc_set_rlimit_v11(ctx_t ctx, int resource, struct vc_rlimit const *lim)
+vc_set_rlimit_v11(xid_t ctx, int resource, struct vc_rlimit const *lim)
 {
   struct vcmd_ctx_rlimit_v0    vc_lim;
 
@@ -53,16 +53,16 @@ vc_set_rlimit_v11(ctx_t ctx, int resource, struct vc_rlimit const *lim)
   vc_lim.softlimit = USR2KERN(lim->soft);
   vc_lim.maximum   = USR2KERN(lim->hard);
 
-  return sys_virtual_context(VC_CMD(RLIMIT, 2, 0), CTX_USER2KERNEL(ctx), &vc_lim);
+  return vserver(VC_CMD(RLIMIT, 2, 0), CTX_USER2KERNEL(ctx), &vc_lim);
 }
 
 static inline ALWAYSINLINE int
-vc_get_rlimit_mask_v11(ctx_t ctx, int UNUSED tmp, struct vc_rlimit_mask *lim)
+vc_get_rlimit_mask_v11(xid_t ctx, int UNUSED tmp, struct vc_rlimit_mask *lim)
 {
   struct vcmd_ctx_rlimit_v0    vc_lim;
   int                          rc;
 
-  rc = sys_virtual_context(VC_CMD(RLIMIT, 3, 0), CTX_USER2KERNEL(ctx), &vc_lim);
+  rc = vserver(VC_CMD(RLIMIT, 3, 0), CTX_USER2KERNEL(ctx), &vc_lim);
 
   lim->min  = vc_lim.minimum;
   lim->soft = vc_lim.softlimit;
index 58766c0..3a64446 100644 (file)
 #if defined (VC_ENABLE_API_V11)
 
 int
-vc_get_rlimit(ctx_t ctx, int resource, struct vc_rlimit *lim)
+vc_get_rlimit(xid_t ctx, int resource, struct vc_rlimit *lim)
 {
   CALL_VC(CALL_VC_V11(vc_get_rlimit, ctx, resource, lim));
 }
 
 int
-vc_set_rlimit(ctx_t ctx, int resource, struct vc_rlimit const *lim)
+vc_set_rlimit(xid_t ctx, int resource, struct vc_rlimit const *lim)
 {
   CALL_VC(CALL_VC_V11(vc_set_rlimit, ctx, resource, lim));
 }
 
 int
-vc_get_rlimit_mask(ctx_t ctx, struct vc_rlimit_mask *lim)
+vc_get_rlimit_mask(xid_t ctx, struct vc_rlimit_mask *lim)
 {
   CALL_VC(CALL_VC_V11(vc_get_rlimit_mask, ctx, 0, lim));
 }
index ac6a3d7..73538fe 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef _LINUX_VIRTUAL_H
 #define _LINUX_VIRTUAL_H
 
+
+#define NB_IPV4ROOT     16
+
+
 #define VC_CATEGORY(c)         (((c) >> 24) & 0x3F)
 #define VC_COMMAND(c)          (((c) >> 16) & 0xFF)
 #define VC_VERSION(c)          ((c) & 0xFFF)
@@ -10,7 +14,7 @@
 
 /*
 
-  Syscall Matrix V2.2
+  Syscall Matrix V2.3
 
          |VERSION|CREATE |MODIFY |MIGRATE|CONTROL|EXPERIM| |SPECIAL|SPECIAL|
          |STATS  |DESTROY|ALTER  |CHANGE |LIMIT  |TEST   | |       |       |
 
 */
 
-#define        VC_CAT_VERSION          0
+#define VC_CAT_VERSION         0
        
+#define VC_CAT_PROCTRL         12
+
 #define VC_CAT_RLIMIT          60
 
 #define VC_CAT_SYSTEST         61
-#define        VC_CAT_COMPAT           63
+#define VC_CAT_COMPAT          63
        
 /*  interface version */
 
-#define VCI_VERSION            0x00010001
+#define VCI_VERSION            0x00010004
 
 
 
@@ -73,8 +79,6 @@ struct  vcmd_new_s_context_v1 {
        uint32_t flags;
 };
 
-#define        NB_IPV4ROOT 16
-
 struct  vcmd_set_ipv4root_v3 {
        /* number of pairs in id */
        uint32_t broadcast;
@@ -84,15 +88,23 @@ struct  vcmd_set_ipv4root_v3 {
        } ip_mask_pair[NB_IPV4ROOT];
 };
 
+/*  context signalling */
+
+#define VCMD_ctx_kill          VC_CMD(PROCTRL, 1, 0)
+
+struct  vcmd_ctx_kill_v0 {
+       int32_t pid;
+       int32_t sig;
+};
 
 /*  rlimit vserver commands */
 
-#define VCMD_get_rlimit                VC_CMD(RLIMIT, 1, 0)
-#define VCMD_set_rlimit                VC_CMD(RLIMIT, 2, 0)
-#define VCMD_get_rlimit_mask   VC_CMD(RLIMIT, 3, 0)
+#define VCMD_get_rlimit                VC_CMD(RLIMIT, 1, 0)
+#define VCMD_set_rlimit                VC_CMD(RLIMIT, 2, 0)
+#define VCMD_get_rlimit_mask   VC_CMD(RLIMIT, 3, 0)
 
 struct  vcmd_ctx_rlimit_v0 {
-       uint32_t id;
+       uint32_t id;
        uint64_t minimum;
        uint64_t softlimit;
        uint64_t maximum;
@@ -104,8 +116,8 @@ struct  vcmd_ctx_rlimit_mask_v0 {
        uint32_t maximum;
 };
 
-#define CRLIM_INFINITY         (~0ULL)
-#define CRLIM_KEEP             (~1ULL)
+#define CRLIM_INFINITY         (~0ULL)
+#define CRLIM_KEEP             (~1ULL)
 
 
 #endif /* _LINUX_VIRTUAL_H */
index da7d062..601f687 100644 (file)
 #include <syscall.h>
 #include <errno.h>
 #include <stdint.h>
+#include <sys/syscall.h>
+#include <unistd.h>
 
-#ifndef __NR_sys_virtual_context
-#  define __NR_sys_virtual_context     273
+#include "internal.h"
+
+#ifndef __NR_vserver
+#  define __NR_vserver 273
 #endif
 
 #define VC_PREFIX      0)
@@ -72,7 +76,7 @@
 #if 1
 #  define CTX_KERNEL2USER(X)   (((X)==(uint32_t)(-1)) ? VC_NOCTX   : \
                                 ((X)==(uint32_t)(-2)) ? VC_SAMECTX : \
-                                (ctx_t)(X))
+                                (xid_t)(X))
 
 #  define CTX_USER2KERNEL(X)   (((X)==VC_RANDCTX) ? (uint32_t)(-1) : \
                                 ((X)==VC_SAMECTX) ? (uint32_t)(-2) : \
 #endif
 
 
-#ifndef HAVE_SYS_VIRTUAL_CONTEXT
-static UNUSED
-_syscall3(int, sys_virtual_context,
+#ifndef HAVE_VSERVER
+#if defined(__pic__) && defined(__i386)
+inline static UNUSED ALWAYSINLINE
+int vserver(uint32_t cmd, uint32_t id, void *data)
+{
+#if defined __dietlibc__
+  extern long int syscall (long int __sysno, ...);
+#endif
+  return syscall(__NR_vserver, cmd, id, data);
+}
+#else
+inline static UNUSED ALWAYSINLINE
+_syscall3(int, vserver,
          uint32_t, cmd, uint32_t, id, void *, data)
 #endif
+#endif
 
 #endif //  H_VSERVER_SYSCALL_INTERNAL_H
index 5a120ee..d45dc9d 100644 (file)
 #include <sys/types.h>
 
 /** the value which is returned in error-case (no ctx found) */
-#define VC_NOCTX               ((ctx_t)(-1))
+#define VC_NOCTX               ((xid_t)(-1))
 /** the value which means a random (the next free) ctx */
-#define VC_RANDCTX             ((ctx_t)(-1))
+#define VC_RANDCTX             ((xid_t)(-1))
 /** the value which means the current ctx */
-#define VC_SAMECTX             ((ctx_t)(-2))
+#define VC_SAMECTX             ((xid_t)(-2))
 
 #define VC_LIM_INFINITY                (~0ULL)
 #define VC_LIM_KEEP            (~1ULL)
@@ -110,17 +110,15 @@ extern "C" {
     /** Puts current process into context <ctx>, removes the given caps and
      *  sets flags.
      *  Special values for ctx are
-     *  - -2 which means the current context (just for changing caps and flags)
-     *  - -1 which means the next free context; this value can be used by
-     *    ordinary users also */
-  int  vc_new_s_context(ctx_t ctx, unsigned int remove_cap, unsigned int flags);
+     *  - VC_SAMECTX  which means the current context (just for changing caps and flags)
+     *  - VC_RANDCTX  which means the next free context; this value can be used by
+     *                ordinary users also */
+  int  vc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags);
 
     /** Sets the ipv4root information.
      *  \precondition: nb<16 */
   int  vc_set_ipv4root(uint32_t  bcast, size_t nb, struct vc_ip_mask_pair const *ips);
   
-  int  vc_chrootsafe(char const *dir);
-
   /* rlimit related functions */
   typedef uint64_t     vc_limit_t;
   
@@ -137,13 +135,20 @@ extern "C" {
       uint32_t hard;
   };
 
-  int  vc_get_rlimit(ctx_t ctx, int resource, struct vc_rlimit *lim);
-  int  vc_set_rlimit(ctx_t ctx, int resource, struct vc_rlimit const *lim);
-  int  vc_get_rlimit_mask(ctx_t ctx, struct vc_rlimit_mask *lim);
+  int  vc_get_rlimit(xid_t ctx, int resource, struct vc_rlimit *lim);
+  int  vc_set_rlimit(xid_t ctx, int resource, struct vc_rlimit const *lim);
+  int  vc_get_rlimit_mask(xid_t ctx, struct vc_rlimit_mask *lim);
+
+
+  /** sends a signal to a context/pid
+      Special values for pid are:
+      * -1   which means every process in ctx except the init-process
+      *  0   which means every process in ctx inclusive the init-process */
+  int  vc_ctx_kill(xid_t ctx, pid_t pid, int sig);
 
 
     /** Returns the context of the given process. pid==0 means the current process. */
-  ctx_t        vc_X_getctx(pid_t pid);
+  xid_t        vc_X_getctx(pid_t pid);
 
     /** Returns the pid of the 'init' process */
   pid_t        vc_X_getinitpid(pid_t pid);
@@ -172,13 +177,13 @@ extern "C" {
 
   /** Returns the ctx of the given vserver, or VC_NOCTX if vserver is not
    *  running */
-  ctx_t                vc_getVserverCtx(char const *id, vcCfgStyle style);
+  xid_t                vc_getVserverCtx(char const *id, vcCfgStyle style);
 
   /** Resolves the cfg-path of the vserver owning the given ctx. 'revdir' will
       be used as the directory holding the mapping-links; when NULL, the
       default value will be assumed.  The result will be allocated and must be
       freed by the caller. */
-  char *       vc_getVserverByCtx(ctx_t ctx, /*@null@*/vcCfgStyle *style,
+  char *       vc_getVserverByCtx(xid_t ctx, /*@null@*/vcCfgStyle *style,
                                   /*@null@*/char const *revdir);
   
 #ifdef __cplusplus
index a0a58fc..a9d9d25 100644 (file)
@@ -23,7 +23,6 @@ scripts_OPTIONS_EXEMPT                =  scripts/distrib-info \
                                   scripts/vrpm-preload \
                                   scripts/save_s_context \
                                   scripts/vservers.grabinfo.sh \
-                                  scripts/vsysvwrapper \
                                   scripts/vps \
                                   scripts/vpstree \
                                   scripts/vserver-copy \
@@ -52,9 +51,10 @@ scripts_pkglib_src_SCRPTS    =  scripts/distrib-info \
                                   scripts/vserver-build \
                                   scripts/vserver-legacy \
                                   scripts/vserverkillall \
-                                  scripts/vservers.grabinfo.sh \
-                                  scripts/vsysvwrapper
+                                  scripts/vservers.grabinfo.sh
 
+scripts_legacy_src_SCRPTS      =
+scripts_legacy_gen_SCRPTS      =
 
 scripts_sbin_src_PRGS          =  scripts/vapt-get \
                                   scripts/vpstree \
@@ -74,6 +74,7 @@ scripts_subst_SRCS            =  scripts/util-vserver-vars.pathsubst \
 scripts_sbin_PRGS              =  $(scripts_sbin_src_PRGS) $(scripts_sbin_gen_PRGS)
 scripts_sbincfg_DTA            =  $(scripts_sbincfg_gen_DTA)
 scripts_pkglib_SCRPTS          =  $(scripts_pkglib_src_SCRPTS)
+scripts_legacy_SCRPTS          =  $(scripts_legacy_src_SCRPTS) $(scripts_legacy_gen_SCRPTS)
 scripts_pkglib_DTA             =  $(scripts_pkglib_src_DTA) $(scripts_pkglib_gen_DTA)
 
 scripts_CLEANFILES             =  $(scripts_pkglib_gen_DTA) \
@@ -82,6 +83,7 @@ scripts_CLEANFILES            =  $(scripts_pkglib_gen_DTA) \
 
 scripts_XTRAS                  =  $(scripts_pkglib_src_DTA) \
                                   $(scripts_pkglib_src_SCRPTS) \
+                                  $(scripts_legacy_src_SCRPTS) \
                                   $(scripts_sbin_src_PRGS) \
                                   $(scripts_subst_SRCS)
 
index 195ede0..ea32a37 100755 (executable)
@@ -48,7 +48,7 @@ if ($context != 1) {
 } 
 
 
-if (! open PS, "ps $ARGV[0]|") {
+if (! open PS, "ps @ARGV|") {
    print "Can not execute ps\n";
    exit;
 }
index f4d3405..39fe4e6 100755 (executable)
@@ -41,7 +41,7 @@ mountproc()
        mkdir -p $1/proc $1/dev/pts
        if [ ! -d $1/proc/1 ] ; then
                mount -t proc none $1/proc
-               mount -t devpts none $1/dev/pts
+               mount -t devpts -o gid=5,mode=0620 none $1/dev/pts
        fi
 }
 umountproc()
@@ -468,6 +468,8 @@ elif [ "$2" = "start" ] ; then
                        STARTCMD="/etc/init.d/rc $INITDEFAULT"
                elif [ -x $DEFAULT_VSERVERDIR/$1/usr/bin/emerge ] ; then
                        STARTCMD="/sbin/rc default"
+               elif [ -x $DEFAULT_VSERVERDIR/$1/etc/rc.d/rc.M ] ; then
+                       STARTCMD="/etc/rc.d/rc.M"                       
                fi
 
                DISCONNECT=
@@ -583,6 +585,8 @@ elif [ "$2" = "stop" ] ; then
                        STOPCMD="/etc/init.d/rc 6"
                elif [ -x $DEFAULT_VSERVERDIR/$1/usr/bin/emerge ] ; then
                        STOPCMD="/sbin/rc shutdown"
+               elif [ -x $DEFAULT_VSERVERDIR/$1/etc/rc.d/rc.6 ] ; then
+                       STOPCMD="/etc/rc.d/rc.6"
                fi
 
                for f in $S_FLAGS dummy
index ae47b4f..ab27bf9 100644 (file)
@@ -29,6 +29,7 @@ vbuild
 vcheck
 vdu
 vfiles
+vkill
 vlimit
 vreboot
 vserver-stat
index dcf1d37..0ec7090 100644 (file)
@@ -50,7 +50,7 @@
 
 struct ArgInfo {
     enum { tpUNSET, tpCTX, tpPID }     type;
-    ctx_t              ctx;
+    xid_t              ctx;
     pid_t              pid;
     unsigned int       interval;
     bool               shutdown;
@@ -244,12 +244,12 @@ childFunc(void *args_v)
   return 0;
 }
   
-static ctx_t
+static xid_t
 determineContext(pid_t pid)
 {
   int          fd[2];
   pid_t                chld;
-  ctx_t                res;
+  xid_t                res;
   
   Epipe(fd);
   chld = Efork();
index 6af3c67..4e5bc30 100644 (file)
@@ -37,7 +37,7 @@
 int wrapper_exit_code = 1;
 
 struct ArgInfo {
-    ctx_t              ctx;
+    xid_t              ctx;
     uid_t              uid;
     gid_t              gid;
     bool               do_fork;
index 1c2da07..4c1961f 100644 (file)
@@ -68,7 +68,7 @@
 #define DBG_VERBOSE2   (0x2000 | DBG_VERBOSE1)
 
 static char const *    ctx_s = 0;
-static ctx_t           ctx   = VC_NOCTX;
+static xid_t           ctx   = VC_NOCTX;
 static uint32_t                caps  = ~0;
 static int             flags = 0;
 static char const *    mnts  = 0;
index 24d77f8..f46ec12 100644 (file)
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
   char         dstfile[PATH_MAX];
   int          fd;
   char         buf[sizeof(int)*3+2];
-  ctx_t                ctx;
+  xid_t                ctx;
   ssize_t      len;
   ssize_t      len1 = strlen(argv[1]);
 
index 02eb6ec..c4351ea 100644 (file)
@@ -169,7 +169,7 @@ int main (int argc, char *argv[])
   int                  set_mask = 0;
   struct vc_rlimit     limits[32];
   bool                 show_all = false;
-  ctx_t                        ctx      = VC_SAMECTX;
+  xid_t                        ctx      = VC_SAMECTX;
 
   {
     size_t             i;
index 58e64db..9c6c398 100644 (file)
@@ -85,7 +85,7 @@ char *process_name;
 
 struct ArgInfo {
     enum { tpUNSET, tpCTX, tpPID }     type;
-    ctx_t              ctx;
+    xid_t              ctx;
     pid_t              pid;
     unsigned int       interval;
     bool               shutdown;
index 0b40c57..82bc2c0 100644 (file)
 #include <vserver.h>
 
 inline static UNUSED void
-Evc_new_s_context(ctx_t ctx, unsigned int remove_cap, unsigned int flags)
+Evc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags)
 {
   FatalErrnoError(vc_new_s_context(ctx,remove_cap,flags)==-1,
                  "vc_new_s_context()");
 }
 
-inline static UNUSED ctx_t
+inline static UNUSED xid_t
 Evc_X_getctx(pid_t pid)
 {
-  register ctx_t       res = vc_X_getctx(pid);
+  register xid_t       res = vc_X_getctx(pid);
   FatalErrnoError(res==VC_NOCTX, "vc_X_getctx()");
   return res;
 }
index 4033a83..15657c3 100644 (file)
@@ -31,7 +31,7 @@
 int main(int argc, char *argv[])
 {
   char         buf[sizeof(int)*3+2];
-  ctx_t                ctx;
+  xid_t                ctx;
   
   if (argc==1) ctx = vc_X_getctx(0);
   else         ctx = vc_X_getctx(atoi(argv[1]));