merge with 0.30.213
[util-vserver.git] / lib / syscall-compat.hc
index 306fffb..5f69384 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: syscall-compat.hc,v 1.1.4.7 2003/12/30 13:45:57 ensc Exp $    --*- c++ -*--
+// $Id: syscall-compat.hc 1450 2004-04-14 23:21:23Z ensc $    --*- c++ -*--
 
 // Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
 //  
 #include "compat.h"
 
 #include "safechroot-internal.hc"
-
 #include "vserver.h"
-#include "vserver-internal.h"
 
 #include <unistd.h>
 
-static inline ALWAYSINLINE int
+static inline ALWAYSINLINE xid_t
 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 vserver(VC_CMD(COMPAT, 1, 1), CTX_USER2KERNEL(ctx), &msg);
+  return vserver(VCMD_new_s_context, CTX_USER2KERNEL(ctx), &msg);
 }
 
 static inline ALWAYSINLINE int
@@ -44,24 +42,17 @@ vc_set_ipv4root_compat(uint32_t  bcast, size_t nb, struct vc_ip_mask_pair const
   struct vcmd_set_ipv4root_v3  msg;
   size_t                       i;
 
-  if (nb>=NB_IPV4ROOT) {
-    errno = -EINVAL;
+  if (nb>NB_IPV4ROOT) {
+    errno = -EOVERFLOW;
     return -1;
   }
 
   msg.broadcast = bcast;
 
   for (i=0; i<nb; ++i) {
-    msg.ip_mask_pair[i].ip   = ips[i].ip;
-    msg.ip_mask_pair[i].mask = ips[i].mask;
+    msg.nx_mask_pair[i].ip   = ips[i].ip;
+    msg.nx_mask_pair[i].mask = ips[i].mask;
   }
 
-  return vserver(VC_CMD(COMPAT, 2, 3), nb, &msg);
-}
-
-static inline ALWAYSINLINE int
-vc_chrootsafe_compat(char const *dir)
-{
-  vc_tell_unsafe_chroot();
-  return chroot(dir);
+  return vserver(VCMD_set_ipv4root, nb, &msg);
 }