lib/syscall_rlimit-v11.hc \
lib/syscall_kill.c \
lib/syscall_kill-v11.hc
-lib_v13_SRCS = lib/syscall_ctxmigrate.c \
- lib/syscall_ctxmigrate-v13.hc \
- lib/syscall_ctxcreate.c \
+lib_v13_SRCS = lib/syscall_ctxcreate.c \
lib/syscall_ctxcreate-v13.hc \
+ lib/syscall_ctxmigrate.c \
+ lib/syscall_ctxmigrate-v13.hc \
lib/syscall_enternamespace.c \
lib/syscall_enternamespace-v13.hc \
lib/syscall_setnamespace.c \
lib/syscall_setiattr.c \
lib/syscall_setiattr-fscompat.hc \
lib/syscall_setiattr-v13.hc \
+ lib/syscall_gettasknid.c \
+ lib/syscall_gettasknid-net.hc \
lib/syscall_gettaskxid.c \
lib/syscall_gettaskxid-v13.hc \
lib/syscall_gettaskxid-oldproc.hc \
+ lib/syscall_getnxinfo.c \
+ lib/syscall_getnxinfo-nid.hc \
lib/syscall_getvxinfo.c \
lib/syscall_getvxinfo-v13.hc \
lib/syscall_getvxinfo-oldproc.hc \
lib/syscall_getccaps-v13.hc \
lib/syscall_getcflags.c \
lib/syscall_getcflags-v13.hc \
+ lib/syscall_getncaps.c \
+ lib/syscall_getncaps-net.hc \
+ lib/syscall_getnflags.c \
+ lib/syscall_getnflags-net.hc \
+ lib/syscall_netadd-net.hc \
+ lib/syscall_netadd.c \
+ lib/syscall_netremove-net.hc \
+ lib/syscall_netremove.c \
+ lib/syscall_netcreate.c \
+ lib/syscall_netcreate-net.hc \
+ lib/syscall_netmigrate.c \
+ lib/syscall_netmigrate-net.hc \
lib/syscall_setccaps.c \
lib/syscall_setccaps-v13.hc \
lib/syscall_setcflags.c \
lib/syscall_setcflags-v13.hc \
+ lib/syscall_setncaps.c \
+ lib/syscall_setncaps-net.hc \
+ lib/syscall_setnflags.c \
+ lib/syscall_setnflags-net.hc \
lib/syscall_setsched.c \
lib/syscall_setsched-v13.hc \
lib/bcaps-v13.c \
lib/ccaps-v13.c \
lib/ccaps_list-v13.c \
lib/cflags-v13.c \
- lib/cflags_list-v13.c
+ lib/cflags_list-v13.c \
+ lib/ncaps-net.c \
+ lib/ncaps_list-net.c \
+ lib/nflags-net.c \
+ lib/nflags_list-net.c
PKGCONFIG_FILES = lib/util-vserver
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <ensc@delenn.intern.sigma-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "internal.h"
+#include <lib_internal/util-dimof.h>
+
+#include <string.h>
+#include <assert.h>
+
+#define DECL(STR, VAL) { STR, sizeof(STR)-1, VAL }
+
+static struct Mapping_uint64 const VALUES[] = {
+#warning Add the 'ncap' values here
+};
+
+uint_least64_t
+vc_text2ncap(char const *str, size_t len)
+{
+ ssize_t idx = utilvserver_value2text_uint64(str, len,
+ VALUES, DIM_OF(VALUES));
+ if (idx==-1) return 0;
+ else return VALUES[idx].val;
+}
+
+char const *
+vc_loncap2text(uint_least64_t *val)
+{
+ ssize_t idx = utilvserver_text2value_uint64(val,
+ VALUES, DIM_OF(VALUES));
+
+ if (idx==-1) return 0;
+ else return VALUES[idx].id;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "internal.h"
+
+#include <string.h>
+
+int
+vc_list2ncap(char const *str, size_t len,
+ struct vc_err_listparser *err,
+ struct vc_net_caps *caps)
+{
+ return utilvserver_listparser_uint64(str, len,
+ err ? &err->ptr : 0,
+ err ? &err->len : 0,
+ &caps->ncaps, &caps->cmask,
+ vc_text2ncap);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <ensc@delenn.intern.sigma-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "internal.h"
+#include <lib_internal/util-dimof.h>
+
+#include <string.h>
+#include <assert.h>
+
+#define DECL(STR, VAL) { STR, sizeof(STR)-1, VAL }
+
+static struct Mapping_uint64 const VALUES[] = {
+#warning Add the 'nflags' values here
+};
+
+uint_least64_t
+vc_text2nflag(char const *str, size_t len)
+{
+ ssize_t idx = utilvserver_value2text_uint64(str, len,
+ VALUES, DIM_OF(VALUES));
+ if (idx==-1) return 0;
+ else return VALUES[idx].val;
+}
+
+char const *
+vc_lonflag2text(uint_least64_t *val)
+{
+ ssize_t idx = utilvserver_text2value_uint64(val,
+ VALUES, DIM_OF(VALUES));
+
+ if (idx==-1) return 0;
+ else return VALUES[idx].id;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "internal.h"
+
+#include <string.h>
+
+int
+vc_list2nflag(char const *str, size_t len,
+ struct vc_err_listparser *err,
+ struct vc_net_flags *flags)
+{
+ return utilvserver_listparser_uint64(str, len,
+ err ? &err->ptr : 0,
+ err ? &err->len : 0,
+ &flags->flagword, &flags->mask,
+ vc_text2nflag);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_get_ncaps_net(nid_t nid, struct vc_net_caps *caps)
+{
+ struct vcmd_net_caps_v0 k_caps;
+ int res;
+
+ res = vserver(VCMD_get_ncaps, NID_USER2KERNEL(nid), &k_caps);
+ caps->ncaps = k_caps.ncaps;
+ caps->cmask = k_caps.cmask;
+
+ return res;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "linuxvirtual.h"
+
+#if defined(VC_ENABLE_API_NET)
+# include "syscall_getncaps-net.hc"
+#endif
+
+#if defined(VC_ENABLE_API_NET)
+int
+vc_get_ncaps(nid_t nid, struct vc_net_caps *caps)
+{
+ if (caps==0) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ CALL_VC(CALL_VC_NET(vc_get_ncaps, nid, caps));
+}
+#endif
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_get_nflags_net(nid_t nid, struct vc_net_flags *flags)
+{
+ struct vcmd_net_flags_v0 k_flags;
+ int res;
+
+ res = vserver(VCMD_get_nflags, NID_USER2KERNEL(nid), &k_flags);
+ flags->flagword = k_flags.flagword;
+ flags->mask = k_flags.mask;
+
+ return res;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "linuxvirtual.h"
+
+#if defined(VC_ENABLE_API_NET)
+# include "syscall_getnflags-net.hc"
+#endif
+
+#if defined(VC_ENABLE_API_NET)
+int
+vc_get_nflags(nid_t nid, struct vc_net_flags *flags)
+{
+ if (flags==0) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ CALL_VC(CALL_VC_NET(vc_get_nflags, nid, flags));
+}
+#endif
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_get_nx_info_net(nid_t nid, struct vc_nx_info *info)
+{
+ struct vcmd_nx_info_v0 res;
+ int rc;
+
+ rc = vserver(VCMD_nx_info, NID_USER2KERNEL(nid), &res);
+ if (rc==-1) return -1;
+
+ info->nid = NID_KERNEL2USER(res.nid);
+ return rc;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "linuxvirtual.h"
+#include "vserver-internal.h"
+
+#ifdef VC_ENABLE_API_NET
+# include "syscall_getnxinfo-net.hc"
+#endif
+
+#ifdef VC_ENABLE_API_NET
+int
+vc_get_nx_info(nid_t nid, struct vc_nx_info *info)
+{
+ if (info==0) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ CALL_VC(CALL_VC_NET(vc_get_nx_info, nid, info));
+}
+#endif
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE nid_t
+vc_get_task_nid_net(pid_t pid)
+{
+ nid_t res=vserver(VCMD_task_nid, pid, 0);
+ return NID_KERNEL2USER(res);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "linuxvirtual.h"
+#include "vserver-internal.h"
+
+#ifdef VC_ENABLE_API_NET
+# include "syscall_gettasknid-net.hc"
+#endif
+
+#ifdef VC_ENABLE_API_NET
+nid_t
+vc_get_task_nid(pid_t pid)
+{
+ CALL_VC(CALL_VC_NET(vc_get_task_nid, pid));
+}
+#endif
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_net_add_net(nid_t nid, struct vc_net_nx const *info)
+{
+ struct vcmd_net_nx_v0 k_info;
+
+ k_info.type = NETTYPE_USER2KERNEL(info->type);
+ k_info.count = info->count;
+
+ return vserver(VCMD_net_add, NID_USER2KERNEL(nid), &k_info);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "linuxvirtual.h"
+
+#if defined(VC_ENABLE_API_NET)
+# include "syscall_netadd-net.hc"
+#endif
+
+#if defined(VC_ENABLE_API_NET) && 0
+int
+vc_net_add(nid_t nid, struct vc_net_nx const *info)
+{
+ if (info==0) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ CALL_VC(CALL_VC_NET(vc_net_add, nid, info));
+}
+#endif
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE nid_t
+vc_net_create_net(nid_t nid)
+{
+ nid_t res = vserver(VCMD_net_create, NID_USER2KERNEL(nid), 0);
+
+ return NID_KERNEL2USER(res);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "linuxvirtual.h"
+
+#if defined(VC_ENABLE_API_NET)
+# include "syscall_netcreate-net.hc"
+#endif
+
+#if defined(VC_ENABLE_API_NET)
+nid_t
+vc_net_create(nid_t nid)
+{
+ CALL_VC(CALL_VC_NET(vc_net_create, nid));
+}
+#endif
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_net_migrate_net(nid_t nid)
+{
+ return vserver(VCMD_net_migrate, NID_USER2KERNEL(nid), 0);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "linuxvirtual.h"
+
+#if defined(VC_ENABLE_API_NET)
+# include "syscall_netmigrate-net.hc"
+#endif
+
+#if defined(VC_ENABLE_API_NET)
+int
+vc_net_migrate(nid_t nid)
+{
+ CALL_VC(CALL_VC_NET(vc_net_migrate, nid));
+}
+#endif
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_net_remove_net(nid_t nid, struct vc_net_nx const *info)
+{
+ struct vcmd_net_nx_v0 k_info;
+
+ k_info.type = NETTYPE_USER2KERNEL(info->type);
+ k_info.count = info->count;
+
+ return vserver(VCMD_net_remove, NID_USER2KERNEL(nid), &k_info);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "linuxvirtual.h"
+
+#if defined(VC_ENABLE_API_NET)
+# include "syscall_netremove-net.hc"
+#endif
+
+#if defined(VC_ENABLE_API_NET) && 0
+int
+vc_net_remove(nid_t nid, struct vc_net_nx const *info)
+{
+ if (info==0) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ CALL_VC(CALL_VC_NET(vc_net_remove, nid, info));
+}
+#endif
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_set_ncaps_net(nid_t nid, struct vc_net_caps const *caps)
+{
+ struct vcmd_net_caps_v0 k_caps;
+
+ k_caps.ncaps = caps->ncaps;
+ k_caps.cmask = caps->cmask;
+
+ return vserver(VCMD_set_ncaps, NID_USER2KERNEL(nid), &k_caps);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "linuxvirtual.h"
+
+#if defined(VC_ENABLE_API_NET)
+# include "syscall_setncaps-net.hc"
+#endif
+
+#if defined(VC_ENABLE_API_NET)
+int
+vc_set_ncaps(nid_t nid, struct vc_net_caps const *caps)
+{
+ if (caps==0) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ CALL_VC(CALL_VC_NET(vc_set_ncaps, nid, caps));
+}
+#endif
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_set_nflags_net(nid_t nid, struct vc_net_flags const *flags)
+{
+ struct vcmd_net_flags_v0 k_flags;
+
+ if (flags==0) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ k_flags.flagword = flags->flagword;
+ k_flags.mask = flags->mask;
+
+ return vserver(VCMD_set_nflags, NID_USER2KERNEL(nid), &k_flags);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "linuxvirtual.h"
+
+#if defined(VC_ENABLE_API_NET)
+# include "syscall_setnflags-net.hc"
+#endif
+
+#if defined(VC_ENABLE_API_NET)
+int
+vc_set_nflags(nid_t nid, struct vc_net_flags const *flags)
+{
+ if (flags==0) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ CALL_VC(CALL_VC_NET(vc_set_nflags, nid, flags));
+}
+#endif
# define CALL_VC_V13A(F,...) CALL_VC_NOOP
#endif
+#ifdef VC_ENABLE_API_NET
+# define CALL_VC_NET(F,...) CALL_VC_GENERAL(0x00010016, net, F, __VA_ARGS__)
+#else
+# define CALL_VC_NET(F,...) CALL_VC_NOOP
+#endif
+
#ifdef VC_ENABLE_API_FSCOMPAT
# define CALL_VC_FSCOMPAT(F,...) CALL_VC_GENERAL(0x00010000, fscompat, F, __VA_ARGS__)
#else
# define VHI_KERNEL2USER(X) (X)
#endif
+#if 1
+# define NID_KERNEL2USER(X) (((X)==(uint32_t)(-1)) ? VC_NONID : \
+ (xid_t)(X))
+
+# define NID_USER2KERNEL(X) (((X)==VC_DYNAMIC_NID) ? (uint32_t)(-1) : \
+ (uint32_t)(X))
+#else
+# define NID_USER2KERNEL(X) (X)
+# define NID_KERNEL2USER(X) (X)
+#endif
+
+#if 1
+# define NETTYPE_USER2KERNEL(X) ((X)==vcNET_IPV4 ? 0 : \
+ (X)==vcNET_IPV6 ? 1 : \
+ (X)==vcNET_IPV4R ? 2 : \
+ (X)==vcNET_IPV6R ? 3 : \
+ (X))
+# define NETTYPE_KERNEL2USER(X) ((X)==0 ? vcNET_IPV4 ? : \
+ (X)==1 ? vcNET_IPV6 ? : \
+ (X)==2 ? vcNET_IPV4R ? : \
+ (X)==3 ? vcNET_IPV6R ? : \
+ (vc_net_nx_type)(X))
+#else
+# define NETTYPE_USER2KERNEL(X) (X)
+# define NETTYPE_KERNEL2USER(X) (X)
+#endif
+
#define EXT2_IOC_GETCONTEXT _IOR('x', 1, long)
#define EXT2_IOC_SETCONTEXT _IOW('x', 2, long)
/** the value which means the current ctx */
#define VC_SAMECTX ((xid_t)(-2))
+#define VC_NONID ((nid_t)(-1))
+#define VC_DYNAMIC_NID ((nid_t)(-1))
+
#define VC_LIM_INFINITY (~0ULL)
#define VC_LIM_KEEP (~1ULL)
#ifdef IS_DOXYGEN
typedef an_unsigned_integer_type xid_t;
+typedef an_unsigned_integer_type nid_t;
#endif
#ifdef __cplusplus
int vc_ctx_kill(xid_t ctx, pid_t pid, int sig);
+ struct vc_nx_info {
+ nid_t nid;
+ };
+
+ nid_t vc_get_task_nid(pid_t pid);
+ int vc_get_nx_info(nid_t nid, struct vc_nx_info *) VC_ATTR_NONNULL((2));
+
+ typedef enum { vcNET_IPV4, vcNET_IPV6, vcNET_IPV4R, vcNET_IPV6R } vc_net_nx_type;
+
+ struct vc_net_nx {
+ vc_net_nx_type type;
+ size_t count;
+ uint32_t ip;
+ uint32_t mask;
+ };
+
+ nid_t vc_net_create(nid_t nid);
+ int vc_net_migrate(nid_t nid);
+
+ int vc_net_add(nid_t nid, struct vc_net_nx const *info);
+ int vc_net_remove(nid_t nid, struct vc_net_nx const *info);
+
+ struct vc_net_flags {
+ uint_least64_t flagword;
+ uint_least64_t mask;
+ };
+
+ int vc_get_nflags(nid_t, struct vc_net_flags *);
+ int vc_set_nflags(nid_t, struct vc_net_flags const *);
+
+
+ struct vc_net_caps {
+ uint_least64_t ncaps;
+ uint_least64_t cmask;
+ };
+
+ int vc_get_ncaps(nid_t, struct vc_net_caps *);
+ int vc_set_ncaps(nid_t, struct vc_net_caps const *);
+
+
+
int vc_set_iattr(char const *filename, xid_t xid,
uint_least32_t flags, uint_least32_t mask) VC_ATTR_NONNULL((1));
int vc_text2cap(char const *);
char const * vc_cap2text(unsigned int);
+
+ int vc_list2nflag(char const *, size_t len,
+ struct vc_err_listparser *err,
+ struct vc_net_flags *flags);
+ uint_least64_t vc_text2nflag(char const *, size_t len);
+ char const * vc_lonflag2text(uint_least64_t *);
+ uint_least64_t vc_text2ncap(char const *, size_t len);
+ char const * vc_loncap2text(uint_least64_t *);
+ int vc_list2ncap(char const *, size_t len,
+ struct vc_err_listparser *err,
+ struct vc_net_caps *);
+
inline static int vc_setfilecontext(char const *filename, xid_t xid) {
return vc_set_iattr(filename, xid, 0, VC_IATTR_XID);
}