From f670286a3edb7cc0c783f730e1fe7560217d72b6 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Thu, 19 Aug 2004 13:53:54 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create tag 'IPSENTINEL_VERSION_0_11'. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/tags/IPSENTINEL_VERSION_0_11@1648 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/.cvsignore | 42 - util-vserver/AUTHORS | 1 - util-vserver/ChangeLog.sed | 1 - util-vserver/Makefile.am | 270 ---- util-vserver/NEWS | 10 - util-vserver/README | 117 -- util-vserver/THANKS | 14 - util-vserver/build-all | 88 -- util-vserver/compat-c99.h | 31 - util-vserver/compat.h | 102 -- util-vserver/configure.ac | 240 ---- util-vserver/contrib/.cvsignore | 2 - util-vserver/contrib/Makefile-files | 31 - util-vserver/contrib/make-manifest | 37 - util-vserver/contrib/manifest.dat.pathsubst | 125 -- util-vserver/cvsusers.map | 1 - util-vserver/distrib/.cvsignore | 2 - util-vserver/distrib/Makefile.am | 68 - util-vserver/distrib/defaults/apt.conf | 3 - util-vserver/distrib/defaults/apt/apt.conf | 6 - util-vserver/distrib/defaults/devs | 7 - util-vserver/distrib/defaults/rpm/macros | 4 - util-vserver/distrib/fc1/apt/rpmpriorities | 6 - util-vserver/distrib/fc1/apt/sources.list | 8 - util-vserver/distrib/fc1/pkgs/01 | 1 - util-vserver/distrib/fc1/pkgs/02 | 3 - util-vserver/distrib/fc2/apt/rpmpriorities | 6 - util-vserver/distrib/fc2/apt/sources.list | 8 - util-vserver/distrib/fc2/pkgs/01 | 1 - util-vserver/distrib/fc2/pkgs/02 | 3 - util-vserver/distrib/misc/debootstrap.uri | 1 - util-vserver/distrib/misc/fstab | 3 - util-vserver/distrib/misc/mtab | 1 - util-vserver/distrib/misc/vprocunhide-files | 30 - util-vserver/distrib/misc/vunify-exclude | 26 - util-vserver/distrib/redhat/initpost | 75 - util-vserver/distrib/redhat/initpre | 22 - util-vserver/distrib/redhat/rc.sysinit | 4 - util-vserver/distrib/rh9/apt/rpmpriorities | 6 - util-vserver/distrib/rh9/apt/sources.list | 7 - util-vserver/distrib/rh9/pkgs/01 | 1 - util-vserver/distrib/rh9/pkgs/02 | 3 - util-vserver/distrib/suse91/apt/rpmpriorities | 2 - util-vserver/distrib/suse91/apt/sources.list | 1 - util-vserver/distrib/suse91/initpost | 4 - util-vserver/distrib/suse91/pkgs/01 | 1 - util-vserver/distrib/suse91/pkgs/02 | 3 - util-vserver/distrib/suse91/rpm/macros | 4 - util-vserver/doc/.cvsignore | 2 - util-vserver/doc/Makefile-files | 58 - util-vserver/doc/cfg.txt | 49 - util-vserver/doc/compatibility-xhtml.xsl | 36 - util-vserver/doc/compatibility.dtd | 21 - util-vserver/doc/compatibility.xml | 413 ------ util-vserver/doc/configuration-lsd.css | 41 - util-vserver/doc/configuration-xhtml.xsl | 194 --- util-vserver/doc/configuration.css | 43 - util-vserver/doc/configuration.xml | 921 ------------- util-vserver/doc/configuration.xsd | 231 ---- util-vserver/doc/intro.txt | 1430 -------------------- util-vserver/ensc_wrappers/Makefile-files | 33 - util-vserver/ensc_wrappers/wrappers-clone.hc | 34 - util-vserver/ensc_wrappers/wrappers-dirent.hc | 57 - util-vserver/ensc_wrappers/wrappers-fcntl.hc | 64 - util-vserver/ensc_wrappers/wrappers-io.hc | 98 -- util-vserver/ensc_wrappers/wrappers-ioctl.hc | 29 - util-vserver/ensc_wrappers/wrappers-iosock.hc | 98 -- util-vserver/ensc_wrappers/wrappers-mount.hc | 35 - util-vserver/ensc_wrappers/wrappers-pivot.hc | 27 - util-vserver/ensc_wrappers/wrappers-resource.hc | 32 - util-vserver/ensc_wrappers/wrappers-socket.hc | 78 -- util-vserver/ensc_wrappers/wrappers-stdlib.hc | 41 - util-vserver/ensc_wrappers/wrappers-unistd.hc | 196 --- util-vserver/ensc_wrappers/wrappers-vserver.hc | 108 -- util-vserver/ensc_wrappers/wrappers-wait.hc | 31 - util-vserver/ensc_wrappers/wrappers.h | 112 -- util-vserver/ensc_wrappers/wrappers_handler.hc | 49 - util-vserver/kernel/context.h | 174 --- util-vserver/kernel/cvirt.h | 109 -- util-vserver/kernel/inode.h | 67 - util-vserver/kernel/legacy.h | 54 - util-vserver/kernel/limit.h | 97 -- util-vserver/kernel/namespace.h | 55 - util-vserver/kernel/network.h | 142 -- util-vserver/kernel/sched.h | 134 -- util-vserver/kernel/signal.h | 19 - util-vserver/kernel/switch.h | 95 -- util-vserver/kernel/xid.h | 94 -- util-vserver/lib/.cvsignore | 7 - util-vserver/lib/Makefile-files | 170 --- util-vserver/lib/apidoc/.cvsignore | 5 - util-vserver/lib/apidoc/Doxyfile.in | 215 --- util-vserver/lib/apidoc/Makefile-files | 31 - util-vserver/lib/apidoc/list2xxx.syntax | 5 - util-vserver/lib/bcaps-v13.c | 101 -- util-vserver/lib/bcaps_list-v13.c | 38 - util-vserver/lib/capabilities.c | 86 -- util-vserver/lib/ccaps-v13.c | 56 - util-vserver/lib/ccaps_list-v13.c | 38 - util-vserver/lib/cflags-compat.c | 70 - util-vserver/lib/cflags-v13.c | 74 - util-vserver/lib/cflags_list-compat.c | 62 - util-vserver/lib/cflags_list-v13.c | 38 - util-vserver/lib/checkversion.c | 43 - util-vserver/lib/createskeleton-full.hc | 127 -- util-vserver/lib/createskeleton-short.hc | 31 - util-vserver/lib/createskeleton.c | 49 - util-vserver/lib/ext2fs.h | 30 - util-vserver/lib/fmt.h | 24 - util-vserver/lib/getinsecurebcaps.c | 41 - util-vserver/lib/getnbipv4root.c | 30 - util-vserver/lib/getprocentry-legacy.c | 84 -- util-vserver/lib/getversion-internal.hc | 35 - util-vserver/lib/getversion.c | 30 - util-vserver/lib/getvserverappdir.c | 73 - util-vserver/lib/getvserverbyctx-compat.hc | 114 -- util-vserver/lib/getvserverbyctx-v13.hc | 35 - util-vserver/lib/getvserverbyctx.c | 41 - util-vserver/lib/getvservercfgdir.c | 61 - util-vserver/lib/getvservercfgstyle.c | 95 -- util-vserver/lib/getvserverctx.c | 156 --- util-vserver/lib/getvservername.c | 104 -- util-vserver/lib/getvservervdir.c | 113 -- util-vserver/lib/internal.h | 82 -- util-vserver/lib/ioctl-getext2flags.hc | 48 - util-vserver/lib/ioctl-getfilecontext.hc | 38 - util-vserver/lib/ioctl-getxflg.hc | 43 - util-vserver/lib/ioctl-setext2flags.hc | 56 - util-vserver/lib/ioctl-setfilecontext.hc | 37 - util-vserver/lib/ioctl-setxflg.hc | 39 - util-vserver/lib/isdirectory.c | 37 - util-vserver/lib/isdynamicxid.c | 30 - util-vserver/lib/issupported.c | 48 - util-vserver/lib/issupportedstring.c | 49 - util-vserver/lib/listparser.hc | 102 -- util-vserver/lib/listparser_uint32.c | 26 - util-vserver/lib/listparser_uint64.c | 26 - util-vserver/lib/ncaps-net.c | 53 - util-vserver/lib/ncaps_list-net.c | 38 - util-vserver/lib/nflags-net.c | 53 - util-vserver/lib/nflags_list-net.c | 38 - util-vserver/lib/parselimit.c | 50 - util-vserver/lib/safechroot-internal.hc | 48 - util-vserver/lib/syscall-compat.hc | 58 - util-vserver/lib/syscall-legacy.hc | 254 ---- util-vserver/lib/syscall-syscall.c | 26 - util-vserver/lib/syscall.c | 64 - util-vserver/lib/syscall_cleanupnamespace-v13.hc | 29 - util-vserver/lib/syscall_cleanupnamespace.c | 36 - util-vserver/lib/syscall_ctxcreate-v13.hc | 29 - util-vserver/lib/syscall_ctxcreate.c | 37 - util-vserver/lib/syscall_ctxmigrate-v13.hc | 27 - util-vserver/lib/syscall_ctxmigrate.c | 37 - util-vserver/lib/syscall_enternamespace-v13.hc | 29 - util-vserver/lib/syscall_enternamespace.c | 36 - util-vserver/lib/syscall_getccaps-v13.hc | 36 - util-vserver/lib/syscall_getccaps.c | 42 - util-vserver/lib/syscall_getcflags-v13.hc | 39 - util-vserver/lib/syscall_getcflags.c | 37 - util-vserver/lib/syscall_getiattr-fscompat.hc | 90 -- util-vserver/lib/syscall_getiattr-v13.hc | 40 - util-vserver/lib/syscall_getiattr.c | 52 - util-vserver/lib/syscall_getncaps-net.hc | 34 - util-vserver/lib/syscall_getncaps.c | 42 - util-vserver/lib/syscall_getnflags-net.hc | 34 - util-vserver/lib/syscall_getnflags.c | 42 - util-vserver/lib/syscall_getnxinfo-net.hc | 34 - util-vserver/lib/syscall_getnxinfo.c | 42 - util-vserver/lib/syscall_gettasknid-net.hc | 28 - util-vserver/lib/syscall_gettasknid.c | 37 - util-vserver/lib/syscall_gettaskxid-oldproc.hc | 47 - util-vserver/lib/syscall_gettaskxid-v13.hc | 28 - util-vserver/lib/syscall_gettaskxid.c | 44 - util-vserver/lib/syscall_getvhiname-olduts.hc | 38 - util-vserver/lib/syscall_getvhiname-v13.hc | 40 - util-vserver/lib/syscall_getvhiname.c | 44 - util-vserver/lib/syscall_getvxinfo-oldproc.hc | 29 - util-vserver/lib/syscall_getvxinfo-v13.hc | 44 - util-vserver/lib/syscall_getvxinfo.c | 48 - util-vserver/lib/syscall_kill-v11.hc | 31 - util-vserver/lib/syscall_kill.c | 48 - util-vserver/lib/syscall_netadd-net.hc | 32 - util-vserver/lib/syscall_netadd.c | 42 - util-vserver/lib/syscall_netcreate-net.hc | 29 - util-vserver/lib/syscall_netcreate.c | 37 - util-vserver/lib/syscall_netmigrate-net.hc | 27 - util-vserver/lib/syscall_netmigrate.c | 37 - util-vserver/lib/syscall_netremove-net.hc | 32 - util-vserver/lib/syscall_netremove.c | 42 - util-vserver/lib/syscall_rlimit-v11.hc | 75 - util-vserver/lib/syscall_rlimit.c | 69 - util-vserver/lib/syscall_setccaps-v13.hc | 33 - util-vserver/lib/syscall_setccaps.c | 42 - util-vserver/lib/syscall_setcflags-v13.hc | 37 - util-vserver/lib/syscall_setcflags.c | 42 - util-vserver/lib/syscall_setiattr-fscompat.hc | 86 -- util-vserver/lib/syscall_setiattr-v13.hc | 35 - util-vserver/lib/syscall_setiattr.c | 44 - util-vserver/lib/syscall_setnamespace-v13.hc | 29 - util-vserver/lib/syscall_setnamespace.c | 36 - util-vserver/lib/syscall_setncaps-net.hc | 32 - util-vserver/lib/syscall_setncaps.c | 42 - util-vserver/lib/syscall_setnflags-net.hc | 37 - util-vserver/lib/syscall_setnflags.c | 42 - util-vserver/lib/syscall_setsched-v13.hc | 38 - util-vserver/lib/syscall_setsched.c | 36 - util-vserver/lib/syscall_setvhiname-olduts.hc | 38 - util-vserver/lib/syscall_setvhiname-v13.hc | 43 - util-vserver/lib/syscall_setvhiname.c | 46 - util-vserver/lib/testsuite/.cvsignore | 8 - util-vserver/lib/testsuite/Makefile-files | 41 - util-vserver/lib/testsuite/cflags.c | 199 --- util-vserver/lib/testsuite/fmt.c | 52 - util-vserver/lib/testsuite/parselimit.c | 54 - util-vserver/lib/util-vserver.pc.subst | 11 - util-vserver/lib/utils-legacy.h | 39 - util-vserver/lib/val2text-t2v-uint32.c | 26 - util-vserver/lib/val2text-t2v-uint64.c | 26 - util-vserver/lib/val2text-v2t-uint32.c | 26 - util-vserver/lib/val2text-v2t-uint64.c | 26 - util-vserver/lib/val2text.hc | 76 -- util-vserver/lib/virtual.h | 30 - util-vserver/lib/vserver-internal.h | 216 --- util-vserver/lib/vserver.h | 685 ---------- util-vserver/lib/xidopt2xid.c | 58 - util-vserver/lib_internal/.cvsignore | 2 - util-vserver/lib_internal/Makefile-files | 88 -- .../lib_internal/command-appendparameter.c | 30 - util-vserver/lib_internal/command-exec.c | 76 -- util-vserver/lib_internal/command-free.c | 29 - util-vserver/lib_internal/command-init.c | 33 - util-vserver/lib_internal/command-reset.c | 31 - util-vserver/lib_internal/command-wait.c | 40 - util-vserver/lib_internal/command.h | 50 - util-vserver/lib_internal/coreassert.h | 40 - util-vserver/lib_internal/errinfo-writeerrno.c | 44 - util-vserver/lib_internal/errinfo.h | 31 - util-vserver/lib_internal/filecfg-readentryflag.c | 39 - util-vserver/lib_internal/filecfg-readentrystr.c | 74 - util-vserver/lib_internal/filecfg.h | 31 - util-vserver/lib_internal/jail.h | 26 - util-vserver/lib_internal/jailintotempdir.c | 51 - util-vserver/lib_internal/matchlist-appendfiles.c | 71 - util-vserver/lib_internal/matchlist-compare.c | 41 - util-vserver/lib_internal/matchlist-destroy.c | 37 - util-vserver/lib_internal/matchlist-init.c | 41 - .../lib_internal/matchlist-initbyvserver.c | 72 - util-vserver/lib_internal/matchlist-initmanually.c | 196 --- .../lib_internal/matchlist-initrefserverlist.c | 82 -- util-vserver/lib_internal/matchlist-printid.c | 39 - util-vserver/lib_internal/matchlist.h | 74 - util-vserver/lib_internal/pathinfo-append.c | 54 - util-vserver/lib_internal/pathinfo-test.c | 55 - util-vserver/lib_internal/pathinfo.h | 33 - util-vserver/lib_internal/string-destroy.c | 29 - util-vserver/lib_internal/string.h | 35 - util-vserver/lib_internal/string.hc | 23 - util-vserver/lib_internal/switchtowatchxid.c | 83 -- util-vserver/lib_internal/testsuite/.cvsignore | 5 - util-vserver/lib_internal/testsuite/Makefile-files | 22 - util-vserver/lib_internal/testsuite/command.c | 48 - util-vserver/lib_internal/unify-copy.c | 130 -- util-vserver/lib_internal/unify-deunify.c | 125 -- util-vserver/lib_internal/unify-settime.c | 39 - util-vserver/lib_internal/unify-unify.c | 95 -- util-vserver/lib_internal/unify.h | 55 - util-vserver/lib_internal/util-canonify.c | 40 - util-vserver/lib_internal/util-cast.h | 33 - util-vserver/lib_internal/util-commonstrings.h | 32 - util-vserver/lib_internal/util-debug.h | 30 - util-vserver/lib_internal/util-declarecmd.h | 27 - util-vserver/lib_internal/util-dimof.h | 24 - util-vserver/lib_internal/util-dotfile.h | 30 - util-vserver/lib_internal/util-exitlikeprocess.c | 90 -- util-vserver/lib_internal/util-exitlikeprocess.h | 25 - util-vserver/lib_internal/util-io.h | 35 - util-vserver/lib_internal/util-lockfile.c | 86 -- util-vserver/lib_internal/util-lockfile.h | 30 - util-vserver/lib_internal/util-mem.h | 31 - util-vserver/lib_internal/util-perror.h | 44 - util-vserver/lib_internal/util-safechdir.c | 50 - util-vserver/lib_internal/util-safechdir.h | 28 - util-vserver/lib_internal/util-unixsock.h | 27 - util-vserver/lib_internal/util.h | 39 - util-vserver/m4/changelog.am | 36 - util-vserver/m4/ensc_cflags.m4 | 112 -- util-vserver/m4/ensc_changelog.m4 | 31 - util-vserver/m4/ensc_cxxcompiler.m4 | 66 - util-vserver/m4/ensc_dietlibc.m4 | 119 -- util-vserver/m4/ensc_dietlibc_compat.m4 | 45 - util-vserver/m4/ensc_e2fscheck.m4 | 72 - util-vserver/m4/ensc_fpicsyscall.m4 | 41 - util-vserver/m4/ensc_initrddir.m4 | 39 - util-vserver/m4/ensc_kerneldir.m4 | 57 - util-vserver/m4/ensc_release.m4 | 43 - util-vserver/m4/ensc_syscall.m4 | 84 -- util-vserver/m4/ensc_syscallnr.m4 | 62 - util-vserver/m4/ensc_uv_vrootdir.m4 | 39 - util-vserver/m4/gpgsig.am | 20 - util-vserver/m4/pkgconfig.am | 55 - util-vserver/m4/validate.am | 30 - util-vserver/man/Makefile-files | 33 - util-vserver/man/chbind.8 | 43 - util-vserver/man/chcontext.8 | 103 -- util-vserver/man/distrib-info.8 | 50 - util-vserver/man/rebootmgr.8 | 38 - util-vserver/man/reducecap.8 | 124 -- util-vserver/man/vps.8 | 31 - util-vserver/man/vpstree.8 | 31 - util-vserver/man/vrpm.8 | 48 - util-vserver/man/vserver-copy.8 | 93 -- util-vserver/man/vserver-stat.8 | 40 - util-vserver/man/vserver.8 | 74 - util-vserver/man/vtop.8 | 31 - util-vserver/pathconfig.h.pathsubst | 49 - util-vserver/scripts/.cvsignore | 4 - util-vserver/scripts/Makefile-files | 108 -- util-vserver/scripts/chcontext | 167 --- util-vserver/scripts/functions | 775 ----------- util-vserver/scripts/legacy/.cvsignore | 2 - util-vserver/scripts/legacy/distrib-info | 76 -- util-vserver/scripts/legacy/save_s_context | 32 - util-vserver/scripts/legacy/vps.pathsubst | 125 -- util-vserver/scripts/legacy/vserver | 780 ----------- util-vserver/scripts/legacy/vserverkillall | 63 - util-vserver/scripts/pkgmgmt | 385 ------ util-vserver/scripts/rootshell | 28 - util-vserver/scripts/start-vservers | 180 --- util-vserver/scripts/util-vserver-vars.pathsubst | 110 -- util-vserver/scripts/vapt-get | 99 -- util-vserver/scripts/vapt-get-worker | 53 - util-vserver/scripts/vpkg | 142 -- util-vserver/scripts/vprocunhide | 95 -- util-vserver/scripts/vpstree | 28 - util-vserver/scripts/vrpm | 110 -- util-vserver/scripts/vrpm-preload | 80 -- util-vserver/scripts/vrpm-worker | 34 - util-vserver/scripts/vserver | 268 ---- util-vserver/scripts/vserver-build | 129 -- util-vserver/scripts/vserver-build.apt-rpm | 59 - util-vserver/scripts/vserver-build.debootstrap | 118 -- util-vserver/scripts/vserver-build.functions | 189 --- util-vserver/scripts/vserver-build.functions.apt | 82 -- .../scripts/vserver-build.functions.pkgmgmt | 83 -- util-vserver/scripts/vserver-build.functions.rpm | 75 - util-vserver/scripts/vserver-build.skeleton | 52 - util-vserver/scripts/vserver-copy | 380 ------ util-vserver/scripts/vserver-setup.functions | 189 --- util-vserver/scripts/vserver-wrapper | 96 -- util-vserver/scripts/vserver.functions | 755 ----------- util-vserver/scripts/vserver.start | 144 -- util-vserver/scripts/vserver.stop | 91 -- util-vserver/scripts/vserver.suexec | 56 - util-vserver/scripts/vservers.grabinfo.sh | 51 - util-vserver/scripts/vshelper | 201 --- util-vserver/scripts/vsysvwrapper | 45 - util-vserver/scripts/vtop | 28 - util-vserver/src/.cvsignore | 61 - util-vserver/src/Makefile-files | 296 ---- util-vserver/src/capchroot.c | 164 --- util-vserver/src/chain-echo.c | 86 -- util-vserver/src/chbind.c | 328 ----- util-vserver/src/chcontext.c | 396 ------ util-vserver/src/chroot-cat.c | 66 - util-vserver/src/chroot-rm.c | 86 -- util-vserver/src/chxid.c | 98 -- util-vserver/src/compat-pivot_root.h | 29 - util-vserver/src/context-sync.hc | 89 -- util-vserver/src/exec-cd.c | 88 -- util-vserver/src/exec-ulimit.c | 186 --- util-vserver/src/fakerunlevel.c | 117 -- util-vserver/src/filetime.c | 104 -- util-vserver/src/fstool-resolvectx.c | 50 - util-vserver/src/fstool.c | 253 ---- util-vserver/src/fstool.h | 73 - util-vserver/src/ifspec.c | 192 --- util-vserver/src/keep-ctx-alive.c | 193 --- util-vserver/src/listdevip.c | 112 -- util-vserver/src/lockfile.c | 143 -- util-vserver/src/lsxid.c | 182 --- util-vserver/src/mask2prefix.c | 70 - util-vserver/src/parserpmdump.c | 71 - util-vserver/src/readlink.c | 80 -- util-vserver/src/rebootmgr.c | 246 ---- util-vserver/src/reducecap.c | 292 ---- util-vserver/src/rpm-fake-resolver.c | 305 ----- util-vserver/src/rpm-fake.c | 630 --------- util-vserver/src/save_ctxinfo.c | 95 -- util-vserver/src/secure-mount.c | 664 --------- util-vserver/src/secure-umount.c | 85 -- util-vserver/src/setattr.c | 117 -- util-vserver/src/showattr.c | 139 -- util-vserver/src/showperm.c | 55 - util-vserver/src/sigexec.c | 75 - util-vserver/src/stack-start.h | 28 - util-vserver/src/sys_clone.h | 49 - util-vserver/src/testsuite/.cvsignore | 7 - util-vserver/src/testsuite/Makefile-files | 67 - util-vserver/src/testsuite/chbind-test.c | 34 - util-vserver/src/testsuite/chcontext-test.c | 34 - util-vserver/src/testsuite/data/rpm-fake-test.inp | 14 - util-vserver/src/testsuite/data/rpm-fake-test.out | 13 - util-vserver/src/testsuite/rpm-fake-test.c | 92 -- util-vserver/src/testsuite/rpm-fake-test.sh | 37 - util-vserver/src/testsuite/vunify-functest.c | 32 - util-vserver/src/testsuite/vunify-test.sh | 53 - util-vserver/src/util.h | 24 - util-vserver/src/vattribute.c | 194 --- util-vserver/src/vbuild.cc | 296 ---- util-vserver/src/vcheck.cc | 241 ---- util-vserver/src/vcontext.c | 350 ----- util-vserver/src/vcopy-init.hc | 90 -- util-vserver/src/vcopy.c | 308 ----- util-vserver/src/vdu.c | 118 -- util-vserver/src/vfiles.cc | 150 -- util-vserver/src/vkill.c | 224 --- util-vserver/src/vlimit.c | 410 ------ util-vserver/src/vnamespace.c | 200 --- util-vserver/src/vps.c | 264 ---- util-vserver/src/vreboot.c | 109 -- util-vserver/src/vrsetup.c | 133 -- util-vserver/src/vsched.c | 137 -- util-vserver/src/vserver-info.c | 487 ------- util-vserver/src/vserver-stat.c | 522 ------- util-vserver/src/vserver-visitdir.hc | 56 - util-vserver/src/vserver.cc | 75 - util-vserver/src/vserver.hh | 45 - util-vserver/src/vshelper-sync.c | 111 -- util-vserver/src/vuname.c | 294 ---- util-vserver/src/vunify-init.hc | 67 - util-vserver/src/vunify.c | 423 ------ util-vserver/src/vunify.h | 72 - util-vserver/src/vutil.cc | 270 ---- util-vserver/src/vutil.h | 136 -- util-vserver/src/vutil.p | 49 - util-vserver/sysv/.cvsignore | 10 - util-vserver/sysv/Makefile-files | 69 - util-vserver/sysv/rebootmgr | 68 - util-vserver/sysv/v_gated.subst | 13 - util-vserver/sysv/v_httpd.subst | 6 - util-vserver/sysv/v_named.subst | 11 - util-vserver/sysv/v_portmap.subst | 11 - util-vserver/sysv/v_sendmail.subst | 6 - util-vserver/sysv/v_smb.subst | 11 - util-vserver/sysv/v_sshd.subst | 11 - util-vserver/sysv/v_xinetd.subst | 6 - util-vserver/sysv/vprocunhide | 71 - util-vserver/sysv/vservers-default | 25 - util-vserver/sysv/vservers-legacy | 92 -- util-vserver/sysv/vservers.conf | 7 - util-vserver/tests/.cvsignore | 12 - util-vserver/tests/Makefile-files | 50 - util-vserver/tests/chrootsafe.c | 64 - util-vserver/tests/escaperoot.c | 119 -- util-vserver/tests/forkbomb.c | 109 -- util-vserver/tests/getctx.c | 45 - util-vserver/tests/getinitpid.c | 57 - util-vserver/tests/testipc.c | 129 -- util-vserver/tests/testlimit.c | 53 - util-vserver/tests/testopenf.c | 55 - util-vserver/tests/vserver-info.c | 74 - util-vserver/util-vserver.spec.in | 240 ---- util-vserver/vserver-start/.cvsignore | 4 - util-vserver/vserver-start/Makefile-files | 45 - util-vserver/vserver-start/configuration-init.c | 30 - util-vserver/vserver-start/configuration.c | 96 -- util-vserver/vserver-start/configuration.h | 38 - util-vserver/vserver-start/interface-add.c | 127 -- util-vserver/vserver-start/interface-free.hc | 25 - util-vserver/vserver-start/interface-init.hc | 31 - util-vserver/vserver-start/interface-read.c | 131 -- util-vserver/vserver-start/interface.c | 39 - util-vserver/vserver-start/interface.h | 60 - util-vserver/vserver-start/main.c | 128 -- util-vserver/vserver-start/scriptlets.c | 172 --- util-vserver/vserver-start/vserver-start.h | 36 - util-vserver/vserver-start/vshelper.c | 46 - util-vserver/vserver-start/vshelper.h | 25 - 478 files changed, 41045 deletions(-) delete mode 100644 util-vserver/.cvsignore delete mode 100644 util-vserver/AUTHORS delete mode 100644 util-vserver/ChangeLog.sed delete mode 100644 util-vserver/Makefile.am delete mode 100644 util-vserver/NEWS delete mode 100644 util-vserver/README delete mode 100644 util-vserver/THANKS delete mode 100755 util-vserver/build-all delete mode 100644 util-vserver/compat-c99.h delete mode 100644 util-vserver/compat.h delete mode 100644 util-vserver/configure.ac delete mode 100644 util-vserver/contrib/.cvsignore delete mode 100644 util-vserver/contrib/Makefile-files delete mode 100755 util-vserver/contrib/make-manifest delete mode 100644 util-vserver/contrib/manifest.dat.pathsubst delete mode 100644 util-vserver/cvsusers.map delete mode 100644 util-vserver/distrib/.cvsignore delete mode 100644 util-vserver/distrib/Makefile.am delete mode 100644 util-vserver/distrib/defaults/apt.conf delete mode 100644 util-vserver/distrib/defaults/apt/apt.conf delete mode 100644 util-vserver/distrib/defaults/devs delete mode 100644 util-vserver/distrib/defaults/rpm/macros delete mode 100644 util-vserver/distrib/fc1/apt/rpmpriorities delete mode 100644 util-vserver/distrib/fc1/apt/sources.list delete mode 100644 util-vserver/distrib/fc1/pkgs/01 delete mode 100644 util-vserver/distrib/fc1/pkgs/02 delete mode 100644 util-vserver/distrib/fc2/apt/rpmpriorities delete mode 100644 util-vserver/distrib/fc2/apt/sources.list delete mode 100644 util-vserver/distrib/fc2/pkgs/01 delete mode 100644 util-vserver/distrib/fc2/pkgs/02 delete mode 100644 util-vserver/distrib/misc/debootstrap.uri delete mode 100644 util-vserver/distrib/misc/fstab delete mode 100644 util-vserver/distrib/misc/mtab delete mode 100644 util-vserver/distrib/misc/vprocunhide-files delete mode 100644 util-vserver/distrib/misc/vunify-exclude delete mode 100755 util-vserver/distrib/redhat/initpost delete mode 100755 util-vserver/distrib/redhat/initpre delete mode 100755 util-vserver/distrib/redhat/rc.sysinit delete mode 100644 util-vserver/distrib/rh9/apt/rpmpriorities delete mode 100644 util-vserver/distrib/rh9/apt/sources.list delete mode 100644 util-vserver/distrib/rh9/pkgs/01 delete mode 100644 util-vserver/distrib/rh9/pkgs/02 delete mode 100644 util-vserver/distrib/suse91/apt/rpmpriorities delete mode 100644 util-vserver/distrib/suse91/apt/sources.list delete mode 100755 util-vserver/distrib/suse91/initpost delete mode 100644 util-vserver/distrib/suse91/pkgs/01 delete mode 100644 util-vserver/distrib/suse91/pkgs/02 delete mode 100644 util-vserver/distrib/suse91/rpm/macros delete mode 100644 util-vserver/doc/.cvsignore delete mode 100644 util-vserver/doc/Makefile-files delete mode 100644 util-vserver/doc/cfg.txt delete mode 100644 util-vserver/doc/compatibility-xhtml.xsl delete mode 100644 util-vserver/doc/compatibility.dtd delete mode 100644 util-vserver/doc/compatibility.xml delete mode 100644 util-vserver/doc/configuration-lsd.css delete mode 100644 util-vserver/doc/configuration-xhtml.xsl delete mode 100644 util-vserver/doc/configuration.css delete mode 100644 util-vserver/doc/configuration.xml delete mode 100644 util-vserver/doc/configuration.xsd delete mode 100644 util-vserver/doc/intro.txt delete mode 100644 util-vserver/ensc_wrappers/Makefile-files delete mode 100644 util-vserver/ensc_wrappers/wrappers-clone.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-dirent.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-fcntl.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-io.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-ioctl.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-iosock.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-mount.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-pivot.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-resource.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-socket.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-stdlib.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-unistd.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-vserver.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers-wait.hc delete mode 100644 util-vserver/ensc_wrappers/wrappers.h delete mode 100644 util-vserver/ensc_wrappers/wrappers_handler.hc delete mode 100644 util-vserver/kernel/context.h delete mode 100644 util-vserver/kernel/cvirt.h delete mode 100644 util-vserver/kernel/inode.h delete mode 100644 util-vserver/kernel/legacy.h delete mode 100644 util-vserver/kernel/limit.h delete mode 100644 util-vserver/kernel/namespace.h delete mode 100644 util-vserver/kernel/network.h delete mode 100644 util-vserver/kernel/sched.h delete mode 100644 util-vserver/kernel/signal.h delete mode 100644 util-vserver/kernel/switch.h delete mode 100644 util-vserver/kernel/xid.h delete mode 100644 util-vserver/lib/.cvsignore delete mode 100644 util-vserver/lib/Makefile-files delete mode 100644 util-vserver/lib/apidoc/.cvsignore delete mode 100644 util-vserver/lib/apidoc/Doxyfile.in delete mode 100644 util-vserver/lib/apidoc/Makefile-files delete mode 100644 util-vserver/lib/apidoc/list2xxx.syntax delete mode 100644 util-vserver/lib/bcaps-v13.c delete mode 100644 util-vserver/lib/bcaps_list-v13.c delete mode 100644 util-vserver/lib/capabilities.c delete mode 100644 util-vserver/lib/ccaps-v13.c delete mode 100644 util-vserver/lib/ccaps_list-v13.c delete mode 100644 util-vserver/lib/cflags-compat.c delete mode 100644 util-vserver/lib/cflags-v13.c delete mode 100644 util-vserver/lib/cflags_list-compat.c delete mode 100644 util-vserver/lib/cflags_list-v13.c delete mode 100644 util-vserver/lib/checkversion.c delete mode 100644 util-vserver/lib/createskeleton-full.hc delete mode 100644 util-vserver/lib/createskeleton-short.hc delete mode 100644 util-vserver/lib/createskeleton.c delete mode 100644 util-vserver/lib/ext2fs.h delete mode 100644 util-vserver/lib/fmt.h delete mode 100644 util-vserver/lib/getinsecurebcaps.c delete mode 100644 util-vserver/lib/getnbipv4root.c delete mode 100644 util-vserver/lib/getprocentry-legacy.c delete mode 100644 util-vserver/lib/getversion-internal.hc delete mode 100644 util-vserver/lib/getversion.c delete mode 100644 util-vserver/lib/getvserverappdir.c delete mode 100644 util-vserver/lib/getvserverbyctx-compat.hc delete mode 100644 util-vserver/lib/getvserverbyctx-v13.hc delete mode 100644 util-vserver/lib/getvserverbyctx.c delete mode 100644 util-vserver/lib/getvservercfgdir.c delete mode 100644 util-vserver/lib/getvservercfgstyle.c delete mode 100644 util-vserver/lib/getvserverctx.c delete mode 100644 util-vserver/lib/getvservername.c delete mode 100644 util-vserver/lib/getvservervdir.c delete mode 100644 util-vserver/lib/internal.h delete mode 100644 util-vserver/lib/ioctl-getext2flags.hc delete mode 100644 util-vserver/lib/ioctl-getfilecontext.hc delete mode 100644 util-vserver/lib/ioctl-getxflg.hc delete mode 100644 util-vserver/lib/ioctl-setext2flags.hc delete mode 100644 util-vserver/lib/ioctl-setfilecontext.hc delete mode 100644 util-vserver/lib/ioctl-setxflg.hc delete mode 100644 util-vserver/lib/isdirectory.c delete mode 100644 util-vserver/lib/isdynamicxid.c delete mode 100644 util-vserver/lib/issupported.c delete mode 100644 util-vserver/lib/issupportedstring.c delete mode 100644 util-vserver/lib/listparser.hc delete mode 100644 util-vserver/lib/listparser_uint32.c delete mode 100644 util-vserver/lib/listparser_uint64.c delete mode 100644 util-vserver/lib/ncaps-net.c delete mode 100644 util-vserver/lib/ncaps_list-net.c delete mode 100644 util-vserver/lib/nflags-net.c delete mode 100644 util-vserver/lib/nflags_list-net.c delete mode 100644 util-vserver/lib/parselimit.c delete mode 100644 util-vserver/lib/safechroot-internal.hc delete mode 100644 util-vserver/lib/syscall-compat.hc delete mode 100644 util-vserver/lib/syscall-legacy.hc delete mode 100644 util-vserver/lib/syscall-syscall.c delete mode 100644 util-vserver/lib/syscall.c delete mode 100644 util-vserver/lib/syscall_cleanupnamespace-v13.hc delete mode 100644 util-vserver/lib/syscall_cleanupnamespace.c delete mode 100644 util-vserver/lib/syscall_ctxcreate-v13.hc delete mode 100644 util-vserver/lib/syscall_ctxcreate.c delete mode 100644 util-vserver/lib/syscall_ctxmigrate-v13.hc delete mode 100644 util-vserver/lib/syscall_ctxmigrate.c delete mode 100644 util-vserver/lib/syscall_enternamespace-v13.hc delete mode 100644 util-vserver/lib/syscall_enternamespace.c delete mode 100644 util-vserver/lib/syscall_getccaps-v13.hc delete mode 100644 util-vserver/lib/syscall_getccaps.c delete mode 100644 util-vserver/lib/syscall_getcflags-v13.hc delete mode 100644 util-vserver/lib/syscall_getcflags.c delete mode 100644 util-vserver/lib/syscall_getiattr-fscompat.hc delete mode 100644 util-vserver/lib/syscall_getiattr-v13.hc delete mode 100644 util-vserver/lib/syscall_getiattr.c delete mode 100644 util-vserver/lib/syscall_getncaps-net.hc delete mode 100644 util-vserver/lib/syscall_getncaps.c delete mode 100644 util-vserver/lib/syscall_getnflags-net.hc delete mode 100644 util-vserver/lib/syscall_getnflags.c delete mode 100644 util-vserver/lib/syscall_getnxinfo-net.hc delete mode 100644 util-vserver/lib/syscall_getnxinfo.c delete mode 100644 util-vserver/lib/syscall_gettasknid-net.hc delete mode 100644 util-vserver/lib/syscall_gettasknid.c delete mode 100644 util-vserver/lib/syscall_gettaskxid-oldproc.hc delete mode 100644 util-vserver/lib/syscall_gettaskxid-v13.hc delete mode 100644 util-vserver/lib/syscall_gettaskxid.c delete mode 100644 util-vserver/lib/syscall_getvhiname-olduts.hc delete mode 100644 util-vserver/lib/syscall_getvhiname-v13.hc delete mode 100644 util-vserver/lib/syscall_getvhiname.c delete mode 100644 util-vserver/lib/syscall_getvxinfo-oldproc.hc delete mode 100644 util-vserver/lib/syscall_getvxinfo-v13.hc delete mode 100644 util-vserver/lib/syscall_getvxinfo.c delete mode 100644 util-vserver/lib/syscall_kill-v11.hc delete mode 100644 util-vserver/lib/syscall_kill.c delete mode 100644 util-vserver/lib/syscall_netadd-net.hc delete mode 100644 util-vserver/lib/syscall_netadd.c delete mode 100644 util-vserver/lib/syscall_netcreate-net.hc delete mode 100644 util-vserver/lib/syscall_netcreate.c delete mode 100644 util-vserver/lib/syscall_netmigrate-net.hc delete mode 100644 util-vserver/lib/syscall_netmigrate.c delete mode 100644 util-vserver/lib/syscall_netremove-net.hc delete mode 100644 util-vserver/lib/syscall_netremove.c delete mode 100644 util-vserver/lib/syscall_rlimit-v11.hc delete mode 100644 util-vserver/lib/syscall_rlimit.c delete mode 100644 util-vserver/lib/syscall_setccaps-v13.hc delete mode 100644 util-vserver/lib/syscall_setccaps.c delete mode 100644 util-vserver/lib/syscall_setcflags-v13.hc delete mode 100644 util-vserver/lib/syscall_setcflags.c delete mode 100644 util-vserver/lib/syscall_setiattr-fscompat.hc delete mode 100644 util-vserver/lib/syscall_setiattr-v13.hc delete mode 100644 util-vserver/lib/syscall_setiattr.c delete mode 100644 util-vserver/lib/syscall_setnamespace-v13.hc delete mode 100644 util-vserver/lib/syscall_setnamespace.c delete mode 100644 util-vserver/lib/syscall_setncaps-net.hc delete mode 100644 util-vserver/lib/syscall_setncaps.c delete mode 100644 util-vserver/lib/syscall_setnflags-net.hc delete mode 100644 util-vserver/lib/syscall_setnflags.c delete mode 100644 util-vserver/lib/syscall_setsched-v13.hc delete mode 100644 util-vserver/lib/syscall_setsched.c delete mode 100644 util-vserver/lib/syscall_setvhiname-olduts.hc delete mode 100644 util-vserver/lib/syscall_setvhiname-v13.hc delete mode 100644 util-vserver/lib/syscall_setvhiname.c delete mode 100644 util-vserver/lib/testsuite/.cvsignore delete mode 100644 util-vserver/lib/testsuite/Makefile-files delete mode 100644 util-vserver/lib/testsuite/cflags.c delete mode 100644 util-vserver/lib/testsuite/fmt.c delete mode 100644 util-vserver/lib/testsuite/parselimit.c delete mode 100644 util-vserver/lib/util-vserver.pc.subst delete mode 100644 util-vserver/lib/utils-legacy.h delete mode 100644 util-vserver/lib/val2text-t2v-uint32.c delete mode 100644 util-vserver/lib/val2text-t2v-uint64.c delete mode 100644 util-vserver/lib/val2text-v2t-uint32.c delete mode 100644 util-vserver/lib/val2text-v2t-uint64.c delete mode 100644 util-vserver/lib/val2text.hc delete mode 100644 util-vserver/lib/virtual.h delete mode 100644 util-vserver/lib/vserver-internal.h delete mode 100644 util-vserver/lib/vserver.h delete mode 100644 util-vserver/lib/xidopt2xid.c delete mode 100644 util-vserver/lib_internal/.cvsignore delete mode 100644 util-vserver/lib_internal/Makefile-files delete mode 100644 util-vserver/lib_internal/command-appendparameter.c delete mode 100644 util-vserver/lib_internal/command-exec.c delete mode 100644 util-vserver/lib_internal/command-free.c delete mode 100644 util-vserver/lib_internal/command-init.c delete mode 100644 util-vserver/lib_internal/command-reset.c delete mode 100644 util-vserver/lib_internal/command-wait.c delete mode 100644 util-vserver/lib_internal/command.h delete mode 100644 util-vserver/lib_internal/coreassert.h delete mode 100644 util-vserver/lib_internal/errinfo-writeerrno.c delete mode 100644 util-vserver/lib_internal/errinfo.h delete mode 100644 util-vserver/lib_internal/filecfg-readentryflag.c delete mode 100644 util-vserver/lib_internal/filecfg-readentrystr.c delete mode 100644 util-vserver/lib_internal/filecfg.h delete mode 100644 util-vserver/lib_internal/jail.h delete mode 100644 util-vserver/lib_internal/jailintotempdir.c delete mode 100644 util-vserver/lib_internal/matchlist-appendfiles.c delete mode 100644 util-vserver/lib_internal/matchlist-compare.c delete mode 100644 util-vserver/lib_internal/matchlist-destroy.c delete mode 100644 util-vserver/lib_internal/matchlist-init.c delete mode 100644 util-vserver/lib_internal/matchlist-initbyvserver.c delete mode 100644 util-vserver/lib_internal/matchlist-initmanually.c delete mode 100644 util-vserver/lib_internal/matchlist-initrefserverlist.c delete mode 100644 util-vserver/lib_internal/matchlist-printid.c delete mode 100644 util-vserver/lib_internal/matchlist.h delete mode 100644 util-vserver/lib_internal/pathinfo-append.c delete mode 100644 util-vserver/lib_internal/pathinfo-test.c delete mode 100644 util-vserver/lib_internal/pathinfo.h delete mode 100644 util-vserver/lib_internal/string-destroy.c delete mode 100644 util-vserver/lib_internal/string.h delete mode 100644 util-vserver/lib_internal/string.hc delete mode 100644 util-vserver/lib_internal/switchtowatchxid.c delete mode 100644 util-vserver/lib_internal/testsuite/.cvsignore delete mode 100644 util-vserver/lib_internal/testsuite/Makefile-files delete mode 100644 util-vserver/lib_internal/testsuite/command.c delete mode 100644 util-vserver/lib_internal/unify-copy.c delete mode 100644 util-vserver/lib_internal/unify-deunify.c delete mode 100644 util-vserver/lib_internal/unify-settime.c delete mode 100644 util-vserver/lib_internal/unify-unify.c delete mode 100644 util-vserver/lib_internal/unify.h delete mode 100644 util-vserver/lib_internal/util-canonify.c delete mode 100644 util-vserver/lib_internal/util-cast.h delete mode 100644 util-vserver/lib_internal/util-commonstrings.h delete mode 100644 util-vserver/lib_internal/util-debug.h delete mode 100644 util-vserver/lib_internal/util-declarecmd.h delete mode 100644 util-vserver/lib_internal/util-dimof.h delete mode 100644 util-vserver/lib_internal/util-dotfile.h delete mode 100644 util-vserver/lib_internal/util-exitlikeprocess.c delete mode 100644 util-vserver/lib_internal/util-exitlikeprocess.h delete mode 100644 util-vserver/lib_internal/util-io.h delete mode 100644 util-vserver/lib_internal/util-lockfile.c delete mode 100644 util-vserver/lib_internal/util-lockfile.h delete mode 100644 util-vserver/lib_internal/util-mem.h delete mode 100644 util-vserver/lib_internal/util-perror.h delete mode 100644 util-vserver/lib_internal/util-safechdir.c delete mode 100644 util-vserver/lib_internal/util-safechdir.h delete mode 100644 util-vserver/lib_internal/util-unixsock.h delete mode 100644 util-vserver/lib_internal/util.h delete mode 100644 util-vserver/m4/changelog.am delete mode 100644 util-vserver/m4/ensc_cflags.m4 delete mode 100644 util-vserver/m4/ensc_changelog.m4 delete mode 100644 util-vserver/m4/ensc_cxxcompiler.m4 delete mode 100644 util-vserver/m4/ensc_dietlibc.m4 delete mode 100644 util-vserver/m4/ensc_dietlibc_compat.m4 delete mode 100644 util-vserver/m4/ensc_e2fscheck.m4 delete mode 100644 util-vserver/m4/ensc_fpicsyscall.m4 delete mode 100644 util-vserver/m4/ensc_initrddir.m4 delete mode 100644 util-vserver/m4/ensc_kerneldir.m4 delete mode 100644 util-vserver/m4/ensc_release.m4 delete mode 100644 util-vserver/m4/ensc_syscall.m4 delete mode 100644 util-vserver/m4/ensc_syscallnr.m4 delete mode 100644 util-vserver/m4/ensc_uv_vrootdir.m4 delete mode 100644 util-vserver/m4/gpgsig.am delete mode 100644 util-vserver/m4/pkgconfig.am delete mode 100644 util-vserver/m4/validate.am delete mode 100644 util-vserver/man/Makefile-files delete mode 100644 util-vserver/man/chbind.8 delete mode 100644 util-vserver/man/chcontext.8 delete mode 100644 util-vserver/man/distrib-info.8 delete mode 100644 util-vserver/man/rebootmgr.8 delete mode 100644 util-vserver/man/reducecap.8 delete mode 100644 util-vserver/man/vps.8 delete mode 100644 util-vserver/man/vpstree.8 delete mode 100644 util-vserver/man/vrpm.8 delete mode 100644 util-vserver/man/vserver-copy.8 delete mode 100644 util-vserver/man/vserver-stat.8 delete mode 100644 util-vserver/man/vserver.8 delete mode 100644 util-vserver/man/vtop.8 delete mode 100644 util-vserver/pathconfig.h.pathsubst delete mode 100644 util-vserver/scripts/.cvsignore delete mode 100644 util-vserver/scripts/Makefile-files delete mode 100755 util-vserver/scripts/chcontext delete mode 100644 util-vserver/scripts/functions delete mode 100644 util-vserver/scripts/legacy/.cvsignore delete mode 100755 util-vserver/scripts/legacy/distrib-info delete mode 100755 util-vserver/scripts/legacy/save_s_context delete mode 100755 util-vserver/scripts/legacy/vps.pathsubst delete mode 100755 util-vserver/scripts/legacy/vserver delete mode 100755 util-vserver/scripts/legacy/vserverkillall delete mode 100755 util-vserver/scripts/pkgmgmt delete mode 100755 util-vserver/scripts/rootshell delete mode 100755 util-vserver/scripts/start-vservers delete mode 100644 util-vserver/scripts/util-vserver-vars.pathsubst delete mode 100755 util-vserver/scripts/vapt-get delete mode 100755 util-vserver/scripts/vapt-get-worker delete mode 100755 util-vserver/scripts/vpkg delete mode 100755 util-vserver/scripts/vprocunhide delete mode 100755 util-vserver/scripts/vpstree delete mode 100755 util-vserver/scripts/vrpm delete mode 100755 util-vserver/scripts/vrpm-preload delete mode 100755 util-vserver/scripts/vrpm-worker delete mode 100755 util-vserver/scripts/vserver delete mode 100755 util-vserver/scripts/vserver-build delete mode 100644 util-vserver/scripts/vserver-build.apt-rpm delete mode 100644 util-vserver/scripts/vserver-build.debootstrap delete mode 100644 util-vserver/scripts/vserver-build.functions delete mode 100644 util-vserver/scripts/vserver-build.functions.apt delete mode 100644 util-vserver/scripts/vserver-build.functions.pkgmgmt delete mode 100644 util-vserver/scripts/vserver-build.functions.rpm delete mode 100644 util-vserver/scripts/vserver-build.skeleton delete mode 100755 util-vserver/scripts/vserver-copy delete mode 100644 util-vserver/scripts/vserver-setup.functions delete mode 100755 util-vserver/scripts/vserver-wrapper delete mode 100644 util-vserver/scripts/vserver.functions delete mode 100644 util-vserver/scripts/vserver.start delete mode 100644 util-vserver/scripts/vserver.stop delete mode 100644 util-vserver/scripts/vserver.suexec delete mode 100644 util-vserver/scripts/vservers.grabinfo.sh delete mode 100755 util-vserver/scripts/vshelper delete mode 100755 util-vserver/scripts/vsysvwrapper delete mode 100755 util-vserver/scripts/vtop delete mode 100644 util-vserver/src/.cvsignore delete mode 100644 util-vserver/src/Makefile-files delete mode 100644 util-vserver/src/capchroot.c delete mode 100644 util-vserver/src/chain-echo.c delete mode 100644 util-vserver/src/chbind.c delete mode 100644 util-vserver/src/chcontext.c delete mode 100644 util-vserver/src/chroot-cat.c delete mode 100644 util-vserver/src/chroot-rm.c delete mode 100644 util-vserver/src/chxid.c delete mode 100644 util-vserver/src/compat-pivot_root.h delete mode 100644 util-vserver/src/context-sync.hc delete mode 100644 util-vserver/src/exec-cd.c delete mode 100644 util-vserver/src/exec-ulimit.c delete mode 100644 util-vserver/src/fakerunlevel.c delete mode 100644 util-vserver/src/filetime.c delete mode 100644 util-vserver/src/fstool-resolvectx.c delete mode 100644 util-vserver/src/fstool.c delete mode 100644 util-vserver/src/fstool.h delete mode 100644 util-vserver/src/ifspec.c delete mode 100644 util-vserver/src/keep-ctx-alive.c delete mode 100644 util-vserver/src/listdevip.c delete mode 100644 util-vserver/src/lockfile.c delete mode 100644 util-vserver/src/lsxid.c delete mode 100644 util-vserver/src/mask2prefix.c delete mode 100644 util-vserver/src/parserpmdump.c delete mode 100644 util-vserver/src/readlink.c delete mode 100644 util-vserver/src/rebootmgr.c delete mode 100644 util-vserver/src/reducecap.c delete mode 100644 util-vserver/src/rpm-fake-resolver.c delete mode 100644 util-vserver/src/rpm-fake.c delete mode 100644 util-vserver/src/save_ctxinfo.c delete mode 100644 util-vserver/src/secure-mount.c delete mode 100644 util-vserver/src/secure-umount.c delete mode 100644 util-vserver/src/setattr.c delete mode 100644 util-vserver/src/showattr.c delete mode 100644 util-vserver/src/showperm.c delete mode 100644 util-vserver/src/sigexec.c delete mode 100644 util-vserver/src/stack-start.h delete mode 100644 util-vserver/src/sys_clone.h delete mode 100644 util-vserver/src/testsuite/.cvsignore delete mode 100644 util-vserver/src/testsuite/Makefile-files delete mode 100644 util-vserver/src/testsuite/chbind-test.c delete mode 100644 util-vserver/src/testsuite/chcontext-test.c delete mode 100644 util-vserver/src/testsuite/data/rpm-fake-test.inp delete mode 100644 util-vserver/src/testsuite/data/rpm-fake-test.out delete mode 100644 util-vserver/src/testsuite/rpm-fake-test.c delete mode 100755 util-vserver/src/testsuite/rpm-fake-test.sh delete mode 100644 util-vserver/src/testsuite/vunify-functest.c delete mode 100755 util-vserver/src/testsuite/vunify-test.sh delete mode 100644 util-vserver/src/util.h delete mode 100644 util-vserver/src/vattribute.c delete mode 100644 util-vserver/src/vbuild.cc delete mode 100644 util-vserver/src/vcheck.cc delete mode 100644 util-vserver/src/vcontext.c delete mode 100644 util-vserver/src/vcopy-init.hc delete mode 100644 util-vserver/src/vcopy.c delete mode 100644 util-vserver/src/vdu.c delete mode 100644 util-vserver/src/vfiles.cc delete mode 100644 util-vserver/src/vkill.c delete mode 100644 util-vserver/src/vlimit.c delete mode 100644 util-vserver/src/vnamespace.c delete mode 100644 util-vserver/src/vps.c delete mode 100644 util-vserver/src/vreboot.c delete mode 100644 util-vserver/src/vrsetup.c delete mode 100644 util-vserver/src/vsched.c delete mode 100644 util-vserver/src/vserver-info.c delete mode 100644 util-vserver/src/vserver-stat.c delete mode 100644 util-vserver/src/vserver-visitdir.hc delete mode 100644 util-vserver/src/vserver.cc delete mode 100644 util-vserver/src/vserver.hh delete mode 100644 util-vserver/src/vshelper-sync.c delete mode 100644 util-vserver/src/vuname.c delete mode 100644 util-vserver/src/vunify-init.hc delete mode 100644 util-vserver/src/vunify.c delete mode 100644 util-vserver/src/vunify.h delete mode 100644 util-vserver/src/vutil.cc delete mode 100644 util-vserver/src/vutil.h delete mode 100644 util-vserver/src/vutil.p delete mode 100644 util-vserver/sysv/.cvsignore delete mode 100644 util-vserver/sysv/Makefile-files delete mode 100755 util-vserver/sysv/rebootmgr delete mode 100755 util-vserver/sysv/v_gated.subst delete mode 100755 util-vserver/sysv/v_httpd.subst delete mode 100755 util-vserver/sysv/v_named.subst delete mode 100755 util-vserver/sysv/v_portmap.subst delete mode 100755 util-vserver/sysv/v_sendmail.subst delete mode 100755 util-vserver/sysv/v_smb.subst delete mode 100755 util-vserver/sysv/v_sshd.subst delete mode 100755 util-vserver/sysv/v_xinetd.subst delete mode 100755 util-vserver/sysv/vprocunhide delete mode 100755 util-vserver/sysv/vservers-default delete mode 100755 util-vserver/sysv/vservers-legacy delete mode 100644 util-vserver/sysv/vservers.conf delete mode 100644 util-vserver/tests/.cvsignore delete mode 100644 util-vserver/tests/Makefile-files delete mode 100644 util-vserver/tests/chrootsafe.c delete mode 100644 util-vserver/tests/escaperoot.c delete mode 100644 util-vserver/tests/forkbomb.c delete mode 100644 util-vserver/tests/getctx.c delete mode 100644 util-vserver/tests/getinitpid.c delete mode 100644 util-vserver/tests/testipc.c delete mode 100644 util-vserver/tests/testlimit.c delete mode 100644 util-vserver/tests/testopenf.c delete mode 100644 util-vserver/tests/vserver-info.c delete mode 100644 util-vserver/util-vserver.spec.in delete mode 100644 util-vserver/vserver-start/.cvsignore delete mode 100644 util-vserver/vserver-start/Makefile-files delete mode 100644 util-vserver/vserver-start/configuration-init.c delete mode 100644 util-vserver/vserver-start/configuration.c delete mode 100644 util-vserver/vserver-start/configuration.h delete mode 100644 util-vserver/vserver-start/interface-add.c delete mode 100644 util-vserver/vserver-start/interface-free.hc delete mode 100644 util-vserver/vserver-start/interface-init.hc delete mode 100644 util-vserver/vserver-start/interface-read.c delete mode 100644 util-vserver/vserver-start/interface.c delete mode 100644 util-vserver/vserver-start/interface.h delete mode 100644 util-vserver/vserver-start/main.c delete mode 100644 util-vserver/vserver-start/scriptlets.c delete mode 100644 util-vserver/vserver-start/vserver-start.h delete mode 100644 util-vserver/vserver-start/vshelper.c delete mode 100644 util-vserver/vserver-start/vshelper.h diff --git a/util-vserver/.cvsignore b/util-vserver/.cvsignore deleted file mode 100644 index e593186..0000000 --- a/util-vserver/.cvsignore +++ /dev/null @@ -1,42 +0,0 @@ -.*-up-to-date -.buexl -.deps -.gdb_history -.pathconfig.h.pathsubst.stamp -Build-* -COPYING -ChangeLog -FEATURES.txt -INSTALL -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -autoscan.log -compile -config.cache -config.guess -config.h -config.h.in -config.log -config.status -config.sub -configure -configure.scan -depcomp -install-sh -libtool -linuxcaps.h -ltmain.sh -missing -mkinstalldirs -pathconfig.h -stamp-h1 -stamp-h2 -util-vserver*.diff* -util-vserver*.patch* -util-vserver-*.tar.bz2* -util-vserver-*.tar.gz -util-vserver.spec -vserver.spec -vserverx-*.tar.* diff --git a/util-vserver/AUTHORS b/util-vserver/AUTHORS deleted file mode 100644 index db53813..0000000 --- a/util-vserver/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Enrico Scholz diff --git a/util-vserver/ChangeLog.sed b/util-vserver/ChangeLog.sed deleted file mode 100644 index dea67bc..0000000 --- a/util-vserver/ChangeLog.sed +++ /dev/null @@ -1 +0,0 @@ -s!ensc@kosh.ultra.csn.tu-chemnitz.de!enrico.scholz@informatik.tu-chemnitz.de!g diff --git a/util-vserver/Makefile.am b/util-vserver/Makefile.am deleted file mode 100644 index 5a20d15..0000000 --- a/util-vserver/Makefile.am +++ /dev/null @@ -1,270 +0,0 @@ -## $Id$ - -# Copyright (C) 2003,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; either version 2, or (at your option) -# any later version. -# -# 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. -# - -ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = . distrib - -CVS2CL_AMFLAGS = $(CVS2CL_TAG) -U cvsusers.map --show-dead -CVS2CL_ALLFLAGS := $(CVS2CL_AMFLAGS) $(CVS2CL_FLAGS) - -confdir = $(sysconfdir)/vservers -confdefaultsdir = $(confdir)/.defaults -sbincfgdir = $(sbindir) -legacydir = $(pkglibdir)/legacy - -include_HEADERS = -noinst_HEADERS = $(ENSC_VECTOR_HDRS) \ - compat.h compat-c99.h - -noinst_LIBRARIES = $(ENSC_VECTOR_LIBS) -lib_LIBRARIES = -lib_LTLIBRARIES = -pkglib_LTLIBRARIES = - -pkglib_SCRIPTS = -pkglib_DATA = FEATURES.txt -pkglib_PROGRAMS = -legacy_SCRIPTS = -legacy_PROGRAMS = - -sbin_SCRIPTS = -sbin_PROGRAMS = -noinst_PROGRAMS = -noinst_DATA = - -initrd_SCRIPTS = -sysconf_DATA = - -DIETPROGS = $(ENSC_VECTOR_LIBS) - -BUILT_SOURCES = linuxcaps.h pathconfig.h linuxvirtual.h \ - .fixups - -man_MANS = - -kernel_HDRS = kernel/context.h \ - kernel/inode.h \ - kernel/legacy.h \ - kernel/limit.h \ - kernel/namespace.h \ - kernel/network.h \ - kernel/sched.h \ - kernel/signal.h \ - kernel/switch.h - -EXTRA_PROGRAMS = -EXTRA_DIST = pathconfig.h.pathsubst \ - util-vserver.spec \ - THANKS \ - $(kernel_HDRS) - -check_PROGRAMS = -check_SCRIPTS = -TESTS = - -TESTS_ENVIRONMENT = - -AM_CPPFLAGS = -I $(top_srcdir)/lib -I $(top_srcdir)/ensc_wrappers \ - -D_GNU_SOURCE -D_REENTRANT $(RELEASE_CPPFLAGS) - -CLEANFILES = $(BUILT_SOURCES) \ - .*.pathsubst.stamp */.*.pathsubst.stamp */*/.*.pathsubst.stamp \ - linuxcaps.h pathconfig.h .fixups - -DISTCLEANFILES = FEATURES.txt - - -AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = - -LIBTOOL_CC = @LIBTOOL@ --tag CC -LIBTOOL_CXX = @LIBTOOL@ --tag CXX - -if USE_DIETLIBC -DIET = diet -DIET_FLAGS = -DIET_CC := $(DIET) $(DIET_FLAGS) $(CC) -DIET_LIBTOOL := $(LIBTOOL_CC) -VSERVER_LDFLAGS := -static -else -VSERVER_LDFLAGS := -endif - -if USE_DIETLIBC_COMPAT -DIET_COMPAT_LDADDS = -lcompat -else -DIET_COMPAT_LDADDS = -endif - -VSERVER_LDADDS = lib/libvserver.la $(DIET_COMPAT_LDADDS) - -silent.%: FORCE - @t=$$(mktemp /tmp/build.XXXXXX) && \ - $(MAKE) '$*' -s 2>$$t >/dev/null && \ - ( cat $$t | \ - grep -v ': In function' | \ - grep -v 'your code still has assertions enabled' | \ - grep -v ' is obsoleted' | \ - grep -v 'warning: #warning'; \ - rm -f $$t || : ) - -linuxcaps.h: ${kernelincludedir}/linux/capability.h Makefile - @rm -f $@ - echo '#include ' >$@.tmp - $(SED) -e 's!^#include .*!!g;s!\<__u32\>!uint32_t!g;s!\<__user\>!!g;' $< >>$@.tmp - @-chmod --reference $< $@.tmp &>/dev/null - mv -f $@.tmp $@ - @chmod a-w $@ - - -linuxvirtual.h: -if ENSC_ENABLE_INTERNAL_HEADERS - ln -sf '$(top_srcdir)/lib/virtual.h' '$@' -else - ln -sf '$(kernelincludedir)/linux/virtual.h' '$@' && test -e '$@' || \ - ln -sf '$(top_srcdir)/lib/virtual.h' '$@' -endif - -pathsubst_RULES = s!@'PKGLIBDIR'@!$(pkglibdir)!g; \ - s!@'LEGACYDIR'@!$(legacydir)!g; \ - s!@'SBINDIR'@!$(sbindir)!g; \ - s!@'CONFDIR'@!$(confdir)!g; \ - s!@'SYSCONFDIR'@!$(sysconfdir)!g; \ - s!@'PKGSTATEDIR'@!$(pkgstatedir)!g; \ - s!@'PKGSTATEREVDIR'@!$(pkgstaterevdir)!g; \ - s!@'VSERVERDIR'@!$(vserverdir)!g; \ - s!@'VSERVERPKGDIR'@!$(vserverpkgdir)!g; \ - s!@'VSERVERPKGDIR'@!$(vserverpkgdir)!g; \ - s!@'VSHELPERSTATEDIR'@!$(vshelperstatedir)!g; \ - s!@'INITRDDIR'@!$(initrddir)!g; \ - s!@'LIBDIR'@!$(libdir)!g; \ - s!@'MANDIR'@!$(mandir)!g; \ - s!@'INCLUDEDIR'@!$(includedir)!g; \ - s!@'PACKAGE'@!$(PACKAGE)!g; \ - s!@'PACKAGE_BUGREPORT'@!$(PACKAGE_BUGREPORT)!g; \ - s!@'PACKAGE_NAME'@!$(PACKAGE_NAME)!g; \ - s!@'PACKAGE_STRING'@!$(PACKAGE_STRING)!g; \ - s!@'PACKAGE_TARNAME'@!$(PACKAGE_TARNAME)!g; \ - s!@'PACKAGE_VERSION'@!$(PACKAGE_VERSION)!g; \ - s!@'AWK'@!$(AWK)!g; \ - s!@'ENV'@!$(ENV)!g; \ - s!@'GREP'@!$(GREP)!g; \ - s!@'IP'@!$(IP)!g; \ - s!@'IPTABLES'@!$(IPTABLES)!g; \ - s!@'MODPROBE'@!$(MODPROBE)!g; \ - s!@'MOUNT'@!$(MOUNT)!g; \ - s!@'NAMEIF'@!$(NAMEIF)!g; \ - s!@'NICE'@!$(NICE)!g; \ - s!@'PS'@!$(PS)!g; \ - s!@'RMMOD'@!$(RMMOD)!g; \ - s!@'TAR'@!$(TAR)!g; \ - s!@'UMOUNT'@!$(UMOUNT)!g; \ - s!@'VCONFIG'@!$(VCONFIG)!g; \ - s!@'WC'@!$(WC)!g; \ - s!@'WGET'@!$(WGET)!g; \ - s!@'XSLTPROC'@!$(XSLTPROC)!g; \ - s!@'ENSC_HAVE_C99_COMPILER_TRUE'@!\@ENSC_HAVE_C99_COMPILER_TRUE@ !g; \ - s!@'ENSC_HAVE_C99_COMPILER_FALSE'@!\@ENSC_HAVE_C99_COMPILER_FALSE@ !g; \ - s!@'ENSC_HAVE_CXX_COMPILER_TRUE'@!\@ENSC_HAVE_CXX_COMPILER_TRUE@ !g; \ - s!@'ENSC_HAVE_CXX_COMPILER_FALSE'@!\@ENSC_HAVE_CXX_COMPILER_FALSE@ !g; - -pathconfig.h: .pathconfig.h.pathsubst.stamp -.%.pathsubst.stamp: %.pathsubst Makefile - @mkdir -p $$(dirname '$@') - @echo "$(SED) -e '...' $*.pathsubst >$*" - @$(SED) -e '$(pathsubst_RULES)' '$<' >'$@.tmp' - @-chmod --reference='$<' '$@.tmp' - @if cmp -s '$@.tmp' '$*'; then \ - echo "... no changes, reusing old version"; \ - rm -f '$@.tmp'; \ - else \ - rm -f '$*'; mv '$@.tmp' '$*'; \ - fi - @chmod a-w '$*' - @touch '$@' - -pkgstatedir = $(localstatedir)/run/vservers -pkgstaterevdir = $(pkgstatedir).rev -vserverpkgdir = $(vserverdir)/.pkg -vshelperstatedir = $(localstatedir)/run/vshelper - -fix_SCRPTS = $(addprefix $(pkglibdir)/, $(notdir $(pkglib_SCRIPTS))) \ - $(addprefix $(legacydir)/, $(notdir $(legacy_SCRIPTS))) \ - $(addprefix $(sbindir)/, $(notdir $(sbin_SCRIPTS))) \ - $(addprefix $(initrddir)/, $(notdir $(initrd_SCRIPTS))) - -install-data-hook: install-fix-script-paths install-create-dirs - -install-create-dirs: - $(mkinstalldirs) -m 755 $(DESTDIR)$(pkgstatedir) $(DESTDIR)$(pkgstaterevdir) $(DESTDIR)$(vshelperstatedir) - $(mkinstalldirs) -m 755 $(DESTDIR)$(confdefaultsdir) - f=$(DESTDIR)$(confdefaultsdir)/vdirbase; test -e "$$f" || ln -sf '$(vserverdir)' "$$f" - f=$(DESTDIR)$(confdefaultsdir)/run.rev; test -e "$$f" || ln -sf '$(pkgstaterevdir)' "$$f" - -install-fix-script-paths: - test "/usr/lib/util-vserver" = "$(pkglibdir)" || \ - for i in $(fix_SCRPTS); do \ - f="$(DESTDIR)$$i"; \ - $(SED) -e 's!/usr/lib/util-vserver!$(pkglibdir)!g' "$$f" >"$$f.tmp"; \ - $(CMP) -s "$$f.tmp" "$$f" || cat "$$f.tmp" >"$$f"; \ - rm -f "$$f.tmp"; \ - done - -install-distribution: _install-vserverdir _install-vshelperlink - -_install-vshelperlink: - $(mkinstalldirs) $(DESTDIR)/sbin - ln -sf ..$(pkglibdir)/vshelper $(DESTDIR)/sbin/vshelper - -_install-vserverdir: - $(mkinstalldirs) $(DESTDIR)$(vserverdir) $(DESTDIR)$(vserverpkgdir) - -.fixups: config.status util-vserver.spec - chmod a-w util-vserver.spec - touch $@ - -if USE_DIETLIBC -$(addsuffix $(EXEEXT), $(DIETPROGS)) \ -$(addsuffix $(OBJEXT), $(DIETPROGS)) \ - : LIBTOOL=$(DIET_LIBTOOL) - -$(addsuffix $(EXEEXT), $(DIETPROGS)) \ -$(addsuffix $(OBJEXT), $(DIETPROGS)) \ - : CC=$(DIET_CC) -endif - -include $(top_srcdir)/lib/Makefile-files -include $(top_srcdir)/src/Makefile-files -include $(top_srcdir)/doc/Makefile-files -include $(top_srcdir)/man/Makefile-files -include $(top_srcdir)/scripts/Makefile-files -include $(top_srcdir)/tests/Makefile-files -include $(top_srcdir)/sysv/Makefile-files -include $(top_srcdir)/contrib/Makefile-files -include $(top_srcdir)/ensc_vector/Makefile-files -include $(top_srcdir)/ensc_wrappers/Makefile-files -include $(top_srcdir)/ensc_fmt/Makefile-files -include $(top_srcdir)/lib_internal/Makefile-files -include $(top_srcdir)/vserver-start/Makefile-files - -include $(top_srcdir)/m4/gpgsig.am -include $(top_srcdir)/m4/validate.am -include $(top_srcdir)/m4/changelog.am -include $(top_srcdir)/m4/pkgconfig.am - -.PHONY: FORCE diff --git a/util-vserver/NEWS b/util-vserver/NEWS deleted file mode 100644 index ad4f141..0000000 --- a/util-vserver/NEWS +++ /dev/null @@ -1,10 +0,0 @@ -version 0.30.190 -================ - - - large revamping... - - -version 0.23.6 -============== - - - fixed '--level' option on 'vserver ... chkconfig' diff --git a/util-vserver/README b/util-vserver/README deleted file mode 100644 index d5e8fd0..0000000 --- a/util-vserver/README +++ /dev/null @@ -1,117 +0,0 @@ -Some common notes/FAQs: -====================== - -* when vserver startup/shutdown fails, or when you get - - | Error: /proc must be mounted - - errors, make sure, that 'vprocunhide' was executed. When installing - 'util-vserver' with packagemanagement, an appropriate initscript - should be installed - -* the name of old-style vservers is not shown; the needed functionality - is not implemented - - - -Some distribution specific notes: -================================= - -Red Hat 7.3, Red Hat 9, Fedora Core 1&2 ---------------------------------------- -* tested and running successfully as host and guest systems - -* it is *strongly* suggested to use the rpm packages which can be - created from the tarball with - - | $ rpmbuild -tb util-vserver-.tar.bz2 - - For distributions below Fedora Core 2, additional - - | --without dietlibc --without xalan - - flags are required for the 'rpmbuild' command. Builds on Red Hat 7.3 - will require a - - | --nodeps - - also, since 'vconfig' is not available there. Since it is required - for path-detection only and paths from RH systems will be assumed by - default, this should not be a big problem. - -* guest systems can be created with the 'apt-rpm' build-method. This - requires the 'apt' package e.g. from http://fedora.us. Before first - invocation, a near mirror should be activated in - - | /etc/vservers/.distributions//apt/sources.list - - (To avoid slashdotting by the masses of util-vserver-users, there - does not exist a standard mirror) - -* RH/FC uses the 'sysv' initstyle which is assumed by default - -* when having existing vservers with RH 9 or Fedora Core 1, the startup - of the vserver will probably fail. You will have to add - - | true - - to etc/rc.d/rc (within the vserver root directory) - -* when having RH/FC guestsystems, it is *strongly* recommended to use - a dietlibc linked version of 'rpm-fake-resolver'. Else, package - installation with 'vrpm' or 'vapt-get' can fail since users can not - be resolved. - - - -Debian Woody & Sarge --------------------- -* tested and running successfully as guest systems on FC1/FC2 hosts - -* guest systems can be created with the 'debootstrap' method. When - not already existing, the needed package will be downloaded - automatically. Since it is updated very often, it can happen - that a '404 Not found' error occurs; in this case look either - for a newer util-vserver package, or configure the new URI e.g. with - - | echo 'http://ftp.debian.org/debian/pool/main/d/debootstrap/debootstrap__i386.deb' \ - | >/etc/vservers/.defaults/apps/debootstrap/uri - - You can download a local copy of this tarball also, and register it - with - - | echo '/' \ - | >/etc/vservers/.defaults/apps/debootstrap/uri - -* it is known, that warning messages will be created at startup and - shutdown of guest servers. This is non fatal and can be ignored - -* Debian guest systems are running fine with the 'sysv' initstyle; - success with 'plain' was reported also - -* no packages for Debian hosts are known at time of writing (May 2004) - - - -Gentoo ------- -* Gentoo guest systems are very complicated and are requiring lots of - modifications in the initscripts. Currently, no step-by-step guide - can be provided - -* 'sysv' initstyle is probably not working for Gentoo guests (e.g. you - will see messages about missing 'utmp' files); 'gentoo' should be - used instead of: - - | echo 'gentoo' >/etc/vservers//apps/init/style - -* there does not exist a build-method for Gentoo guests; instead of, - create a skeleton with - - | # vserver build -m skeleton --initstyle gentoo * - - and fill the vserver directory at /etc/vservers//vdir/ manually. - - - -## $Id$ diff --git a/util-vserver/THANKS b/util-vserver/THANKS deleted file mode 100644 index a4232db..0000000 --- a/util-vserver/THANKS +++ /dev/null @@ -1,14 +0,0 @@ -I want to thank - -Jacques Gelinas , - who wrote and maintains the 'vserver' package on which util-vserver - is based on - -Sam Vilain, - for providing man-pages and patches used in the Debian package - -Olivier Poitrey - for his work on the XML/XSD based documentation format - - -all the other people, who contributed to the original 'vserver' package diff --git a/util-vserver/build-all b/util-vserver/build-all deleted file mode 100755 index 86b7f9d..0000000 --- a/util-vserver/build-all +++ /dev/null @@ -1,88 +0,0 @@ -#! /bin/sh - -# 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. - -set -e - -confflags="-C --enable-maintainer-mode --prefix=/usr --sysconfdir=/etc --localstatedir=/var" -configure="`pwd`/configure $confflags" -make=eval\ "${CLEAN:+make -j2 silent.clean}${CLEAN:-:}; \ - echo -e \"== executing 'make all'...\" && \ - make -j2 ${SILENT:+-s silent.}all && \ - echo -e \"\n== executing 'make check'...\" && \ - make -j2 ${SILENT:+-s silent.}check" - -LANG=C - -## Usage: xtermTitle -function xtermTitle -{ - tty -s || return 0 - echo -ne "\e]0;$@\007" -} - -## Usage: operate <dir> <configure-opts>* -function operate() -{ - d=$1 - shift - - echo "******************" - echo $"** Operating in directory '$d'..." - xtermTitle "Operating in directory '$d'... ($@)" - - mkdir -p $d && cd $d - - test -e Makefile || $configure "$@" - $make - cd - -} - -case "$1" in - dist) - test -e Makefile || ./configure $confflags - $make - exit - ;; - debian-woody|debian-sarge|fc-1-90|fc-1|fc-2) - cat util-vserver-"$2".tar.bz2 | \ - ssh $1 "cd /tmp && rm -rf /tmp/util-vserver-* && \ - tar xjf - && cd util-vserver-$2 && \ - export PATH=/usr/lib/ccache:/usr/lib/ccache/bin:\$PATH && \ - ./configure && \ - make ${SILENT:+-s silent.}all && \ - echo -e '\n\n\n' && - make ${SILENT:+-s silent.}check" - exit - ;; - *) test -z "$1" || { - echo $"Unknown option '$1'" >&2 - exit 1 - } -esac - -test -d "Build" || { - d=$(mktemp -d /tmp/build-ensc.XXXXXX) - rm -f Build - ln -sf $d Build -} - -operate Build/diet-noopt CFLAGS='-O0 -g3' CXXFLAGS='-O0 -g3' -operate Build/diet-opt --enable-release -operate Build/nodiet-noopt --disable-dietlibc CFLAGS='-O0 -g3' CXXFLAGS='-O0 -g3' -operate Build/nodiet-opt --enable-release --disable-dietlibc -operate Build/gcc32-opt --enable-release --disable-dietlibc CC='ccache gcc32' CXX='ccache g++' -operate Build/gcc35-opt --enable-release --disable-dietlibc CC='ccache gcc35' CXX='ccache g++35' diff --git a/util-vserver/compat-c99.h b/util-vserver/compat-c99.h deleted file mode 100644 index 8317fc8..0000000 --- a/util-vserver/compat-c99.h +++ /dev/null @@ -1,31 +0,0 @@ -// $Id$ --*- c -*-- - -// Copyright (C) 2003 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. - - -#ifndef H_UTIL_VSERVER_COMPAT_C99_H -#define H_UTIL_VSERVER_COMPAT_C99_H - -#if defined(__GNUC__) && __GNUC__ < 3 || (__GNUC__==3 && __GNUC_MINOR__<3) -# warning Enabling hacks to make it compilable with non-C99 compilers -# define BS { do {} while (0) -# define BE } do {} while (0) -#else -# define BS do {} while (0) -# define BE do {} while (0) -#endif - -#endif // H_UTIL_VSERVER_COMPAT_C99_H diff --git a/util-vserver/compat.h b/util-vserver/compat.h deleted file mode 100644 index 43d920c..0000000 --- a/util-vserver/compat.h +++ /dev/null @@ -1,102 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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. - - -#ifndef H_UTIL_VSERVER_COMPAT_H -#define H_UTIL_VSERVER_COMPAT_H - -#if defined(__dietlibc__) && !defined(ENSC_DIETLIBC_C99) && defined(__STRICT_ANSI__) && defined(__STDC_VERSION__) -# include <sys/cdefs.h> -# undef inline - -# undef __STRICT_ANSI__ -# include <stdint.h> -# define __STRICT_ANSI__ -#endif - -#if defined(__dietlibc__) -# define ENSC_FIX_IOCTL(X) do { if ((X)<-1) { errno=-(X); (X) = -1; } } while (0) -#else -# define ENSC_FIX_IOCTL(X) do { } while (0) -#endif - -#if defined(__GNUC__) -# define UNUSED __attribute__((__unused__)) -# define NORETURN __attribute__((__noreturn__)) -# define CONST __attribute__((__const__)) -# if __GNUC__*0x10000 + __GNUC_MINOR__*0x100 + __GNUC_PATCHLEVEL__ >= 0x30300 -# define NONNULL(ARGS) __attribute__((__nonnull__ ARGS)) -# define ALWAYSINLINE __attribute__((__always_inline__)) -# else -# define NONNULL(ARGS) -# define ALWAYSINLINE -# define PURE -# endif -# if __GNUC__*0x10000 + __GNUC_MINOR__*0x100 + __GNUC_PATCHLEVEL__ >= 0x30303 -# define PURE __attribute__((__pure__)) -# else -# define PURE -# endif -#else -# define NONNULL(ARGS) -# define UNUSED -# define NORETURN -# define ALWAYSINLINE -# define PURE -# define CONST -#endif - - // shamelessly stolen from dietlibc -#define LINK_WARNING(symbol,msg) \ - __asm__ (".section .gnu.warning." symbol "\n\t.string \"" msg "\"\n\t.previous") - -#if !defined(__builtin_expect) && (__GNUC__+0)<3 -# define __builtin_expect(foo,bar) (foo) -#endif - -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__<199901L) -# define restrict -#endif - -#if !defined(HAVE_DECL_MS_MOVE) || !(HAVE_DECL_MS_MOVE) - // from <linux/fs.h> -# define MS_MOVE 8192 -#endif - -#ifndef HAVE_XID_T -#include <stdint.h> -typedef uint32_t xid_t; -#endif - -#ifndef HAVE_NID_T -#include <stdint.h> -typedef uint32_t nid_t; -#endif - - -#if defined(__dietlibc__) - #define TEMP_FAILURE_RETRY(expression) \ - (__extension__ \ - ({ long int __result; \ - do __result = (long int) (expression); \ - while (__result == -1L && errno == EINTR); \ - __result; })) -#endif - -#define FMT_PREFIX utilvserver_fmt_ - -#endif // H_UTIL_VSERVER_COMPAT_H diff --git a/util-vserver/configure.ac b/util-vserver/configure.ac deleted file mode 100644 index aa87e7d..0000000 --- a/util-vserver/configure.ac +++ /dev/null @@ -1,240 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2003,2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 2, or (at your option) -dnl any later version. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -dnl -dnl -dnl As a special exception to the GNU General Public License, if you -dnl distribute this file as part of a program that contains a configuration -dnl script generated by Autoconf, you may include it under the same -dnl distribution terms that you use for the rest of that program. -dnl - -AC_PREREQ(2.57) -AC_INIT(util-vserver, 0.30.190, enrico.scholz@informatik.tu-chemnitz.de) -AC_CONFIG_SRCDIR([src/capchroot.c]) -AC_CONFIG_HEADER([config.h]) - -AM_INIT_AUTOMAKE([gnits dist-bzip2 subdir-objects]) -AM_MAINTAINER_MODE - -AC_SUBST(GPG_KEY, "0x7AE5D4B5922F7AF9!") - -# Checks for programs. -AC_PROG_CXX -AC_PROG_CC -AC_PROG_INSTALL -AC_PROG_LN_S -dnl AC_PROG_RANLIB -AC_PROG_LIBTOOL -AM_PROG_CC_C_O -ENSC_CXXCOMPILER -ENSC_C99COMPILER - -check_paths=$PATH:/sbin:/usr/sbin:/usr/local/sbin -AC_PATH_PROGS(AWK, [awk], [awk], [ $check_paths ]) -AC_PATH_PROGS(GREP, [grep], [grep], [ $check_paths ]) -AC_PATH_PROGS(IP, [ip], [ip], [ $check_paths ]) -AC_PATH_PROGS(MOUNT, [mount], [/bin/mount], [ $check_paths ]) -AC_PATH_PROGS(UMOUNT, [umount], [/bin/umount], [ $check_paths ]) -AC_PATH_PROGS(NICE, [nice], [nice], [ $check_paths ]) -AC_PATH_PROGS(VCONFIG, [vconfig], [vconfig], [ $check_paths ]) -AC_PATH_PROGS(WC, [wc], [wc], [ $check_paths ]) -AC_PATH_PROGS(PS, [ps], [/bin/ps], [ $check_paths ]) -AC_PATH_PROGS(MODPROBE, [modprobe], [/sbin/modprobe], [ $check_paths ]) -AC_PATH_PROGS(RMMOD, [rmmod], [/sbin/rmmod], [ $check_paths ]) -AC_PATH_PROGS(NAMEIF, [nameif], [/sbin/nameif], [ $check_paths ]) -AC_PATH_PROGS(IPTABLES, [iptables], [/sbin/iptables], [ $check_paths ]) -AC_PATH_PROGS(ENV, [env], [/usr/bin/env]) -AC_PATH_PROGS(SED, [sed], [sed]) -AC_PATH_PROGS(CMP, [cmp], [cmp]) -AC_PATH_PROGS(WGET, [wget], [wget]) -AC_PATH_PROGS(DOXYGEN, [doxygen], [:]) -AC_PATH_PROGS(TAR, [tar]) -AC_PATH_PROGS(XSLTP, [xsltp]) - -AM_CONDITIONAL(HAVE_XSLTP, test "$XSLTP") - - -ENSC_CHECK_CC_FLAG([-std=c99 -Wall -pedantic -W]) -ENSC_CHECK_CXX_FLAG([-ansi -Wall -pedantic -W -fmessage-length=0]) - -ENSC_FPIC_SYSCALL - - -AC_MSG_CHECKING([whether to enable debug-code in library]) -AC_ARG_ENABLE([lib-debug], - [AC_HELP_STRING([--enable-lib-debug], - [enable additional debug code in library (default: no)])], - [case "$enableval" in - yes) use_lib_debug=1;; - no) use_lib_debug=;; - *) AC_MSG_ERROR(['$enableval' is not a valid value for '--enable-lib-debug']);; - esac], - [ use_lib_debug= ]) - -if test x"$use_lib_debug" = x; then - AC_SUBST(LIB_DEBUG_CPPFLAGS, [-DNDEBUG]) - AC_MSG_RESULT(no) -else - AC_SUBST(LIB_DEBUG_CPPFLAGS, []) - AC_MSG_RESULT(yes) -fi - -AC_ARG_VAR(CC, [The C compiler]) - -ENSC_INITRDDIR(initrddir) -ENSC_RELEASE(RELEASE_CPPFLAGS) -ENSC_ENABLE_DIETLIBC(USE_DIETLIBC, [0.24]) - -if test x"$ensc_have_dietlibc" = xno; then - AC_MSG_WARN([*** ***]) - AC_MSG_WARN([*** it is strongly recommended to link util-vserver against ***]) - AC_MSG_WARN([*** dietlibc; glibc's NSS functions are very unreliable in ***]) - AC_MSG_WARN([*** chroot() environments, so you have to expect problems ***]) - AC_MSG_WARN([*** there. ***]) - AC_MSG_WARN([*** ***]) - AM_CONDITIONAL(USE_DIETLIBC_COMPAT, false) -else - ENSC_DIETLIBC_NEED_COMPAT(USE_DIETLIBC_COMPAT) -fi - - -ENSC_KERNEL_HEADERS(kernelincludedir) -ENSC_UV_VROOTDIR(vserverdir) -ENSC_CHANGELOG([trunk]) - -dnl Check whether to use external kernel headers -AC_MSG_CHECKING([whether to use internal kernel headers]) -AC_ARG_ENABLE([internal-headers], - [AC_HELP_STRING([--disable-internal-headers], - [use vserver specific headers from the kernel instead of the shipped versions (default: no)])], - [case "$enableval" in - yes|no) ;; - *) AC_MSG_ERROR(['$i' is not a supported value for '--disable-internal-headers']);; - esac], - [enable_internal_headers=yes]) - -AM_CONDITIONAL(ENSC_ENABLE_INTERNAL_HEADERS, [test x"$enable_internal_headers" = xyes]) -AC_MSG_RESULT([$enable_internal_headers]) - - -dnl Check for the APIs to be used -AC_MSG_CHECKING([for supported APIs]) -AC_ARG_ENABLE([apis], - [AC_HELP_STRING([--enable-apis=APIS], - [enable support for the given apis; possible values are: legacy,compat,v11,v13,fscompat,net,ALL (default: all except 'legacy')])], - [], - [enable_apis=compat,v11,v13,fscompat,net]) - -test x"$enable_apis" != xALL || enable_apis='legacy,compat,v11,v13,fscompat,net' -enable_api_oldproc= -enable_api_olduts= -old_IFS=$IFS -IFS=,; -for i in $enable_apis; do - case "$i" in - compat) AC_DEFINE(VC_ENABLE_API_COMPAT, 1, [Enable support for compatibility syscall API]) - enable_api_oldproc=1 - enable_api_olduts=1 - ;; - legacy) AC_DEFINE(VC_ENABLE_API_LEGACY, 1, [Enable support for old, /proc parsing API]) - enable_api_old_proc=1 - enable_api_olduts=1 - ;; - v11) AC_DEFINE(VC_ENABLE_API_V11, 1, [Enable support for API of vserver 1.1.x]) - enable_api_oldproc=1 - enable_api_olduts=1 - ;; - v13) AC_DEFINE(VC_ENABLE_API_V13, 1, [Enable support for API of vserver 1.3.x]);; - net) AC_DEFINE(VC_ENABLE_API_NET, 1, [Enable support for network context API]);; - fscompat) AC_DEFINE(VC_ENABLE_API_FSCOMPAT, 1, [Enable support for filesystem compatibility API]);; - *) AC_MSG_ERROR(['$i' is not a supported API]);; - esac -done -IFS=$old_IFS -if test x"$enable_api_oldproc" != x; then - AC_DEFINE(VC_ENABLE_API_OLDPROC, 1, [Enable API for a backward compatible /proc parsing]) - enable_apis="$enable_apis,oldproc" -fi -if test x"$enable_api_olduts" != x; then - AC_DEFINE(VC_ENABLE_API_OLDUTS, 1, [Enable API for a backward compatible uts handling]) - enable_apis="$enable_apis,olduts" -fi -AC_MSG_RESULT([$enable_apis]) - -ENSC_SYSCALLNR(vserver,273) -ENSC_SYSCALL -ENSC_CHECK_EXT2FS_HEADER -AC_CHECK_FUNCS([vserver]) -AC_CHECK_DECLS(MS_MOVE,,,[#include <linux/fs.h>]) -AC_CHECK_TYPES(xid_t,,,[#include <sys/types.h>]) -AC_CHECK_TYPES(nid_t,,,[#include <sys/types.h>]) - -dnl BIG HACK! Do some autodetection here! -AC_DEFINE(UTMP_GID, [22], [The utmp gid-number]) - -if false; then - AC_DEFINE(HAVE_GROWING_STACK, [1], [Define to 1 if the stack is on growing addresses]) -fi - - -ensc_cxx_affected=" (affected: vbuild, vcheck)" -ensc_c99_affected=" (affected: vunify, vcopy)" -ensc_diet_msg=" (you have been warned)" -ensc_diet_compat_msg=" (using -lcompat)" -test x"$ensc_cv_cxx_cxxcompiler" = xno || ensc_cxx_affected= -test x"$ensc_cv_c99_c99compiler" = xno || ensc_c99_affected= -test x"$ensc_have_dietlibc" = xno || ensc_diet_msg= -test x"$ensc_have_dietlibc$ensc_cv_c_dietlibc_compat" = xyesyes || ensc_diet_compat_msg= - -AH_BOTTOM([#include "compat.h"]) -AC_CONFIG_COMMANDS_PRE([ - FEATURES_TXT="\ -Features: - CC: $CC, $($CC --version | sed -e '1p;d') - CXX: $CXX, $($CXX --version | sed -e '1p;d') - CPPFLAGS: '$CPPFLAGS' - CFLAGS: '$CFLAGS' - CXXFLAGS: '$CXXFLAGS' - build/host: $build/$host - Use dietlibc: $ensc_have_dietlibc$ensc_diet_msg$ensc_diet_compat_msg - Build C++ programs: $ensc_cv_cxx_cxxcompiler$ensc_cxx_affected - Build C99 programs: $ensc_cv_c99_c99compiler$ensc_c99_affected - Available APIs: $enable_apis - ext2fs Source: $ensc_cv_test_ext2fs_header - syscall(2) invocation: $with_syscall - vserver(2) syscall#: $ensc_cv_value_syscall_vserver - -Paths: - prefix: $prefix - sysconf-Directory: $sysconfdir - cfg-Directory: $sysconfdir/vservers - initrd-Directory: $initrddir - pkgstate-Directory: $localstatedir/run/vservers - Kernelheaders: $kernelincludedir - vserver-Rootdir: $vserverdir -" - echo "$FEATURES_TXT" >FEATURES.txt - ]) -AC_CONFIG_FILES([util-vserver.spec Makefile distrib/Makefile lib/apidoc/Doxyfile]) -AC_OUTPUT - -AC_MSG_NOTICE([ - -$PACKAGE_STRING - -$FEATURES_TXT]) diff --git a/util-vserver/contrib/.cvsignore b/util-vserver/contrib/.cvsignore deleted file mode 100644 index 55b480f..0000000 --- a/util-vserver/contrib/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.manifest.dat.pathsubst.stamp -manifest.dat diff --git a/util-vserver/contrib/Makefile-files b/util-vserver/contrib/Makefile-files deleted file mode 100644 index 99f6e15..0000000 --- a/util-vserver/contrib/Makefile-files +++ /dev/null @@ -1,31 +0,0 @@ -## $Id$ -*- makefile -*- - -## 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; either version 2, or (at your option) -## any later version. -## -## 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. -## - - -contrib_gen_DTA = contrib/manifest.dat -contrib_subst_SRCS = contrib/manifest.dat.pathsubst - - -noinst_DATA += $(contrib_gen_DTA) -CLEANFILES += $(contrib_gen_DTA) - -EXTRA_DIST += $(contrib_subst_SRCS) \ - contrib/make-manifest - -contrib/manifest.dat: contrib/.manifest.dat.pathsubst.stamp diff --git a/util-vserver/contrib/make-manifest b/util-vserver/contrib/make-manifest deleted file mode 100755 index 7e497c7..0000000 --- a/util-vserver/contrib/make-manifest +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/bash - -# 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. - -## Usage: make-manifest <basename> <destdir> <datfile> - -name=$1 -dest=$2 -data=$3 - -for i in $name-{core,devel,base,build,legacy,lib,sysv}.list; do - echo '%defattr(-,root,root,-)' >$i -done - -sed -e "s!@CONFIG@!$MANIFEST_CONFIG!g; - s!@CONFIG_NOREPLACE@!$MANIFEST_CONFIG_NOREPLACE!g" \ - $data | \ -while read style file; do - test "$file" || continue - case "$style" in - (\#*) continue;; - esac - echo "$file" >>$name-$style.list -done diff --git a/util-vserver/contrib/manifest.dat.pathsubst b/util-vserver/contrib/manifest.dat.pathsubst deleted file mode 100644 index ba029b5..0000000 --- a/util-vserver/contrib/manifest.dat.pathsubst +++ /dev/null @@ -1,125 +0,0 @@ -lib @LIBDIR@/libvserver.so.* -devel @LIBDIR@/libvserver.a -devel @LIBDIR@/libvserver.so -base @PKGLIBDIR@/functions -build @PKGLIBDIR@/vserver-build.apt-rpm -build @PKGLIBDIR@/vserver-build.skeleton -build @PKGLIBDIR@/vserver-build.debootstrap -build @PKGLIBDIR@/vserver-build.functions -build @PKGLIBDIR@/vserver-build.functions.apt -build @PKGLIBDIR@/vserver-build.functions.rpm -build @PKGLIBDIR@/vserver-build.functions.pkgmgmt -build @PKGLIBDIR@/vserver-setup.functions -base @PKGLIBDIR@/vserver.functions -base @PKGLIBDIR@/vserver.start -base @PKGLIBDIR@/vserver.start.bin -base @PKGLIBDIR@/vserver.stop -base @PKGLIBDIR@/vserver.suexec -core @PKGLIBDIR@/util-vserver-vars -build @PKGLIBDIR@/rpm-fake.so -legacy @LEGACYDIR@/save_s_context -legacy @LEGACYDIR@/vps -legacy @LEGACYDIR@/vserver -legacy @LEGACYDIR@/vserverkillall -legacy @LEGACYDIR@/distrib-info -legacy @LEGACYDIR@/ifspec -legacy @LEGACYDIR@/listdevip -legacy @LEGACYDIR@/parserpmdump -legacy @LEGACYDIR@/rebootmgr -legacy @LEGACYDIR@/showperm -legacy @LEGACYDIR@/vreboot -core @PKGLIBDIR@/FEATURES.txt -base @PKGLIBDIR@/defaults/mtab -base @PKGLIBDIR@/defaults/vprocunhide-files -build @PKGLIBDIR@/defaults/fstab -build @PKGLIBDIR@/defaults/debootstrap.uri -@ENSC_HAVE_C99_COMPILER_TRUE@build @PKGLIBDIR@/defaults/vunify-exclude -base @PKGLIBDIR@/capchroot -base @PKGLIBDIR@/chain-echo -core @PKGLIBDIR@/chcontext-compat -base @PKGLIBDIR@/chroot-cat -base @PKGLIBDIR@/chroot-rm -base @PKGLIBDIR@/exec-ulimit -base @PKGLIBDIR@/fakerunlevel -base @PKGLIBDIR@/filetime -base @PKGLIBDIR@/lockfile -base @PKGLIBDIR@/keep-ctx-alive -base @PKGLIBDIR@/mask2prefix -build @PKGLIBDIR@/pkgmgmt -base @PKGLIBDIR@/readlink -base @PKGLIBDIR@/rootshell -build @PKGLIBDIR@/rpm-fake-resolver -base @PKGLIBDIR@/save_ctxinfo -base @PKGLIBDIR@/secure-mount -base @PKGLIBDIR@/sigexec -base @PKGLIBDIR@/start-vservers -build @PKGLIBDIR@/vapt-get-worker -@ENSC_HAVE_CXX_COMPILER_TRUE@build @PKGLIBDIR@/vbuild -@ENSC_HAVE_CXX_COMPILER_TRUE@build @PKGLIBDIR@/vcheck -build @PKGLIBDIR@/vpkg -base @PKGLIBDIR@/vprocunhide -build @PKGLIBDIR@/vrpm-preload -build @PKGLIBDIR@/vrpm-worker -build @PKGLIBDIR@/vserver-build -sysv @PKGLIBDIR@/vserver-wrapper -base @PKGLIBDIR@/vshelper -base @PKGLIBDIR@/vshelper-sync -sysv @PKGLIBDIR@/vsysvwrapper -@ENSC_HAVE_C99_COMPILER_TRUE@build @PKGLIBDIR@/vcopy -@ENSC_HAVE_C99_COMPILER_TRUE@build @PKGLIBDIR@/vunify -base @PKGLIBDIR@/vservers.grabinfo.sh -build @PKGLIBDIR@/distributions -devel @LIBDIR@/pkgconfig/util-vserver.pc -core @SBINDIR@/chbind -core @SBINDIR@/chcontext -core @SBINDIR@/chxid -base @SBINDIR@/exec-cd -core @SBINDIR@/lsxid -core @SBINDIR@/reducecap -core @SBINDIR@/setattr -core @SBINDIR@/showattr -build @SBINDIR@/vapt-get -core @SBINDIR@/vattribute -core @SBINDIR@/vcontext -core @SBINDIR@/vnamespace -base @SBINDIR@/vdu -@ENSC_HAVE_CXX_COMPILER_TRUE@build @SBINDIR@/vfiles -core @SBINDIR@/vkill -core @SBINDIR@/vlimit -base @SBINDIR@/vps -base @SBINDIR@/vpstree -build @SBINDIR@/vrpm -core @SBINDIR@/vrsetup -core @SBINDIR@/vsched -base @SBINDIR@/vserver -build @SBINDIR@/vserver-copy -core @SBINDIR@/vserver-info -base @SBINDIR@/vserver-stat -base @SBINDIR@/vtop -core @SBINDIR@/vuname -devel @INCLUDEDIR@/vserver.h -core @MANDIR@/*/chbind* -core @MANDIR@/*/chcontext* -core @MANDIR@/*/reducecap* -legacy @MANDIR@/*/distrib-info* -build @MANDIR@/*/vserver-copy* -legacy @MANDIR@/*/rebootmgr* -legacy @MANDIR@/*/vps.* -base @MANDIR@/*/vpstree.* -base @MANDIR@/*/vserver-stat* -base @MANDIR@/*/vserver.* -base @MANDIR@/*/vtop* -sysv @CONFIG@ @INITRDDIR@/v_gated -sysv @CONFIG@ @INITRDDIR@/v_httpd -sysv @CONFIG@ @INITRDDIR@/v_named -sysv @CONFIG@ @INITRDDIR@/v_portmap -sysv @CONFIG@ @INITRDDIR@/v_sendmail -sysv @CONFIG@ @INITRDDIR@/v_smb -sysv @CONFIG@ @INITRDDIR@/v_sshd -sysv @CONFIG@ @INITRDDIR@/v_xinetd -sysv @CONFIG@ @INITRDDIR@/vprocunhide -sysv @CONFIG@ @INITRDDIR@/vservers-default -legacy @CONFIG@ @INITRDDIR@/rebootmgr -legacy @CONFIG@ @INITRDDIR@/vservers-legacy -legacy @CONFIG_NOREPLACE@ @SYSCONFDIR@/vservers.conf -build @CONFIG_NOREPLACE@ @CONFDIR@/.distributions/*/apt/sources.list diff --git a/util-vserver/cvsusers.map b/util-vserver/cvsusers.map deleted file mode 100644 index 1e18434..0000000 --- a/util-vserver/cvsusers.map +++ /dev/null @@ -1 +0,0 @@ -ensc:Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> diff --git a/util-vserver/distrib/.cvsignore b/util-vserver/distrib/.cvsignore deleted file mode 100644 index 282522d..0000000 --- a/util-vserver/distrib/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/util-vserver/distrib/Makefile.am b/util-vserver/distrib/Makefile.am deleted file mode 100644 index 5c6b4e5..0000000 --- a/util-vserver/distrib/Makefile.am +++ /dev/null @@ -1,68 +0,0 @@ -## $Id$ - -## Copyright (C) 2003 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. - -confdir = $(sysconfdir)/vservers -defaultsdir = $(pkglibdir)/defaults -distribdir = $(pkglibdir)/distributions -confdistribdir = $(confdir)/.distributions -confdefaultsdir = $(confdir)/.defaults - -defaults_DATA = misc/debootstrap.uri \ - misc/fstab \ - misc/mtab \ - misc/vprocunhide-files \ - misc/vunify-exclude - -nobase_distrib_SCRIPTS = redhat/initpost \ - redhat/initpre \ - redhat/rc.sysinit - -nobase_distrib_DATA = defaults/devs \ - defaults/apt.conf \ - defaults/rpm/macros \ - defaults/apt/apt.conf \ - rh9/apt/rpmpriorities rh9/pkgs/01 rh9/pkgs/02 \ - fc1/apt/rpmpriorities fc1/pkgs/01 fc1/pkgs/02 \ - fc2/apt/rpmpriorities fc2/pkgs/01 fc2/pkgs/02 \ - suse91/apt/rpmpriorities suse91/pkgs/01 suse91/pkgs/02 \ - suse91/rpm/macros - -nobase_confdistrib_DATA = rh9/apt/sources.list \ - fc1/apt/sources.list \ - fc2/apt/sources.list \ - suse91/apt/sources.list - -AM_INSTALLCHECK_STD_OPTIONS_EXEMPT \ - = $(nobase_distrib_SCRIPTS) - -EXTRA_DIST = $(nobase_distrib_DATA) \ - $(nobase_distrib_SCRIPTS) \ - $(nobase_confdistrib_DATA) \ - $(defaults_DATA) - -redhat_style = rh9 fc1 fc2 - - -install-data-hook: - l="$(redhat_style)"; for i in $$l; do \ - ln -sf ../redhat/initpost $(DESTDIR)$(distribdir)/$$i/ && \ - ln -sf ../redhat/initpre $(DESTDIR)$(distribdir)/$$i/; \ - done - $(mkinstalldirs) $(DESTDIR)$(confdir) \ - $(DESTDIR)$(confdefaultsdir) \ - $(DESTDIR)$(confdefaultsdir)/apps \ - $(DESTDIR)$(confdefaultsdir)/files diff --git a/util-vserver/distrib/defaults/apt.conf b/util-vserver/distrib/defaults/apt.conf deleted file mode 100644 index 9fadb65..0000000 --- a/util-vserver/distrib/defaults/apt.conf +++ /dev/null @@ -1,3 +0,0 @@ -RPM { - Ignore { "gpg-pubkey"; }; -} diff --git a/util-vserver/distrib/defaults/apt/apt.conf b/util-vserver/distrib/defaults/apt/apt.conf deleted file mode 100644 index 82255c0..0000000 --- a/util-vserver/distrib/defaults/apt/apt.conf +++ /dev/null @@ -1,6 +0,0 @@ -// Do not remove 'autogenerated' tags and keep them on an own line -// which can be commented out - -Dir { - Etc "@APTETCDIR@"; // @autogenerated@: APTETCDIR -} diff --git a/util-vserver/distrib/defaults/devs b/util-vserver/distrib/defaults/devs deleted file mode 100644 index 641e9de..0000000 --- a/util-vserver/distrib/defaults/devs +++ /dev/null @@ -1,7 +0,0 @@ -null c 1 3 666 -zero c 1 5 666 -full c 1 7 666 -random c 1 8 644 -urandom c 1 9 644 -tty c 5 0 666 -ptmx c 5 2 666 diff --git a/util-vserver/distrib/defaults/rpm/macros b/util-vserver/distrib/defaults/rpm/macros deleted file mode 100644 index 8bada0d..0000000 --- a/util-vserver/distrib/defaults/rpm/macros +++ /dev/null @@ -1,4 +0,0 @@ -# Because of https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=52725 -# you have to use at least one language beside 'C' -%_install_langs C:de:en:es:fr -%_netsharedpath /dev:/etc/rc.d/init.d/halt:/sbin/new-kernel-pkg:/usr/bin/rhgb-client diff --git a/util-vserver/distrib/fc1/apt/rpmpriorities b/util-vserver/distrib/fc1/apt/rpmpriorities deleted file mode 100644 index 08cc7af..0000000 --- a/util-vserver/distrib/fc1/apt/rpmpriorities +++ /dev/null @@ -1,6 +0,0 @@ -Essential: - basesystem - coreutils - filesystem - glibc - setup diff --git a/util-vserver/distrib/fc1/apt/sources.list b/util-vserver/distrib/fc1/apt/sources.list deleted file mode 100644 index 8521209..0000000 --- a/util-vserver/distrib/fc1/apt/sources.list +++ /dev/null @@ -1,8 +0,0 @@ -# rpm http://ftp.ultra.csn.tu-chemnitz.de/pub/mirror/fedora/core/.apt 1/i386 os patches updates -# rpm-src http://ftp.ultra.csn.tu-chemnitz.de/pub/mirror/fedora/core/.apt 1/i386 os patches updates - -# rpm ftp://ftp.ussg.iu.edu/pub/linux/fedora/fedora/fedora 1/i386 os updates -# rpm ftp://ftp.tu-chemnitz.de/pub/linux/fedora/fedora 1/i386 os updates -# rpm http://mirrors.usc.edu/pub/linux/fedora/fedora 1/i386 os updates -# rpm http://sunsite.informatik.rwth-aachen.de/ftp/pub/Linux/fedora/fedora 1/i386 os updates -# rpm http://download.fedora.us/fedora/fedora 1/i386 os updates diff --git a/util-vserver/distrib/fc1/pkgs/01 b/util-vserver/distrib/fc1/pkgs/01 deleted file mode 100644 index 1a5ef72..0000000 --- a/util-vserver/distrib/fc1/pkgs/01 +++ /dev/null @@ -1 +0,0 @@ -glibc diff --git a/util-vserver/distrib/fc1/pkgs/02 b/util-vserver/distrib/fc1/pkgs/02 deleted file mode 100644 index 9ec5d2b..0000000 --- a/util-vserver/distrib/fc1/pkgs/02 +++ /dev/null @@ -1,3 +0,0 @@ ---reinstall - -filesystem diff --git a/util-vserver/distrib/fc2/apt/rpmpriorities b/util-vserver/distrib/fc2/apt/rpmpriorities deleted file mode 100644 index 08cc7af..0000000 --- a/util-vserver/distrib/fc2/apt/rpmpriorities +++ /dev/null @@ -1,6 +0,0 @@ -Essential: - basesystem - coreutils - filesystem - glibc - setup diff --git a/util-vserver/distrib/fc2/apt/sources.list b/util-vserver/distrib/fc2/apt/sources.list deleted file mode 100644 index 36753b5..0000000 --- a/util-vserver/distrib/fc2/apt/sources.list +++ /dev/null @@ -1,8 +0,0 @@ -# rpm http://ftp.ultra.csn.tu-chemnitz.de/pub/mirror/fedora/core/.apt 2/i386 os patches updates -# rpm-src http://ftp.ultra.csn.tu-chemnitz.de/pub/mirror/fedora/core/.apt 2/i386 os patches updates - -# rpm ftp://ftp.ussg.iu.edu/pub/linux/fedora/fedora/fedora 2/i386 os updates -# rpm ftp://ftp.tu-chemnitz.de/pub/linux/fedora/fedora 2/i386 os updates -# rpm http://mirrors.usc.edu/pub/linux/fedora/fedora/fedora 2/i386 os updates -# rpm http://sunsite.informatik.rwth-aachen.de/ftp/pub/Linux/fedora/fedora 2/i386 os updates -# rpm http://download.fedora.us/fedora/fedora 2/i386 os updates diff --git a/util-vserver/distrib/fc2/pkgs/01 b/util-vserver/distrib/fc2/pkgs/01 deleted file mode 100644 index 1a5ef72..0000000 --- a/util-vserver/distrib/fc2/pkgs/01 +++ /dev/null @@ -1 +0,0 @@ -glibc diff --git a/util-vserver/distrib/fc2/pkgs/02 b/util-vserver/distrib/fc2/pkgs/02 deleted file mode 100644 index 9ec5d2b..0000000 --- a/util-vserver/distrib/fc2/pkgs/02 +++ /dev/null @@ -1,3 +0,0 @@ ---reinstall - -filesystem diff --git a/util-vserver/distrib/misc/debootstrap.uri b/util-vserver/distrib/misc/debootstrap.uri deleted file mode 100644 index ec266dd..0000000 --- a/util-vserver/distrib/misc/debootstrap.uri +++ /dev/null @@ -1 +0,0 @@ -http://ftp.debian.org/debian/pool/main/d/debootstrap/debootstrap_0.2.39_i386.deb diff --git a/util-vserver/distrib/misc/fstab b/util-vserver/distrib/misc/fstab deleted file mode 100644 index f78c798..0000000 --- a/util-vserver/distrib/misc/fstab +++ /dev/null @@ -1,3 +0,0 @@ -none /proc proc defaults 0 0 -none /tmp tmpfs size=16m,mode=1777 0 0 -none /dev/pts devpts gid=5,mode=620 0 0 diff --git a/util-vserver/distrib/misc/mtab b/util-vserver/distrib/misc/mtab deleted file mode 100644 index e073bf6..0000000 --- a/util-vserver/distrib/misc/mtab +++ /dev/null @@ -1 +0,0 @@ -/dev/hdv1 / ufs defaults 0 0 diff --git a/util-vserver/distrib/misc/vprocunhide-files b/util-vserver/distrib/misc/vprocunhide-files deleted file mode 100644 index ec35834..0000000 --- a/util-vserver/distrib/misc/vprocunhide-files +++ /dev/null @@ -1,30 +0,0 @@ -/proc/net/ --/proc/net/rpc/ -/proc/sys/ --/proc/sys/debug/ --/proc/sys/dev/ -/proc/sysvipc/ -/proc/tty/ -/proc/cmdline -/proc/cpuinfo -/proc/crypto -/proc/devices -/proc/execdomains -/proc/filesystems -/proc/interrupts -/proc/iomem -/proc/ioports -/proc/kcore -/proc/kmsg -/proc/ksyms -/proc/loadavg -/proc/locks -/proc/meminfo -/proc/misc -/proc/modules -/proc/pci -/proc/slabinfo -/proc/stat -/proc/swaps -/proc/uptime -/proc/version diff --git a/util-vserver/distrib/misc/vunify-exclude b/util-vserver/distrib/misc/vunify-exclude deleted file mode 100644 index 79426a7..0000000 --- a/util-vserver/distrib/misc/vunify-exclude +++ /dev/null @@ -1,26 +0,0 @@ -/.rpmdb -/dev -~/etc/shadow -~/etc/passwd -~/etc/group -+/etc/termcap -+/etc/gconf -+/etc/gconf/schemas -/etc/gconf/* -/etc/* -/home -/proc -/mnt -+/root/.ssh -~/root/.ssh/id* --/root/.ssh/* -+/root/.gnupg -~/root/.gnupg/secring* --/root/.gnupg/* --/root/* -/selinux -/sys -~/tmp/* -/tmp -~/var/tmp/* -/var diff --git a/util-vserver/distrib/redhat/initpost b/util-vserver/distrib/redhat/initpost deleted file mode 100755 index 06ad9fe..0000000 --- a/util-vserver/distrib/redhat/initpost +++ /dev/null @@ -1,75 +0,0 @@ -#! /bin/bash - -# Copyright (C) 2003 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. - -## HACK: this script is full of races... - -vdir=$1/vdir -. "$2" - -function relink -{ - test ! -e "$2" -o -L "$2" || mv -f "$2"{,.orig} - ln -s "$1" "$2" -} - -## Usage: subst <file> <regexp> -function subst -{ - sed -e "$2" "$1" | $_CHROOT_CAT "$1".tmp - cmp -s "$1".tmp "$1" || cat "$1".tmp | $_CHROOT_CAT "$1" - rm -f "$1".tmp -} - -pushd "$vdir"/etc/init.d &>/dev/null || - pushd "$vdir"/etc/rc.d/init.d &>/dev/null || exit 1 - - for i in *; do - test -e "$i" || continue - case "$i" in - functions|halt|killall|single) ;; - syslog) ;; - *) - $_VSERVER ----insecure "$1" chkconfig "$i" off - ;; - esac - done - - relink /bin/true halt -popd >/dev/null - -pushd "$vdir"/sbin &>/dev/null - relink /bin/true new-kernel-pkg -popd >/dev/null - -pushd "$vdir"/usr/bin &>/dev/null - relink /bin/true rhgb-client -popd >/dev/null - -pushd "$vdir"/etc &>/dev/null - # TODO: remove race/symlink-attack - echo 'NETWORKING=yes' >>sysconfig/network -popd >/dev/null - -pushd "$vdir" &>/dev/null - : | $_CHROOT_CAT /etc/sysctl.conf - echo "none / none defaults" | $_CHROOT_CAT /etc/fstab - cat "$DISTRIBDIR"/redhat/rc.sysinit | $_CHROOT_CAT /etc/rc.d/rc.sysinit.vserver - # TODO: remove race/symlink-attack - chmod +x etc/rc.d/rc.sysinit.vserver - subst etc/inittab 's!^\([^#].*:respawn:.* tty\)!#\1!; - s!si::sysinit:/etc/rc.d/rc.sysinit!si::sysinit:/etc/rc.d/rc.sysinit.vserver!' -popd >/dev/null diff --git a/util-vserver/distrib/redhat/initpre b/util-vserver/distrib/redhat/initpre deleted file mode 100755 index a49289f..0000000 --- a/util-vserver/distrib/redhat/initpre +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/bash - -# Copyright (C) 2003 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. - -vdir=$1/vdir -. "$2" - -## Fix/workaround the misclassification of %_netsharedpath's parent directories -mkdir -p "$vdir"/{etc/rc.d/init.d,/sbin,/usr/bin} \ No newline at end of file diff --git a/util-vserver/distrib/redhat/rc.sysinit b/util-vserver/distrib/redhat/rc.sysinit deleted file mode 100755 index 6215cf6..0000000 --- a/util-vserver/distrib/redhat/rc.sysinit +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh - -rm -f /var/lock/subsys/* /var/run/* /var/run/*/* 2>/dev/null -true diff --git a/util-vserver/distrib/rh9/apt/rpmpriorities b/util-vserver/distrib/rh9/apt/rpmpriorities deleted file mode 100644 index 08cc7af..0000000 --- a/util-vserver/distrib/rh9/apt/rpmpriorities +++ /dev/null @@ -1,6 +0,0 @@ -Essential: - basesystem - coreutils - filesystem - glibc - setup diff --git a/util-vserver/distrib/rh9/apt/sources.list b/util-vserver/distrib/rh9/apt/sources.list deleted file mode 100644 index e088e63..0000000 --- a/util-vserver/distrib/rh9/apt/sources.list +++ /dev/null @@ -1,7 +0,0 @@ -# rpm http://ftp.ultra.csn.tu-chemnitz.de/pub/mirror/RedHat/.apt redhat/9 os errata -# rpm-src http://ftp.ultra.csn.tu-chemnitz.de/pub/mirror/RedHat/.apt redhat/9 os errata - -# rpm ftp://ftp.tu-chemnitz.de/pub/linux/fedora/redhat 9/i386 os updates -# rpm ftp://ftp.ussg.iu.edu/pub/linux/fedora/fedora/redhat 9/i386 os updates -# rpm http://mirrors.usc.edu/pub/linux/fedora/redhat 9/i386 os updates -# rpm http://sunsite.informatik.rwth-aachen.de/ftp/pub/Linux/fedora/redhat 9/i386 os updates diff --git a/util-vserver/distrib/rh9/pkgs/01 b/util-vserver/distrib/rh9/pkgs/01 deleted file mode 100644 index 1a5ef72..0000000 --- a/util-vserver/distrib/rh9/pkgs/01 +++ /dev/null @@ -1 +0,0 @@ -glibc diff --git a/util-vserver/distrib/rh9/pkgs/02 b/util-vserver/distrib/rh9/pkgs/02 deleted file mode 100644 index 9ec5d2b..0000000 --- a/util-vserver/distrib/rh9/pkgs/02 +++ /dev/null @@ -1,3 +0,0 @@ ---reinstall - -filesystem diff --git a/util-vserver/distrib/suse91/apt/rpmpriorities b/util-vserver/distrib/suse91/apt/rpmpriorities deleted file mode 100644 index ed48a73..0000000 --- a/util-vserver/distrib/suse91/apt/rpmpriorities +++ /dev/null @@ -1,2 +0,0 @@ -Essential: - aaa_base diff --git a/util-vserver/distrib/suse91/apt/sources.list b/util-vserver/distrib/suse91/apt/sources.list deleted file mode 100644 index ba6b5cc..0000000 --- a/util-vserver/distrib/suse91/apt/sources.list +++ /dev/null @@ -1 +0,0 @@ -# rpm http://ftp.tu-chemnitz.de/pub/linux/suse/apt/SuSE 9.1-i386 base diff --git a/util-vserver/distrib/suse91/initpost b/util-vserver/distrib/suse91/initpost deleted file mode 100755 index 2df98ce..0000000 --- a/util-vserver/distrib/suse91/initpost +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh - -vdir=$1/vdir -. "$2" diff --git a/util-vserver/distrib/suse91/pkgs/01 b/util-vserver/distrib/suse91/pkgs/01 deleted file mode 100644 index 1905974..0000000 --- a/util-vserver/distrib/suse91/pkgs/01 +++ /dev/null @@ -1 +0,0 @@ -aaa_base diff --git a/util-vserver/distrib/suse91/pkgs/02 b/util-vserver/distrib/suse91/pkgs/02 deleted file mode 100644 index be4e901..0000000 --- a/util-vserver/distrib/suse91/pkgs/02 +++ /dev/null @@ -1,3 +0,0 @@ ---reinstall -filesystem -pam diff --git a/util-vserver/distrib/suse91/rpm/macros b/util-vserver/distrib/suse91/rpm/macros deleted file mode 100644 index 7531428..0000000 --- a/util-vserver/distrib/suse91/rpm/macros +++ /dev/null @@ -1,4 +0,0 @@ -# Because of https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=52725 -# you have to use at least one language beside 'C' -%_install_langs C:de:en:es:fr -%_netsharedpath /dev diff --git a/util-vserver/doc/.cvsignore b/util-vserver/doc/.cvsignore deleted file mode 100644 index a5790aa..0000000 --- a/util-vserver/doc/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -compatibility.html -configuration.html diff --git a/util-vserver/doc/Makefile-files b/util-vserver/doc/Makefile-files deleted file mode 100644 index 73d2631..0000000 --- a/util-vserver/doc/Makefile-files +++ /dev/null @@ -1,58 +0,0 @@ -## $Id$ -*- makefile -*- - -## Copyright (C) 2003 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; either version 2, or (at your option) -## any later version. -## -## 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. -## - -doc_old_doc = doc/intro.txt - -XSLT_AMFLAGS = --stringparam confdir '$(sysconfdir)/vservers' -XSLTP_AMFLAGS = -param confdir '$(sysconfdir)/vservers' - -doc_gen_DOCS = doc/configuration.html \ - doc/compatibility.html - -doc_configuration_SRCS = doc/configuration.xml \ - doc/configuration.xsd \ - doc/configuration-lsd.css \ - doc/configuration-xhtml.xsl - -doc_compatibility_SRCS = doc/compatibility.xml \ - doc/compatibility.dtd \ - doc/compatibility-xhtml.xsl - -EXTRA_DIST += $(doc_compatibility_SRCS) \ - $(doc_configuration_SRCS) \ - $(doc_old_doc) \ - $(doc_gen_DOCS) - -CLEANFILES += doc/*.raw.html* doc/*.html.tmp - -doc/configuration.html: STYLESHEET=$(srcdir)/doc/configuration-xhtml.xsl -doc/configuration.html: $(srcdir)/doc/configuration-xhtml.xsl - -doc/compatibility.html: STYLESHEET=$(srcdir)/doc/compatibility-xhtml.xsl -doc/compatibility.html: $(srcdir)/doc/compatibility-xhtml.xsl - -doc: doc_doc -doc_doc: $(doc_gen_DOCS) - -if HAVE_XSLTP -CLEANFILES += $(doc_gen_DOCS) -%.html: %.xml $(STYLESHEET) - LANG=C $(XSLTP) $(XSLTP_AMFLAGS) -in '$<' -xsl $(STYLESHEET) -out '$@.tmp' - @mv -f '$@.tmp' '$@' -endif diff --git a/util-vserver/doc/cfg.txt b/util-vserver/doc/cfg.txt deleted file mode 100644 index 92a0562..0000000 --- a/util-vserver/doc/cfg.txt +++ /dev/null @@ -1,49 +0,0 @@ -/etc/vservers -|-- <vserver> - |-- vdir -> /vservers/<vserver> Link to vserver top-dir - |-- [ctx] - |-- [hostname] - |-- [domainname] - |-- run -> /var/run/vservers/<lock> - |-- [flags] - |-- [capabilities] - |-- apps - | |-- pkgmgmt - | | |-- base -> ... Link to pkgmgmt cfg-dir - | | |-- aptetc \ - | | |-- aptcache \ - | | |-- aptstate \ Overriding of cfg-dir values - | | |-- aptarchives / - | | |-- rpmetc / - | | |-- rpmstate / - | | |-- execdir Alternative executables - | | `-- rpmlib Alternative /usr/lib/rpm dir - | `-- vunify - | |-- refserver -> ... link to cfg-dir of refserver - | | (e.g. /etc/vservers/<xxx>) - | `-- dirs file with incldir(+) or - | excldir(-) entries - `-- interfaces - |-- [dev] - |-- [prefix] - |-- [mask] - |-- [bcast] - `-- <interface>* - |-- ip - |-- [dev] - |-- [prefix] - |-- [mask] - |-- [bcast] - |-- [name] - |-- [scope] - |-- [only_ip] ... use only the ip; do not modify/set - | the interface - `-- [disabled] ... ignore this interface - -pkgmgmt cfg-dir -|-- apt/etc (e.g. sources.list, apt.conf, rpmpriorities,...) -|-- apt/archives (downloaded files) -|-- apt/cache (pkgcache.bin,srcpkgcache.bin) -|-- apt/state (fetched repository info) -|-- rpm/etc (content of /etc/rpm; e.g. 'macros' file) -`-- rpm/state (/var/lib/rpm database) diff --git a/util-vserver/doc/compatibility-xhtml.xsl b/util-vserver/doc/compatibility-xhtml.xsl deleted file mode 100644 index c498687..0000000 --- a/util-vserver/doc/compatibility-xhtml.xsl +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns="http://www.w3.org/1999/xhtml" - version="1.0"> - - <xsl:output method="xml" - indent="yes" - doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" - doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/> - - <xsl:template match="/"> - <html> - <head> - <title><xsl:apply-templates select="compatibility/title"/> - - - - - - - - - - - -
-

- - - - / -

-
-
- - diff --git a/util-vserver/doc/compatibility.dtd b/util-vserver/doc/compatibility.dtd deleted file mode 100644 index ad0d5a2..0000000 --- a/util-vserver/doc/compatibility.dtd +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/util-vserver/doc/compatibility.xml b/util-vserver/doc/compatibility.xml deleted file mode 100644 index 5b9fde5..0000000 --- a/util-vserver/doc/compatibility.xml +++ /dev/null @@ -1,413 +0,0 @@ - - - - - compatibility of util-vserver alpha branch - - - LIBDIR - - - - - - LIBDIR - - replaced by vpkg - - - - - - LIBDIR - - - - - - LIBDIR - - - - - - LIBDIR - - - - - - LIBDIR - - Replaced by more general build-methods which are building vservers from apt-repositories. - - - - - - LIBDIR - - - - - - LIBDIR - - - - - - LIBDIR - - - - - - LIBDIR - - - - - - LIBDIR - - incompatible with recent configuration style. - - - - - - LIBDIR - - incompatible with recent configuration style; partially replaced by save_ctxinfo. - - - - - - LIBDIR - - Has been moved into SBINDIR. Lots of new option were added to support new functionality. - - - It is possible to recurse directories and it supports - all vserver related attributes (admin, hide, watch, barrier, - iunlink). - - - - - LIBDIR - - Has been moved into SBINDIR. Lots of new option were added to support new functionality. - - - It is possible to recurse directories and it supports all - vserver related attributes (admin, hide, watch, barrier, - iunlink). The output has been changed: the flags are now in the - first column and they are displayed in a symbolic manner. - - - - - LIBDIR - - - - - - LIBDIR - - - will be removed/rewritten soon. - - - - - LIBDIR - - - will be removed/rewritten soon. - - - - - LIBDIR - - incompatible with recent configuration style. - - - - - - LIBDIR - - - - - - LIBDIR - - vkill contains the needed functionality - already. - - - - - - LIBDIR - - - - - - LIBDIR - - CLI has been changed to reflect new functionality. Now, it - accepts either a single vserver, or (directory,excludelist) - pairs as arguments. The old "refserver vserver1 vserver2 ..." - syntax is gone. - - - vunify allows to unify generic paths, or vservers with - preconfigured reference vservers. The filelist is not taken from - packagemanagement anymore, but every file which has a counterpart - in the reference-path(s)/vserver(s) and is not in an excludelist - will be unified. A part of the excludelist will be generated - dynamically with information from the packagemanagement about - configfiles. - - - - - SBINDIR - - - - - - SBINDIR - - - Return code in '--disconnect' case is now more correctly. - - - - - SBINDIR - - - - - - SBINDIR - - - - - - SBINDIR - - - - - - SBINDIR - - - will be removed/rewritten soon. - - - - - SBINDIR - - - It uses native kernel interface now and is secure (in - opposite to the old perl implementation). - - - - - SBINDIR - - - It has been rewritten into C and output might have been changed slightly. - - - - - SBINDIR - - - - - - SBINDIR - - - It has been rewritten into a secure, native C - implementation. Unpacking of files happens in host-ctx, but - scriptlets are executed in vserver context. The rpm database - will/can be hold outside of the vserver and there will never be - access on it from the inside (neither direct, nor by - scriptlets). This is implemented through an LD_PRELOAD wrapper - which provides own, secure NSS functions too. - - - - - SBINDIR - - It accepts all the old arguments, but adds lots of new - ones. This program is intended as the basic vserver management - tool; e.g. to unify a vserver you can execute "vserver XX unify", - to install a package "vserver XX install PKG" and so on. - - - This tool is rewritten to completely and is now resistant - against symlink attacks. It uses the new configuration scheme - and the iproute2 tools instead of ifconfig for network - setup. Old-style vserver can be still started through this tool, - but modifications/building of them is not possible - anymore. - - - - - SBINDIR - - - will be removed/rewritten soon. - - - - - SBINDIR - - - It has been rewritten to use the new libvserver API. The - output has been changed slightly. - - - - - SBINDIR - - - - - - SBINDIR - - changes into a directory in a secure manner and executes a - program there. - - - - - LIBDIR - - NSS resolver; used by vrpm and executed in - vserver-ctx. - - - - - LIBDIR - - LD_PRELOAD wrapper; used by vrpm. - - - - - LIBDIR - - Helper script for vapt-get. - - - - - LIBDIR - - Generic interface for package management; it allows - to install, remove or query packages in a distribution - independent manner. It can be seen as the successor of - distrib-info. - - - - - LIBDIR - - Helper script for vrpm. - - - - - LIBDIR - - Helper script for vrpm. - - - - - LIBDIR - - Builds a vserver from scratch and allows to select the - used method. It will be called by the "vserver XY build" - command. - - - - - SBINDIR - - Wrapper for apt-get; currently only the apt-rpm port - is supported. Metadata will/can be stored outside of the - vserver. This program call vrpm. - - - - - - SBINDIR - - This program assigns the associated context of an inode. It - replaces parts of the vserver-quota tools. - - - - - SBINDIR - - This program shows the associated context of an inode. It - replaces parts of the vserver-quota tools. - - - - - SBINDIR - - This program starts a program within a new namespace which is - created with CLONE_NEWNS. It is used e.g. by vrpm to - map the rpm-database into the vserver in a secure manner. - - - - - SBINDIR - - This is an interface to the rlimit syscalls which allow to - limit resource-usage of contexts. - - - - - SBINDIR - - This program allows to setup vroot devices. It replaces - vrsetup from the vr-tools - - - diff --git a/util-vserver/doc/configuration-lsd.css b/util-vserver/doc/configuration-lsd.css deleted file mode 100644 index 54e9d87..0000000 --- a/util-vserver/doc/configuration-lsd.css +++ /dev/null @@ -1,41 +0,0 @@ -body { - font-size: 12pt; - background-color: #ffc3df; - margin: 0px; - background-image: url("./flowers1.png"); -} - -body:before { - content: "if you think this css needs some improvement, go ahead, send me a better one ;)"; - font-weight:bold; - color: red; - font-size: 36pt; - text-decoration: blink; -} - -span.directory { - background-color: green; - color: aqua; -} - -span.symlink { - background-color: red; - color: yellow; -} - -span.script { - background-color: blue; - color: gray; -} - -span.symbolic:before { content: "<"; } -span.symbolic:after { content: ">"; } - -span.symbolic { - font-style: italic; -} - -span.description { - background-color: yellow; - color: red; -} diff --git a/util-vserver/doc/configuration-xhtml.xsl b/util-vserver/doc/configuration-xhtml.xsl deleted file mode 100644 index e56cf87..0000000 --- a/util-vserver/doc/configuration-xhtml.xsl +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - - - - - - - - - The <xsl:value-of select="$confdir"/> directory - - - - -

The content of the directory

- -
    - - - -
- -
- - - - - -
    - - - -
-
- - - - - -
-
- - - - - - - - - - - - - - - - -
  • - - - script - - -
  • -
    - - - -
  • - - - hash - - -
  • -
    - - - -
  • - - - file - - -
  • -
    - - - -
  • - - - data - - -
  • -
    - - - -
  • - - - list - - -
  • -
    - - - -
  • - - - symlink - - -
  • -
    - - - -
  • - - - boolean - - -
  • -
    - - - -
  • - - - directory - - - - - / - -
  • -
    - - - / - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - - - -
    diff --git a/util-vserver/doc/configuration.css b/util-vserver/doc/configuration.css deleted file mode 100644 index b602935..0000000 --- a/util-vserver/doc/configuration.css +++ /dev/null @@ -1,43 +0,0 @@ -body { - font-size: 12pt; - background-color: white; - margin: 0px; -} - -span.directory { - //text-decoration: underline; -} - - -span.symlink:after { - content: " [symlink]"; - font-size: 8pt; - font-style: normal; -} - -span.symlink { - text-decoration: none; - font-style: italic; -} - -span.script:after { - content: " [script]"; - font-size: 8pt; - font-style: normal; -} - -span.script { - color: gray; -} - -span.symbolic:before { content: "<"; } -span.symbolic:after { content: ">"; } - -span.symbolic { - font-style: italic; - text-decoration: none; -} - -span.description { - background-color: #ffffdd; -} diff --git a/util-vserver/doc/configuration.xml b/util-vserver/doc/configuration.xml deleted file mode 100644 index 48af8e0..0000000 --- a/util-vserver/doc/configuration.xml +++ /dev/null @@ -1,921 +0,0 @@ - - - - - - - - Default mtab file - - - - - /vservers - - - - - - /vservers/.pkg - - - - The default apt.conf which is going to be used. It is overridden by - distribution specific configuration file. - - - - - - - - The Debian mirror to use with the 'debootstrap' program - - - - - When the 'debootstrap' package is not installed; fetch it from this uri and - install it at a temporary place. - - - - - - - - A list of files which will be made visibly by vprocunhide. Wildcards are - allowed and anything ending in '/' will be processed recursively. When this file exists, - it overrides the defaults in SYSDEFAULTDIR/vprocunhide-files. The entries there must be - absolute filenames inclusive the leading '/proc'. - - - - - - - - A symlink to the TTY device where input/output will be redirected from/to - at startup via initscript. - - - - - - - - Static list of excluded files. - - - - - - - - - - - - - - The default apt.conf which is going to be used. It overrides the apt.conf - from CONFDIR/.defaults/apps/pkgmgmt. - - - - - Script which will be executed before packages will be installed. - - - - - The configuration directory of the vserver which is going to be set up. - - - - - The pathname of the vserver binary. - - - - - - - Script which will be executed after packages are installed. - - - - - The configuration directory of the vserver which is going to be set up. - - - - - The pathname of the vserver binary. - - - - - - - - Contains files with packages. - - - - File which contains the name of packages. On top of file the special - keywords '--reinstall' and '--can-fail' are possible. - - - - - - - Directory with GPG pubkeys which are used to sign the packages of this - distribution. - - - - - - Default content of the /etc/apt/ directory. - - - - - - Default content of the /etc/rpm directory. - - - - - - Directory which overrides /usr/lib/rpm. - - - - - Directory with all executables and libraries which are required for this - distribution. - - - - - - - - - - The configuration directory for the vserver vserver-name. - - - - - Path of the vserver root directory - - - - - - Path of the vserver run directory - - - - - - Path of the vserver run reverse directory - - - - - - [experimental; name is subject of possible change] Contains the system capabilities. See - lib/bcaps-v13.c - for possible values. - - - - - [experimental; name is subject of possible change] Contains the context capabilities. See - lib/ccaps-v13.c - for possible values. - - - - - [experimental; name is subject of possible change] Contains the scheduler parameters, - one per line. - - The Hard CPU limit uses a mechanism called a Token Bucket. - the concept is simple: you have a bucket of a certain size - which is filled with a specified amount R of tokens each - interval T until the maximum is reached (excess tokens - are spilled). At each timer tick, a running process consumes - one token from the bucket, unless the bucket is empty. If the - bucket is empty the process is put in the hold queue. When the - bucket has been refilled to at least M tokens, all on hold - processes are rescheduled. - - - - - Amount of tokens append to the bucket each interval. - - - - - The intervall between refills of amount 'fill_rate'. This value is express in ticks. - - - - - Initial bucket contents. - - - - - The minimum amount of tokens required to unhold processes - - - - - The bucket size. - - - - - Unused at the moment. - - - - - - - Contains the hostname of the vserver. Same as uts/nodename. - - - - - Contains the name of the vserver. When not given, the basename of the directory - will be assumed as this name. - - - - - The domainname of the vserver. Same as uts/domainname. - - - - - The nice-level on which the vserver will be started. - - - - - Contains per line a capability. This file is used for the 2.4 - kernel only; for 2.6 use 'bcapabilities'. - - - - - Contains the pathname of the shell which will be used by the "vserver ... enter" - command. - - - - - Contains per line a flag. See - lib/cflags-v13.c - for possible values. - - - - - The new process will believe it is process number 1. Useful to run a real - /sbin/init in a vserver. - - - - - The new process is trapped and can't use chcontext anymore. - - - - - The new process and its children will share a common - - - - - Limit the number of process in the vserver according to - ulimit setting. Normally, ulimit is a per user thing. - With this flag, it becomes a per vserver thing. - - - - - No one can join this security context once created. - - - - - Apply the current ulimit to the whole context - - - - - - - Contains the context which shall be used for the vserver. - - - - - The fstab file for the vserver. Entries in this file will be mounted within the - network context of the vserver; this means that mount will be called as 'chbind <options> - mount ...'. Use the 'fstab.local' file when you do not want this behavior, but in most cases - the 'fstab' file should be used. - - - - - The fstab file for the vserver. In opposite to the normal 'fstab' file, the - mounting happens in the local network context. Currently there is no way to mix entries of - both files; 'fstab' will be always processed before 'fstab.local'. - - - - - - - - The initial-mtab which will be used for the vserver. - - - - - - Contains the init-style. - - - - - - - - - - - The start runlevel. - - - - The start runlevel. - - - - The stop runlevel. - - - - - Contains the 'signal [wait signal]*' sequence which is used to stop the - vserver. - - - - - - The command which is used to start the vserver. Each option must be on a - separate line. - - - - - - The command which is used to wait on the vserver after it has been - started. Each option must be on a separate line. This file will be ignored when the - 'sync' does not exist and the '--sync' option was not used. - - - - - - The command which is used to stop the vserver. Each option must be on a - separate line. - - - - - - The command which is used to wait on the vserver after it has been - stopped. Each option must be on a separate line. This file will be ignored when the - 'sync' does not exist and the '--sync' option was not used. - - - - - - The command which is used to setup the init-system (e.g. to set the runlevel - in the utmp-file). Each option must be on a separate line. - - - - - - If this file is not present, all 'cmd.*-sync files will be ignored. - - - - - - A symlink to the TTY device where input/output will be redirected from/to - at startup via initscript. - - - - - - This file is used to mark group of vservers which shall be started/stopped - together by the initscript. Content is a simple string like 'default'. - - - - - - This file is used to configure vservers which must be running before the - current vserver can be started. At shutdown, the current vserver will be stopped before - its dependencies. Content of this file are vserver ids (one name per line). - - - - - - - - The timeout in seconds which is used when synchronising vserver startup/shutdown - with the vshelper. When no set, 30 seconds will be assumed. - - 30 - - - - - The action which is going to be executed when a vshelper event occurs. The - default value is 'restart', but there can be defined own methods by placing scripts into - the 'vshelper-methods' directories. These scripts are fed with the same arguments as the - 'vshelper' script. - - restart - - - - - When existing. these scripts will be executed *instead* of the default - handler defined in 'action'. Their name must match the event which caused the execution - of 'vshelper'; e.g. 'restart' or 'poweroff'. See the vs_reboot() function in the kernel - for more details. - - - - The xid of the context calling the vshelper - - - The reboot-event - - - - - - - When existing, the vshelper functionality will be disabled for this - vserver. - - - - - - When existing, sanity checks for the vshelper functionality will be - skipped. - - - - - - The file where output will be logged to when 'vshelper' is invoked from the - kernel. This should point somewhere e.g. into /var/log. - - - - - - - - See vshelper/action. - - - - - - - This directory contains configuration data required for vserver - unification. - - - - - Static list of excluded files. This list supports an rsync syntax: when a - file is prefixed by '+', it is a candidate for unification; when there is no prefix or a - '-' it will be excluded. Shell-wildcards are allowed for the filenames. - - - - - - These are symlinks to the configuration directory - (e.g. CONFDIR/vservers/<id>) of a refserver. There may be multiple such symlinks - but they must be prefixed by 'refserver.' and will be processed in alphanumerical - order. - - - - - - - - A directory for scripts. By default, when one of these scripts will be executed, - the execution of defaultscripts (within .../.defaults/scripts) will be skipped. To execute - them nevertheless, the $DONT_SKIP_DEFAULTS environment variable must be set by one of the - in-shellcontext scripts (the non-executable ones). - - - - - The scriptlet which will be executed before the network-interfaces are enabled - and the directories are mounted." - - - - The configuration directory of the current vserver. - - - The name of the current vserver. - - - The fixed value of the current action (e.g. 'prepre-start', 'post-stop'...). - - - - - - Repository of prepre-start like scripts - - - See prepre-start. - - - The configuration directory of the current vserver. - - - The name of the current vserver. - - - The fixed value of the current action (e.g. 'prepre-start', 'post-stop'...). - - - - - - - - The scriptlet which will be executed after network-interfaces were enabled and - the directories mounted, but before the vserver itself has been started. - - - - The configuration directory of the current vserver. - - - The name of the current vserver. - - - The fixed value of the current action (e.g. 'prepre-start', 'post-stop'...). - - - - - - Repository of pre-start like scripts - - - See pre-start. - - - The configuration directory of the current vserver. - - - The name of the current vserver. - - - The fixed value of the current action (e.g. 'prepre-start', 'post-stop'...). - - - - - - - - - The scriptlet which will be executed after the vserver has been started. - - - - The configuration directory of the current vserver. - - - The name of the current vserver. - - - The fixed value of the current action (e.g. 'prepre-start', 'post-stop'...). - - - - - - Repository of post-start like scripts - - - See post-start. - - - The configuration directory of the current vserver. - - - The name of the current vserver. - - - The fixed value of the current action (e.g. 'prepre-start', 'post-stop'...). - - - - - - - - - The scriptlet which will be executed before the vserver will be stopped. - - - - The configuration directory of the current vserver. - - - The name of the current vserver. - - - The fixed value of the current action (e.g. 'prepre-start', 'post-stop'...). - - - - - - Repository of pre-stop like scripts - - - See pre-stop. - - - The configuration directory of the current vserver. - - - The name of the current vserver. - - - The fixed value of the current action (e.g. 'prepre-start', 'post-stop'...). - - - - - - - - The scriptlet which will be executed after the vserver has been stopped, but - before the directories will be umounted and the the interfaces - disabled. - - - - The configuration directory of the current vserver. - - - The name of the current vserver. - - - The fixed value of the current action (e.g. 'prepre-start', 'post-stop'...). - - - - - - Repository of post-stop like scripts - - - See post-stop. - - - The configuration directory of the current vserver. - - - The name of the current vserver. - - - The fixed value of the current action (e.g. 'prepre-start', 'post-stop'...). - - - - - - - - The scriptlet which will be executed after the vserver has been stopped - completely. - - - - The configuration directory of the current vserver. - - - The name of the current vserver. - - - The fixed value of the current action (e.g. 'prepre-start', 'post-stop'...). - - - - - - Repository of postpost-stop like scripts - - - See postpost-stop. - - - The configuration directory of the current vserver. - - - The name of the current vserver. - - - The fixed value of the current action (e.g. 'prepre-start', 'post-stop'...). - - - - - - - - - The default broadcast address. - - - The default network device. - - - The default network prefix. - - - The default network mask. - - - The default scope of the network interfaces. - - - - - 'iface' is an arbitrary name for the interface; the value itself is not important - but may be interesting regarding interface-creation and usage with 'chbind'. Both happens in - alphabetical order and numbers like '00' are good names for these directories. - - - - When this file exists, this interface will be ignored. - - - - The ip which will be assigned to this interface. - - - The broadcast address. - - - The network device. - - - The network prefix. - - - The network mask. - - - The scope of the network interface. - - - - When this file exists, the interface will be named with the text in this file. - - - - - When this file exists, the interface will be assumed to exist already. - - - - - - - - A directory with ulimits. Possible resources are cpu, data, fsize, locks, - memlock, nofile, nproc, rss and/or stack. This configuration will be honored - for kernel 2.4 only. - - - - A file which contains the hard- and soft-limit of the given resource in the - first line. The special keyword 'inf' is recognized. - - - - - A file which contains the hard- of the given resource in the first line. The - special keyword 'inf' is recognized. - - - - - A file which contains the soft- of the given resource in the first line. The - special keyword 'inf' is recognized. - - - - - - - A directory with resource limits. Possible resources are cpu, data, fsize, locks, - memlock, nofile, nproc, rss and/or stack. This configuration will be honored - for kernel 2.6 only. - - - - A file which contains the hard- and soft-limit of the given resource in the - first line. The special keyword 'inf' is recognized. - - - - - A file which contains the hard- of the given resource in the first line. The - special keyword 'inf' is recognized. - - - - - A file which contains the soft- of the given resource in the first line. The - special keyword 'inf' is recognized. - - - - - A file which contains the guaranted minimum of the given resource in the first line. The - special keyword 'inf' is recognized. - - - - - - - - The context-name of the vserver. This file is listed for completeness only; - the 'context' name is used and set internally by the util-vserver tools and can *not* be - modified. - - - - The sysname of the vserver - - - The node-/hostname of the vserver - - - The OS-release of the vserver - - - The OS-version of the vserver - - - The machine-type of the vserver - - - The NIS domainname of the vserver - - - - diff --git a/util-vserver/doc/configuration.xsd b/util-vserver/doc/configuration.xsd deleted file mode 100644 index e93f0ab..0000000 --- a/util-vserver/doc/configuration.xsd +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - Filesystem Database schema writen by Olivier Poitrey on 4/20/2004 - Version $Id$ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Avoid duplicate element with same name attribute on the same level tree - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Avoid duplicate element with same name attribute on the same level tree - - - - - - - - diff --git a/util-vserver/doc/intro.txt b/util-vserver/doc/intro.txt deleted file mode 100644 index e649a75..0000000 --- a/util-vserver/doc/intro.txt +++ /dev/null @@ -1,1430 +0,0 @@ - - 1. [1]Introduction [new.gif] - 1.1 [2]Who needs that [new.gif] - 2. [3]Principles [new.gif] - 2.1 [4]Non reversible isolation [new.gif] - 2.2 [5]Isolation areas [new.gif] - 2.3 [6]New system calls [new.gif] - 2.4 [7]Limiting super-user: The capabilities system [new.gif] - 2.5 [8]Enhancing the capability system [new.gif] - 2.6 [9]Playing with the new system calls [new.gif] - 2.6.1 [10]Playing with /usr/sbin/chcontext [new.gif] - 2.6.2 [11]Playing with /usr/sbin/chcontext as root [new.gif] - 2.6.3 [12]Playing with /usr/sbin/chbind [new.gif] - 2.6.4 [13]Playing with /usr/sbin/reducecap [new.gif] - 2.7 [14]Unification [new.gif] - 3. [15]Applications [new.gif] - 3.1 [16]Virtual server [new.gif] - 3.2 [17]Per user fire-wall [new.gif] - 3.3 [18]Secure server/Intrusion detection [new.gif] - 3.4 [19]Fail over servers [new.gif] - 4. [20]Installation [new.gif] - 4.1 [21]The packages [new.gif] - 4.2 [22]Setting a virtual server [new.gif] - 4.3 [23]Basic configuration of the virtual server [new.gif] - 4.4 [24]Entering the virtual server [new.gif] - 4.5 [25]Configuring the services [new.gif] - 4.6 [26]Starting/Stopping the virtual server [new.gif] - 4.7 [27]Starting/Stopping all the virtual servers [new.gif] - 4.8 [28]Restarting a virtual server from inside [new.gif] - 4.9 [29]Executing tasks at vserver start/stop time [new.gif] - 4.10 [30]Issues [new.gif] - 4.11 [31]How real is it ? [new.gif] - 5. [32]Features [new.gif] - 6. [33]Future directions [new.gif] - 6.1 [34]User controlled security box [new.gif] - 6.2 [35]Kernel enhancements [new.gif] - 6.2.1 [36]Per context disk quota [new.gif] - 6.2.2 [37]Global limits [new.gif] - 6.2.3 [38]Scheduler [new.gif] - 6.2.4 [39]Security issues [new.gif] - 6.2.4.1 [40]/dev/random [new.gif] - 6.2.4.2 [41]/dev/pts [new.gif] - 6.2.4.3 [42]Network devices [new.gif] - 7. [43]Alternative technologies [new.gif] - 7.1 [44]Virtual machines [new.gif] - 7.2 [45]Partitioning [new.gif] - 7.3 [46]Limitation of those technologies [new.gif] - 8. [47]Conclusion [new.gif] - 9. [48]Download [new.gif] - 10. [49]References [new.gif] - - Virtual private servers and security contexts - - Running independent Linux servers inside a single PC is now possible. - They offer many advantages, including higher security, flexibility and - cost reduction. - - NEW - -Introduction - - Linux computers are getting faster every day. So we should probably - end up with less, more powerful servers. Instead we are seeing more - and more servers. While there are many reasons for this trend (more - services offered), the major issue is more related to security and - administrative concerns. - - Is it possible to split a Linux server into virtual ones with as much - isolation as possible between each one, looking like real servers, yet - sharing some common tasks (monitoring, backup, ups, hardware - configuration, ...) ? - - We think so ... NEW - -Who needs that - - The short answer is everybody, or everybody managing a server. Here - are some applications: - - * Hosting: Complete general purpose hosting (Running many - independent servers in one box). - * Experimentation: You are toying with a new services and do not - want to impact the production services on the same machine. - * Education: Each student has its own server with root password. - * Personal security box: Run un-trusted applications with complete - control over their interaction with the rest of the computer and - the network. - * Managing several "versions" of the same server/project and turning - on/off each version independantly. - - Just think about all the viruses and worms out there, you end up with - a big everybody using a computer needs this. :-) NEW - -Principles - - NEW - -Non reversible isolation - - Unix and Linux have always had the chroot() system call. This call was - used to trap a process into a sub-directory. After the system-call, - the process is led to believe that the sub-directory is now the root - directory. This system call can't be reversed. In fact, the only thing - a process can do is trap itself further and further in the file-system - (calling chroot() again). - - The strategy is to introduce new system calls trapping the processes - in other areas within the server. NEW - -Isolation areas - - A virtual server is isolated from the rest of the server in 5 areas: - - * File system - The vserver is trapped into a sub-directory of the main server and - can't escape. This is done by the standard chroot() system call - found on all Unix and Linux boxes. - * Processes - The vserver can only see the processes in the same security - context. Even the root server can't see the processes in vservers, - making the root server less "dangerous" to use. A special - mechanism (context number 1) exists to view all processes though - (Limited to root in the root server). - * Networking - The vserver is assigned a host name and an IP number. The server - can only use this IP number to establish services and client - connection. Further, this restriction is transparent. - * Super user capabilities - The super user running in a vserver has less privileges than the - normal Linux root user. For example, it can't reconfigure the - networking and many aspect of the system. It can't mount devices, - can't access block devices and so on. - Roughly. the vserver super-user has full control over all files - and processes in the vserver and that's pretty much it. - * System V inter process communications - Sysv IPC resources are private to each vserver. The security - context is used as an extra key to select and assign resources. - - Those facilities are used together to create a runtime environment for - virtual servers. But they can be used independently to achieve various - goals. NEW - -New system calls - - The new system calls, as well as the existing chroot() system call are - sharing one common feature: Their effect can't be reversed. Once you - have executed one of those system call (chroot, new_s_context, - set_ipv4root), you can't get back. This affects the current process - and all the child processes. The parent process is not influenced. - - * new_s_context (int ctx) - This system call sets a new security context for the current - process. It will be inherited by all child processes. The security - context is just an id, but the system call makes sure a new unused - one is allocated. - A process can only see other processes sharing the same security - context. When the system boot, the original security context is 0. - But this one is not privileged in anyway. Processes member of the - security context 0 can only interact (and see) processes member of - context 0. - This system call isolates the processes space. - * Setting the capabilities ceiling - This is handle by the new_s_context system call as well. This - reduces the ceiling capabilities of the current process. Even - setuid sub-process can't grab more capabilities. The capability - system found since Linux 2.2 is explained later in this document. - * set_ipv4root(unsigned long ip) - This system call locks the process (and children) into using a - single IP when they communicate and when they installs a service. - This system call is a one shot. Once a process have set its IPV4 - (Internet Protocol Version 4) address to something different from - 0.0.0.0, it can't change it anymore. Children can't change it - either. - If a process tries to bind a specific IP number, it will succeed - only if this corresponds to the ipv4root (if different from - 0.0.0.0). If the process bind to any address, it will get the - ipv4root. - Basically, once a process is locked to a given ipv4root it is - forced to use this IP address to establish a service and - communicate. The restriction on services is handy: Most service - (Web servers, SQL servers) are binding to address 0.0.0.0. With - the ipv4root sets to a given IP you can have two virtual servers - using the exact same general/vanilla configuration for a given - services and running without any conflict. - This system calls isolate the IP network space. - - Those system calls are not privileged. Any user may issue them. NEW - -Limiting super-user: The capabilities system - - Once you have created a virtual environment where processes have a - limited view of the file-system, can't see processes outside of their - world and can only use a single IP number, you still must limit the - damages those processes can do. The goal is to run virtual - environments and provide some root privileges. - - How do you limit those root processes from taking over the system, or - even just re-booting it. Enter the capability system. This is not new, - but we suspect many people have never heard of it. - - In the old Unix/Linux days, user root (user ID 0) could do things - other user ID could not. All over the place in the kernel, system - calls were denying access to some resources unless the user ID of the - process (effective ID in fact) was 0. Plain zero. - - The only way a process with user ID 0 could loose some privileges was - by changing to another ID. Unfortunately this was an all or nothing - deal. Enter the capabilities. - - Today, the difference between root and the other users is the - capability set. User root has all capabilities and the other users - have none. The user ID 0 does not mean anything special anymore. There - are around 30 capabilities defined currently. A process may request to - loose a capability forever. It won't be able to get it back. - - Capabilities allows a root process to diminish its power. This is - exactly what we need to create custom super-user. A super-user process - in a virtual server would have some privileges such as binding port - below 1024, but would not be able to reconfigure the network or reboot - the machine. Check the file /usr/include/linux/capability.h to learn - which one are available. - - Note that the new system calls (new_s_context and set_ipv4root) are - not controlled by capabilities. They are by nature irreversible. Once - a virtual server is trapped in a chroot/s_context/ipv4root box, it - can't escape from the parameters of this trap. - - NEW - -Enhancing the capability system - - The Linux capability system, is still a work in progress. At some - point, we expect to see capabilities attached to programs, - generalizing the setuid concept. A setuid program would become a - program with all capability granted. - - For now, this is not available. As explained above a process may - request to loose capabilities and its child process will be trapped - with a smaller capability set. - - Well, ..., it does not work that way. Unfortunately, until - capabilities could be assigned to program, we still need a way to get - back capabilities even in a child process. So the irreversible logic - of the capabilities is kind of short circuited in the kernel. - - To solve this, we have introduced a new per-process capability ceiling - (cap_bset). This one represents the capability set inherited by child - process, including setuid root child process. Lowering this ceiling is - irreversible for a process and all its child. - - This ceiling is handled by the new_s_context system call and the - reducecap and chcontext utilities (part of the vserver package). - - Using this, we can setup a virtual server environment where root has - less capabilities, so can't reconfigure the main server. - - NEW - -Playing with the new system calls - - The vserver package provides 3 utilities to make use of the new system - calls. We will describe shortly how they work and provide few example. - We invite the reader to try those example, so it has a better feel and - trust. - - After re-booting with a kernel implementing the new system calls, and - installing the vserver package, one is ready to do experiment. You do - not need to be root to test those new utilities. None of them is - setuid either. NEW - -Playing with /usr/sbin/chcontext - - The /usr/sbin/chcontext utility is used to enter into a new security - context. The utility switch the security context and execute a - program, specified on the command line. This program is now isolated - and can't see the other processes running on the server. - - The experiment with this, start two command windows (xterm), as the - same user ID. In each window execute the following commands: - - xterm - - Using chcontext: first window - -/usr/sbin/chcontext /bin/sh -pstree -killall xterm -exit - - Using chcontext: second window - In the first window, you start the xterm command (or any command you - like). In the second window you execute chcontext. This starts a new - shell. You execute pstree and see very little. You attempt to kill the - xterm and you fail. You exit this shell and you are back seeing all - processes. - - Here is another example. You switch context and you get a new shell. - In this shell you start an xterm. Then you switch context again and - start another sub-shell. Now the sub-shell is again isolated. - -/usr/sbin/chcontext /bin/sh -pstree -xterm & -pstree -# Ok now you see your xterm -/usr/sbin/chcontext /bin/sh -pstree -# the xterm is not there, killall will fail -killall xterm -# Now we exit the shell -exit -pstree -# the xterm is there -killall xterm -# Ok, it is gone -exit -# We are back to the initial security context - - Using chcontext several times - Processes isolated using chcontext are doubly isolated: They can't see - the other processes on the server, but the other processes can't see - them either. The original security context (0) when you boot is no - better than the other: It sees only process in security context 0. - - While playing with chcontext, you will notice an exception. The - process 1 is visible from every security context. It is visible to - please utilities like pstree. But only root processes in security - context 0 are allowed to interact with it. NEW - -Playing with /usr/sbin/chcontext as root - - The new_s_context system call has a special semantic for root - processes running in security context 0 and having the CAP_SYS_ADMIN - capability: They can switch to any context they want. - - Normally, new_s_context allocates a new security context by selecting - an unused one. It walks all processes and find an ID (an integer) not - currently in use. - - But root in security context 0 is allowed to select the context it - wants. This allow the main server to control the virtual server. The - chcontext utility has the --ctx option to specify the context ID you - want. - - To help manage several virtual server, given that the security context - 0 can't see processes in other security context, it is a good thing - root in the main server (security context 0) is allowed to select a - specific context. Cool. But we also need a way to have a global - picture showing all processes in all security context. The security - context 1 is reserved for this. Security context 1 is allowed to see - all processes on the server but is not allowed to interact with them - (kill them). - - This special feature was allocated to security context 1 and not 0 - (the default when you boot) to isolate virtual servers from the main. - This way, while maintaining services on the main server, you won't - kill service in vservers accidentally. - - Here is an example showing those concepts: - -# You must be root, running X -# We start an xterm in another security context -/usr/sbin/chcontext xterm & -# We check, there is no xterm running, yet we can -# see it. -ps ax | grep xterm -# Are we running in security context 0 -# We check the s_context line in /proc/self/status -cat /proc/self/status -# Ok we in security context 0 -# Try the security context 1 -/usr/sbin/chcontext --ctx 1 ps ax | grep xterm -# Ok, we see the xterm, we try to kill it -/usr/sbin/chcontext --ctx 1 killall xterm -# No, security context 1 can see, but can't kill -# let's find out in which security context this -# xterm is running -/usr/sbin/chcontext --ctx 1 ps ax | grep xterm -# Ok, this is PID XX. We need the security context -/usr/sbin/chcontext --ctx 1 cat /proc/XX/status -# We see the s_context, this is SS. -# We want to kill this process -/usr/sbin/chcontext --ctx SS killall xterm - - chcontext as root - The /usr/sbin/vpstree and /usr/sbin/vps commands are supplied by the - vserver package. They simply runs ps and pstree in security context 1. - NEW - -Playing with /usr/sbin/chbind - - The chbind utility is used to lock a process and its children into - using a specific IP number. This applies to services and client - connection as well. Here are few examples. Execute them as root: - -# httpd is running -netstat -atn | grep ":80 " -# We see a line like this -# tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -# Now we restart httpd, but we lock it so it -# uses only the main IP of eth0 -/usr/sbin/chbind --ip eth0 /etc/rc.d/init.d/httpd restart -netstat -atn | grep ":80 " -# Now we see a line like -# tcp 0 192.168.1.1:80 0.0.0.0:* LISTEN -# httpd.conf was not changed. -# Now, restart it normally -/etc/rc.d/init.d/httpd restart -# Now we experiment with client socket -# Log using telnet -telnet localhost -# Once logged in -netstat -atn | grep ":23 " -# You should see a line showing a connection from -# 127.0.0.1 to 127.0.0.1 like this -# tcp 0 0 127.0.0.1:23 127.0.0.1:32881 ESTABLISHED -exit -# Now we do the telnet again, bug forcing it to select a specific IP -/usr/sbin/chbind --ip eth0 telnet localhost -# Log in and then execute -netstat -atn | grep ":23 " -# You will get something like -# tcp 0 0 127.0.0.1:23 192.168.3.9:32883 ESTABLISHED - - Using /usr/sbin/chbind - NEW - -Playing with /usr/sbin/reducecap - - The reducecap utility is used to lower the capability ceiling of a - process and child process. Even setuid program won't be able to grab - more capabilities. - -# You are not root now -# What is the current capability ceiling -cat /proc/self/status -# The capBset line presents mostly 1s. -/usr/sbin/reducecap --secure /bin/sh -cat /proc/self/status -# The capBset now shows many more 0s. -# The capEff shows all 0s, you have no privilege now -# We su to root -su -cat /proc/self/status -# capEff is much better now, but there are still many 0s -# Now we try to see if we are really root -tail /var/log/messages -# So far so good, we see the content -/sbin/ifconfig eth0 -/sbin/ifconfig eth0 down -# No way, we can't configure the interface. In fact -# we have lost most privilege normally assigned to root -exit - - Using /usr/sbin/reducecap - NEW - -Unification - - Installing a virtual private server copies a linux installation inside - a sub-directory. It is a linux inside linux. If you intend to run - several vservers on the same box (which you will certainly do :-) ), - you will end up using a lot of disk space needlessly: Each vserver is - made up hundreds of megabytes of the same stuff. This is a big waste - of disk space. - - A solution is to use hard links to connect together common files. - Using the package information, we can tell which packages are shared - between various vservers, which files are configuration files and - which are not (binaries, libraries, resource files, ...). Non - configuration files may be linked together saving a huge amount of - disk space: A 2 GIG rh7.2 installation shrinks to 38megs. - - Using hard links is cool, but may be a problem. If one vserver - overwrite one file, say /bin/ls, then every vserver will inherit that - change. Not fun! The solution is to set the immutable bit on every - linked file. A file with such a bit on can't be modified, even by - root. The only way to modify it is to turn off the bit first. But - within a vserver environment, even root is not allowed to perform this - task. So linked file, turned immutable, are now safe: They can be - shared between vservers without side effects: Cool! - - Well, there is still another side effect. All vservers are now locked - with the same files. We are saving a lot of disk space, but we pay a - very heavy price for that: Vservers can't evolve independantly. - - A solution was found. A new bit call immutable-linkage-invert was - added. Combined with the immutable bit, a file may not be modified, - but may be unlinked. Unlinking a file in Unix/Linux means - disconnecting the name from the data and removing the name from the - directory. If the data is still referenced by one or more vservers, it - continue to exist on disk. So doing "rm /bin/ls" on a vserver, removes - the file /bin/ls for that vserver and that's all. If all vservers - perform this task, then /bin/ls (the data) will be forgotten completly - and the disk space will be recovered. - - Using this trick, a vserver gets back its independance. It becomes - possible to update packages by using the unlink/update sequence: - Unlink /bin/ls first and then put a new copy in place. Luckily, - package manager works this way. - - To keep this story short (probably too late :-) ), a unified vserver: - * Uses little disk space - * Can't interfere with other vservers by changing one of its file. - * Can perform package update/deletion normally using standard - practice. - - NEW - -Applications - - NEW - -Virtual server - - The first goal of this project is to create virtual servers sharing - the same machine. A virtual server operate like a normal Linux server. - It runs normal services such as telnet, mail servers, web servers, SQL - servers. In most cases, the services run using standard configuration: - The services are running unaware of the virtual server concept. - - Normal system administration is performed with ordinary admin tool. - Virtual servers have users account and a root account. - - Packages are installed using standard packages (RPMs for example). - - There are few exceptions. Some configuration can't be done inside a - virtual server. Notably the network configuration and the file-system - (mount/umount) can't be performed from a virtual server. - - NEW - -Per user fire-wall - - The set_ipv4root() system call may be used to differentiate the - various users running on an application server. If you want to setup a - fire-wall limiting what each user is doing, you have to assign one IP - per user, even if they are running application on the same server. The - chbind utility may be used to achieve that. NEW - -Secure server/Intrusion detection - - While it can be interesting to run several virtual servers in one box, - there is one concept potentially more generally useful. Imagine a - physical server running a single virtual server. The goal is isolate - the main environment from any service, any network. You boot in the - main environment, start very few services and then continue in the - virtual server. The service in the main environment could be - - * Un-reachable from the network. - * The system log daemon. While virtual server could log messages, - they would be unable to change/erase the logs. So even a cracked - virtual server would not be able the edit the log. - * Some intrusion detection facilities, potentially spying the state - of the virtual server. For example tripwire could run there and it - would be impossible to circumvent its operation or trick it. - - NEW - -Fail over servers - - One key feature of a virtual server is the independence from the - actual hardware. Most hardware issues are irrelevant for the virtual - server installation. For example: - - * Disk layout, partitions and the /etc/fstab configuration. The - virtual server has a dummy /etc/fstab. - * Network devices. - * Processor type, number of processor (kernel selection). - - The main server acts as a host and takes care of all those details. - The virtual server is just a client and ignores all the details. As - such, the client can be moved to another physical server will very few - manipulations. For example, to move the virtual server v1 from one - physical one computer to another, you do - - * Turn it off - /usr/sbin/vserver v1 stop - * Copy the file /etc/vservers/v1.conf to the new server. - * Copy all files in /vservers/v1 to the new server - * On the new server, start the vserver v1 - /usr/sbin/vserver v1 start - - As you see, there is no adjustment to do: - - * No user account merging. - * No hardware configuration to fix. - - This opens the door to fail over servers. Imagine a backup server - having a copy of many virtual servers. It can take over their tasks - with a single command. Various options exists for managing this backup - server: - - * rsync to synchronize the data. - * Network block devices to synchronize the data in real time. - * Sharing the installation over a SAN (storage area network). - * Heartbeat for automatic monitoring/fail over. - - NEW - -Installation - - NEW - -The packages - - * The kernel - We are supplying a patched 2.4.20 kernel. You will find [50]here - the kernel, the .config and the patch. - To install the kernel, just untar it. This will create a file - /boot/kernel-2.4.20ctx-17 (ctx stands for security context) and a - directory /lib/modules/2.4.20ctx-17. - Then, you need to update your boot loader. For lilo, you add a - section like this at the end of the file /etc/lilo.conf - - -image=/boot/vmlinuz-2.4.20ctx-17 - label=linux2.4.20ctx-17 - read-only - root=current - - lilo.conf section to add - Change the /dev/XXXX to your root partition. Then execute - /sbin/lilo. - Reboot and select the proper kernel. This kernel is fully - compatible with a normal 2.4.20 and will perform without any new - configuration. Note that the supplied kernel does not carry all - the features and modules found on the various distributions. - * The vserver package - This package provides the various utilities to make use of those - new system calls. The package also provides a complete solution to - implement virtual servers. We describe the major components here. - + /usr/sbin/chcontext - This is the utility to request a new security context. It can - be used to lower the capability ceiling. Execute it to learn - more. - + /usr/sbin/chbind - This is the utility to select one IP number and assign it to - a process and its children. - + /usr/sbin/newvserver (in vserver-admin) - Front-end to help create new virtual servers. - + /usr/sbin/reducecap - This utility is used to lower the capability ceiling of - children processes. - + /usr/sbin/vdu - A trimmed down "du" command reporting space usage of files - with a single link. Useful to tell how much space a unified - vserver is using. - + /usr/sbin/vkill - Locate the security context associated with a process, enter - it and kill the process. Generally used after you have - located a process with vtop, vpstree or vps. - + /usr/sbin/vps - Execute the ps command in security context 1 so all processes - in all vservers are shown. The security context and vserver - name are mapped inside the report. - + /usr/sbin/vpstree - Execute the pstree command in security context 1 so all - processes in all vservers are shown. - + /usr/sbin/vrpm - Apply an rpm command in several (or all) vservers. Useful - when you wish to update many vservers with the same package. - /usr/sbin/vrpm server1 server2 -- -Uvh /tmp/*.rpm - /usr/sbin/vrpm ALL -- -Uvh /tmp/*.rpm - After updating many packages in different vservers you may - want to re-unify them to recover disk space (and increase - cache effectivity). You can do this using the vunify command, - or simply by using the --unify option to the vrpm command. - After performing the rpm updates, vrpm will trigger the - vunify utility on the vservers for the updated packages. - /usr/sbin/vrpm --unify server1 server2 -- -Uvh /tmp/*.rpm - + /usr/sbin/vserver - This is the wrapper to start, stop and administer virtual - servers. - + /usr/sbin/vserver-stat - Produce a small report showing the activity in active - security context. The report presents the number of process - in each active security context as well as the name of the - vserver associated with this context. - + /usr/sbin/vtop - Execute the top command in security context 1 so all - processes in all vservers are shown. - + /etc/rc.d/init.d/vservers - This is an init script used to start all virtual servers at - boot time and stop them at shutdown time. Only virtual - servers with ONBOOT=yes are started at boot time. All - vservers are stopped at shutdown time. - + /etc/rc.d/init.d/rebootmgr - This is a daemon listening to requests from virtual servers. - It can either restart or stop a virtual server. The - /sbin/vreboot and /sbin/vhalt utilities are used to send - request to the reboot manager. - + /sbin/vreboot and /sbin/vhalt - Those utilities are copied in each virtual server. They - connect to the reboot manager (rebootmgr) server using the - /dev/reboot Unix domain socket and request either a restart - or a stop of the virtual server. The reboot manager issue - either a "/usr/sbin/vserver vserver restart" or - "/usr/sbin/vserver vserver stop" command. This allows the - virtual server administrator to test if all automatic service - are properly restarted at boot time. - + /usr/lib/vserver/vdu - This is a limited clone of the du command. It skips file with - more than one link. It is used to evaluate the disk usage of - an unified vserver. Using the normal du for this task is - misleading since it will count all unified files. - - NEW - -Setting a virtual server - - To set a virtual server, you need to copy in a sub-directory a Linux - installation. One way to achieve that is to copy some parts of the the - current server by issuing the command vserver XX build, where XX is - the name of the virtual server (pick one). This basically does (Well, - it does a little more than that, but this give you an idea): - -mkdir /vservers/XX -cd /vservers/XX -cp -ax /sbin /bin /etc /usr /var /dev /lib . -mkdir proc tmp home -chmod 1777 tmp - - Building a virtual server - - This is normally done using the command /usr/sbin/newvserver. This is - a text mode/graphical front-end allowing to setup the vserver runtime - and configure it. NEW - -Basic configuration of the virtual server - - A virtual private server has a few settings. They are defined in the - file /etc/vservers/XX.conf where XX is the name of the virtual server. - This is a simple script like configuration. Here are the various - parameters: - - * IPROOT - In general, each virtual server is tied to one IP using the new - set_ipv4root system call. This way several servers may run the - same services without conflict. Enter the IP number (a name is - also valid if defined in the DNS). - Since kernel ctx-12, you can assign more than one IP number to a - vserver. Enter them separated by spaces and don't forget to - enclose them with quotes. - Bu default, all IPs are configured as an IP alias on the IPROOTDEV - device (if defined). If you want to attach the various IP numbers - to different devices, specify the device as a prefix to the IP - number like this: - -IPROOT="eth0:192.168.1.2 eth1:192.168.3.1 192.168.1.4" - - IPROOT using multiple devices - In the example above, the IP 192.168.1.4 will be installed as an - IP alias on the device IPROOTDEV. - Use "IPROOT=0.0.0.0" or "IPROOT=" if you do not want to tie the - vserver at all. It will be allowed to use any IP available on the - server. - * IPROOTDEV - This is the network device use to setup the IP alias defined by - IPROOT. This is generally eth0. If you define this variable, the - IP alias will be configured when you start the virtual server and - un-configure when you stop it. - * IPROOTMASK - Netmask used to setup the IP alias. Uses the netmask of the - IPROOTDEV device by default. Seldom used. - If you have several IPs on one vserver and want to have different - netmask for each, use the following syntax: - -IPROOT="eth0:192.168.1.2 eth1:192.168.3.1/255.255.255.192" - - IPROOT using different netmask - 192.168.1.2 will use the netmask of eth0, while 192.168.3.1 will - use the specified netmask: 255.255.255.192. - * IPROOTBCAST - Broadcast address used to setup the IP alias. Uses the broadcast - of the IPROOTDEV device by default. Seldom used. - * ONBOOT - The vserver package supplies the vservers service. This service is - installed in the main server. It is used to start and stop the - virtual server at boot and shutdown time. - Virtual server with ONBOOT=yes will be started and stopped - properly like any other services of the main server. - Once a virtual server is properly configured, it is a good idea to - set this parameter to yes. - * S_CAPS - You enter here the various capability you want to grant to the - vserver. By default, a vserver is left with much less capabilities - than the root server. For example, a vserver is not allowed to use - raw socket. This explains why the ping command fails. S_CAPS lets - you enumerate the capability you want to keep in the vserver. - CAP_NET_RAW will give back ping ability for example. - * S_CONTEXT - This is optional. In general the security context ID is selected - by the kernel. An unused one is selected. If you select an ID (an - integer greater than 1), make sure you select a different one for - each server. Again, in most cases, you do not need to select one. - Leave the line commented. - * S_DOMAINNAME - A virtual server may have a different NIS domainname than the main - server. You set it here. If you leave the field empty, the vserver - will inherit the same NIS domain as the root server. Enter "none" - to reset the NIS domain name for this vserver. - * S_HOSTNAME - Many services (Apache for one) use the host name to setup some - defaults. A virtual server may have a different host name than the - main server. It is a good idea to fill this line. - * S_NICE - The is an optional priority level. It is an integer ranging - between from -20 to 19. Well it is the nice level in fact, so -20 - means the highest priority and 19 the lowest (the highest nice - level). All processes in the virtual server will be locked to this - level (or higher niceness). - Event root is locked and can't get more priority. - Note that this has limited usefulness. The kernel does not - differentiate processes running in different security context for - scheduling (for now :-) ). This means that a virtual servers - running many low priority processes may nevertheless claim a large - share of CPU. - * S_FLAGS - This is used to set various flags. Here are the supported flags: - + lock - This flags prevents the vserver from setting new security - contexts. - + sched - It kind of unifies the processes in a vserver from a - scheduler view point. All processes are weighted as single - one when compared to other processes in the real server. This - prevents a vserver from taking to much CPU resources. - + nproc - Make the ulimit maximum user process global to the vserver. - + private - Once set on a vserver security context, no other process can - enter it. Even the root server is unable to enter the - context. It can see the process list using security context - 1, but can't signal or trace the process. - + fakeinit - This assigned the current process so it works like the - process number 1. Using this trick, a normal /sbin/init may - be run in a vserver. The /usr/sbin/vserver command will use - /sbin/init to start and stop a vserver. A properly configured - /etc/inittab is needed though. - o Processes loosing their parent are reparent to this - process. - o getppid() done by child process of this process returns - 1. - o getpid() done by this process returns 1. - o This process is not shown in /proc since process number - 1 is always shown. - o An "initpid" entry is available in /proc/*/status to - tell which process is the fake init process. - * ULIMIT - This contains the command line option to the ulimit shell command. - You enter here whatever parameters accepted by ulimit. Here is the - default when you create a new vserver: - -ULIMIT="-H -u 1000" - - Default vserver ulimit - Normally ulimit settings only affects users independantly. So - limiting a vserver this way, limit each user processes - independantly in the vserver. Using special flags in the S_FLAGS - option, you can make those ulimit settings global to the vserver. - The example above used with the nproc parameter make the maximum - number of process global. In this case, a maximum of 1000 - processes is available to all users in the vserver. - - NEW - -Entering the virtual server - - It is possible to enter a virtual server context from the main server - just by executing /usr/sbin/vserver XX enter (where XX is the virtual - server name). - - This creates a shell. From there you can execute anything - administrative you normally do on a Linux server. - - NEW - -Configuring the services - - The virtual server can run pretty much any services. Many pseudo - services, such as network configuration are useless (the server is - already configured). After building the environment, enter it (without - starting the virtual server) using the vserver name enter command. - Then using a tool like Linuxconf (control/control service activity) , - or ntsysv, browse all service and keep only the needed ones. - - So after building the server, you enter it and you select the service - you need in that server. Many services such as network, and apmd are - either useless or won't run at all in the virtual server. They will - fail to start completely. NEW - -Starting/Stopping the virtual server - - Virtual server with ONBOOT=yes will be started and stopped like any - other services of the main server. But you can stop and start a - virtual server at any time. Starting a server means that all - configured service will be started. Stopping it means that all - configured services will be stopped and then all remaining process - will be killed. - - Oddly, starting a virtual server does not mean much. There is no - overhead. No monitoring process or proxy or emulator. Starting a - virtual server with 4 services is the same as running those 4 services - in the main server, at least performance wise (the service inside a - virtual server are locked inside the security context). - - The following commands may be used to control a virtual server: - - * /usr/sbin/vserver server start - * /usr/sbin/vserver server stop - * /usr/sbin/vserver server restart - * /usr/sbin/vserver server running - * /usr/sbin/vserver server enter - * /usr/sbin/vserver server exec some commands ... - * /usr/sbin/vserver server suexec user some commands ... - * /usr/sbin/vserver server service service-name - start/stop/restart/status - * /usr/sbin/vserver server status - - The running command prints if there are any processes running in the - virtual server context. - - Please note - - The processes running in a virtual server are invisible from the main - server. The opposite is true. This is very important. Managing the - main server must not cause problems to the various virtual servers. - For example, doing killall httpd will kill all the httpd processes in - the current context ( the main server or a virtual one). - - NEW - -Starting/Stopping all the virtual servers - - The sysv script /etc/rc.d/init.d/vserver is used to start and stop the - virtual server at boot and shutdown time. It may be used at any time - to operate all virtual servers. The following commands are supported: - - * /etc/rc.d/init.d/vservers start - * /etc/rc.d/init.d/vservers stop - * /etc/rc.d/init.d/vservers restart - * /etc/rc.d/init.d/vservers status - - The status command reports the running status of every virtual server. - NEW - -Restarting a virtual server from inside - - A virtual server administrator is not allowed to reboot the machine - (the kernel). But it is useful to restart his virtual server from - scratch. This allow him to make sure all the services are properly - configured to start at boot time. - - The /sbin/vreboot and /sbin/vhalt utilities are installed in each - virtual server so they can request a restart or stop. - - The rebootmgr service must be enabled in the main server. - - NEW - -Executing tasks at vserver start/stop time - - You can setup a script called /etc/vservers/XX.sh where XX is the name - of the virtual server. This script will be called four time: - - * Before starting the vserver - * After starting it. - * Before stopping it. - * After stopping it. - - You generally perform tasks such as mounting file system (mapping some - directory in the vserver root using "mount --bind"). - - Here is an example where you map the /home directory as the vserver - /home directory. - -#!/bin/sh -case $1 in -pre-start) - mount --bind /home /vservers/$2/home - ;; -post-start) - ;; -pre-stop) - ;; -post-stop) - umount /vservers/$2/home - ;; -esac - - /etc/vservers/XX.sh - NEW - -Issues - - There are some common problem you may encounter. Here they are. - - * The main server is not tied (by default) to any ipv4root. So if - the main server has already some service running they are probably - binding some UDP or TCP ports using the address 0.0.0.0. Once a - process has bound a service with the address 0.0.0.0 (see the - LISTEN lines when executing the "netstat -a" command), no other - process can bind the same port, even with a specific address. - The solution is to start the services of the main server using the - chbind utility to trap them in one ipv4root. For example - -/sbin/chbind --ip eth0 /etc/rc.d/init.d/httpd start - - Assigning on IP to a service - will limit Apache to the IP address of the eth0 interface. without - configuration changes (in httpd.conf). It is probably a good idea - to start the following services in the main server this way, - because they will be run by virtual servers as well. - - * httpd - * sshd - * xinetd - - To ease this, the vserver package supplies the following services: - v_httpd, v_sshd, v_smb and v_xinetd. Disable the corresponding - services and enable the v_ services and you will lock those services - on a single IP. - - Cleanup rc.local. This is probably not doing anything useful. - - NEW - -How real is it ? - - The project is new. So far, experiments have shown very little - restrictions. Service works the same in a virtual server. Further, - performance is the same. And there is a high level of isolation - between the various virtual servers and the main server. NEW - -Features - - There are various tricks one can use to make the virtual servers more - secure. - - * Putting a fire-wall on the box and limiting access to a virtual - services from another one. - * Using port redirection to allow one virtual server to logically - bind several IPs. One virtual server could run several web virtual - host this way. - - NEW - -Future directions - - NEW - -User controlled security box - - By combining the capabilities, the s_context, the ipv4root and the - AclFS (component of the [51]virtualfs package), we can produce a user - level tool allowing controlled access to the user own resources. For - example the user may download any program he wants and execute them - under control. Whenever the program tries to access something not - specified by the user, a popup is presented and the user may choose to - terminate the program or allow the access. - - NEW - -Kernel enhancements - - We expect to see some wider usage of the virtual servers. As usage - grow, we expect to see needs for more control. Here are some ideas. - - NEW - -Per context disk quota - - If one installs virtual servers and grant access to less trusted - users, he may want to limit the disk space used. Since a virtual - server may create new user accounts and run processes with any user ID - it wants, the current kernel disk quota is not powerful enough. First, - it can't differentiate between user ID 100 in one virtual server and - user ID 100 in another one. - - Further, the main administrator may want to control disk space - allocated to the virtual server on a server per server basis, - unrelated to the various user ID in use in those virtual servers. - - The kernel has already user and group disk quota. Adding security - context disk quota should be easily done. - - To differentiate between user IDs in virtual servers, the kernel could - coin together the security context and the user id to create a unique - ID. The kernel 2.4 now supports 32 user ID, so combining security - context and user ID in a single 32 bits number should be acceptable. - - NEW - -Global limits - - The kernel has supports for user limit (memory, processes file - handles). With virtual server, we may want to limit the resources used - by all processes in the virtual server. The security context would be - used as the key here. The following resources could be limited on a - security context basis (as opposed to user or process basis) - - * Memory used - * Processes number - (Done: This is now supported with the nproc flag in the kernel - 2.4.16ctx-4. By default a new vserver is limited to 1000 processes - maximum, configurable). - * File handles - - NEW - -Scheduler - - The scheduler may become security context aware. It could potentially - use this to provide some fairness and control priority based on - context. Currently the scheduler is process oriented and does not - group process together to qualify their priorities. For example, a - user running 10 compilations will get more CPU than another user - running a single compilation. - - Currently, it is possible to raise the nice (lower priority) for all - processes in a virtual server. This can't be reversed, so you are - setting an upper limit on priority (Just set the S_NICE variable in - the vserver configuration file). Note that a virtual server may still - start many low priority processes and this can grab significant share - of the CPU. A global per security context might be needed to really - provide more control and fairness between the various virtual servers. - - Done: The sched security context flag group all process in a vserver - so their priority is kind of unified. If you have 50 processes running - full speed in one vserver, they will take as much CPU resource than a - single process in the root server. A vserver can't starve the other... - NEW - -Security issues - - The current kernel + patch provides a fair level of isolation between - the virtual servers. User root can't take over the system: He sees - only his processes, has only access to his area of the file system - (chroot) and can't reconfigure the kernel. Yet there are some - potential problems. They are fixable. As usage grows, we will know if - they are real problems. Comments are welcome: - - NEW - -/dev/random - - Writing to /dev/random is not limited by any capability. Any root user - (virtual included) is allowed to write there. Is this a problem ? - - (kernel expert think it is ok) NEW - -/dev/pts - - /dev/pts is a virtual file-system used to allocate pseudo-tty. It - presents all the pseudo-tty in use on the server (including all - virtual server). User root is allowed to read and write to any - pseudo-tty, potentially causing problems on other vservers. - - Starting with the ctx-6 patch, /dev/pts is virtualised. Although the - file numbers are allocated from a single pool, a vserver only see the - pseudo-tty it owns. NEW - -Network devices - - Anyone can list the network devices configurations. This may inform a - virtual user that another vserver is on the same physical server. By - using as much resources as possible in his own vservers, a malicious - user could slow down the other server. Modification to the scheduler - explained above could stop this. - - Starting with the ctx-6 patch, a vserver only see the device - corresponding to its IP number. NEW - -Alternative technologies - - Using virtual servers may be a cost effective alternative to several - independent real servers. You get the administrative independence of - independent servers, but share some costs including operation costs. - - Other technologies exist offering some of the advantages talked in - this document as well as other. Two technologies are available on - various hardware platform: Virtual machines and partitioning, NEW - -Virtual machines - - This has been available for mainframes for a while now. You can boot - several different OS at once on the same server. This is mainly used - to isolate environments. For example, you can install the new version - of an OS on the same server, even while the server is running the - current version. This allows you to test and do a roll-out gracefully. - - The advantages of virtual machines are: - - * Total flexibility. You can run many different OS and different - version of the same OS, all at once. - * Robustness. You have total isolation. One OS may crash without - affecting the other. - * Resource management. You can effectively limit the resources taken - by one OS. - * Hardware Independence. The client OS is using virtual disks - provided by the host OS. - - This technology is not directly available on PCs. The Intel x86 - architecture does not support visualization natively. Some products - nevertheless have appeared and provide this. You can run Linux inside - Linux, or this other OS (Which BTW has a logo showing a window flying - in pieces, which quite frankly tells everything about it). - - The solutions available on PCs carry most of the advantages of the - virtual machines found on mainframe, except for performance. You can't - run that many virtual Linux's using this technology and expect it to - fly. One example of this technology is [52]vmware, which is quite - useful, especially if you must run this other OS... vmware may be used - to run Linux inside Linux, even test Linux installation while running - linux... NEW - -Partitioning - - Partitioning (domains ?) is a way to split the resources of a large - server so you end up with independent servers. For example, you can - take a 20 CPUs server and create 3 servers, two with 4 CPUs and one - with 12. You can very easily re-assign CPUs to servers in case you - need more for a given tasks. - - This technology provides full Independence, but much less flexibility. - If your 12 CPUs server is not working much, the 4 CPUs one can't - borrow some CPUs for 5 minutes. NEW - -Limitation of those technologies - - Oddly, one disadvantage of those technologies is a side effect of - their major advantage: Total Independence. Each virtual server is - running its own kernel. Cool. This makes the following tasks more - difficult or impossible: - - * Sharing administrative tasks such as backup. The virtual servers - are using volumes in the host server. The host server can't handle - the files in those volumes directly without interfering with the - client OS. It has to use some services of the client OS to access - the file. - The vserver solution does not have this limitation since the - virtual servers are living in the same file-system, sharing the - same kernel. - * Task monitoring. The virtual servers run their own kernel. As - such, the host OS can't spy on the tasks and check for intrusion - for example. - * Disk space. Virtual servers are using either volumes or full - devices in the host server. This space is pre-allocated to the - maximum needed by the server. You end up with a lot of wasted disk - space. Imagine running 100 virtual servers this way and allocating - say 10 gigs to each. You get the picture. The vserver solution is - sharing a common file-system so the free disk space is available - to all. - Further, if you are running the same Linux distribution in the - virtual servers, you can unify the disk space using hard link and - immutable attributes. The /usr/lib/vserver/vunify was created to - test that. Using information found in the rpm package the script - links the files, except configuration ones. - Testing vunify on a vserver installed with a RedHat 6.2 - distribution, unifying the packages glibc, binutils, perl, and - bash saved 60 megs. Quite a few packages are not changing often - and could be unified. - Vservers do not need kernel packages and hardware configuration - tools. This also contribute to save disk space. - * File system sharing - A little the same as above. You can't share file system easily - between vservers unless you use network services (often slower). - Using "mount --bind", it is very easy to "map" any directory of - the root server in several vservers, providing raw speed access - (and even sharing the disk cache). - - NEW - -Conclusion - - Virtual servers are interesting because they can provide a higher - level of security while potentially reducing the administration task. - Common operation such as backup, are shared between all servers. - Services such as monitoring may be configured once. - - A Linux server can run many services at once with a high level of - reliability. As servers are evolving, more and more services are - added, often unrelated. Unfortunately there are few details here and - there, making the server more complex than it is in reality. When one - wants to move one service to another server, it is always a little - pain: Some user accounts have to be moved and some configuration - files. A lot of hand tweaking. - - By installing services in separate virtual servers, it becomes much - easier to move services around (just by moving a directory although a - big one). - - Virtual servers may become a preferred way to install common Linux - servers. NEW - -Download - - The ftp site for this project is - [53]ftp://ftp.solucorp.qc.ca/pub/vserver . You will find there the - following components. - - * [54]kernel-2.4.20ctx-17.tar.gz - [55]kernel-2.4.20ctxsmp-17.tar.gz - A pre-compiled kernel for Pentium class machine and up. An SMP - kernel is also supplied. - * [56]vserver-0.22-1.src.rpm - The source RPM for the vserver utilities - * [57]vserver-0.22-1.i386.rpm - A compiled rpm for RedHat 7.x and up. Should work on any recent - distribution (glibc 2.2). You need a recent distribution to - operate a kernel 2.4 anyway. - * [58]vserver-admin-0.22-1.i386.rpm - Contains the command /usr/sbin/newvserver. It is a GUI to create - vservers. It requires the linuxconf-utils and linuxconf-lib - packages. You can get them from [59]here. linuxconf itself is not - needed though. - * [60]vserver-0.22.src.tar.gz - The vserver utilities source - * [61]patch-2.4.20ctx-17.gz - The patch against Linux 2.4.20 - * [62]patches - The various relative patches (ctxN-ctxN+1) - - NEW - -References - - This project is maintained by Jacques Gelinas [63]jack@solucorp.qc.ca - - The vserver package is licensed under the GNU PUBLIC LICENSE. - - A FAQ can be found at - [64]http://www.solucorp.qc.ca/howto.hc?projet=vserver - - A mailing list has been created to exchange about this project. It is - [65]vserver@solucorp.qc.ca .You can subscribe [66]here - - The mailing list is archived [67]here. - - The change logs for the vserver package are [68]here . - - The official copy of this document is found at - [69]http://www.solucorp.qc.ca/miscprj/s_context.hc - - This document was produced using the [70]TLMP documentation system - - [71]Top - [72]Back to project page - [73]About tlmpdoc and cookies - Document maintained by Jacques Gélinas ([74]jack@solucorp.qc.ca) - Last update: Wed Apr 16 11:22:22 2003 - -Références - - 1. http://remtk/solucor/miscprj/s_context.hc?s1=1&s2=0&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 2. http://remtk/solucor/miscprj/s_context.hc?s1=1&s2=1&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 3. http://remtk/solucor/miscprj/s_context.hc?s1=2&s2=0&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 4. http://remtk/solucor/miscprj/s_context.hc?s1=2&s2=1&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 5. http://remtk/solucor/miscprj/s_context.hc?s1=2&s2=2&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 6. http://remtk/solucor/miscprj/s_context.hc?s1=2&s2=3&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 7. http://remtk/solucor/miscprj/s_context.hc?s1=2&s2=4&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 8. http://remtk/solucor/miscprj/s_context.hc?s1=2&s2=5&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 9. http://remtk/solucor/miscprj/s_context.hc?s1=2&s2=6&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 10. http://remtk/solucor/miscprj/s_context.hc?s1=2&s2=6&s3=1&s4=0&full=0&prjstate=1&nodoc=0 - 11. http://remtk/solucor/miscprj/s_context.hc?s1=2&s2=6&s3=2&s4=0&full=0&prjstate=1&nodoc=0 - 12. http://remtk/solucor/miscprj/s_context.hc?s1=2&s2=6&s3=3&s4=0&full=0&prjstate=1&nodoc=0 - 13. http://remtk/solucor/miscprj/s_context.hc?s1=2&s2=6&s3=4&s4=0&full=0&prjstate=1&nodoc=0 - 14. http://remtk/solucor/miscprj/s_context.hc?s1=2&s2=7&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 15. http://remtk/solucor/miscprj/s_context.hc?s1=3&s2=0&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 16. http://remtk/solucor/miscprj/s_context.hc?s1=3&s2=1&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 17. http://remtk/solucor/miscprj/s_context.hc?s1=3&s2=2&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 18. http://remtk/solucor/miscprj/s_context.hc?s1=3&s2=3&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 19. http://remtk/solucor/miscprj/s_context.hc?s1=3&s2=4&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 20. http://remtk/solucor/miscprj/s_context.hc?s1=4&s2=0&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 21. http://remtk/solucor/miscprj/s_context.hc?s1=4&s2=1&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 22. http://remtk/solucor/miscprj/s_context.hc?s1=4&s2=2&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 23. http://remtk/solucor/miscprj/s_context.hc?s1=4&s2=3&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 24. http://remtk/solucor/miscprj/s_context.hc?s1=4&s2=4&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 25. http://remtk/solucor/miscprj/s_context.hc?s1=4&s2=5&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 26. http://remtk/solucor/miscprj/s_context.hc?s1=4&s2=6&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 27. http://remtk/solucor/miscprj/s_context.hc?s1=4&s2=7&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 28. http://remtk/solucor/miscprj/s_context.hc?s1=4&s2=8&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 29. http://remtk/solucor/miscprj/s_context.hc?s1=4&s2=9&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 30. http://remtk/solucor/miscprj/s_context.hc?s1=4&s2=10&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 31. http://remtk/solucor/miscprj/s_context.hc?s1=4&s2=11&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 32. http://remtk/solucor/miscprj/s_context.hc?s1=5&s2=0&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 33. http://remtk/solucor/miscprj/s_context.hc?s1=6&s2=0&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 34. http://remtk/solucor/miscprj/s_context.hc?s1=6&s2=1&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 35. http://remtk/solucor/miscprj/s_context.hc?s1=6&s2=2&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 36. http://remtk/solucor/miscprj/s_context.hc?s1=6&s2=2&s3=1&s4=0&full=0&prjstate=1&nodoc=0 - 37. http://remtk/solucor/miscprj/s_context.hc?s1=6&s2=2&s3=2&s4=0&full=0&prjstate=1&nodoc=0 - 38. http://remtk/solucor/miscprj/s_context.hc?s1=6&s2=2&s3=3&s4=0&full=0&prjstate=1&nodoc=0 - 39. http://remtk/solucor/miscprj/s_context.hc?s1=6&s2=2&s3=4&s4=0&full=0&prjstate=1&nodoc=0 - 40. http://remtk/solucor/miscprj/s_context.hc?s1=6&s2=2&s3=4&s4=1&full=0&prjstate=1&nodoc=0 - 41. http://remtk/solucor/miscprj/s_context.hc?s1=6&s2=2&s3=4&s4=2&full=0&prjstate=1&nodoc=0 - 42. http://remtk/solucor/miscprj/s_context.hc?s1=6&s2=2&s3=4&s4=3&full=0&prjstate=1&nodoc=0 - 43. http://remtk/solucor/miscprj/s_context.hc?s1=7&s2=0&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 44. http://remtk/solucor/miscprj/s_context.hc?s1=7&s2=1&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 45. http://remtk/solucor/miscprj/s_context.hc?s1=7&s2=2&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 46. http://remtk/solucor/miscprj/s_context.hc?s1=7&s2=3&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 47. http://remtk/solucor/miscprj/s_context.hc?s1=8&s2=0&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 48. http://remtk/solucor/miscprj/s_context.hc?s1=9&s2=0&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 49. http://remtk/solucor/miscprj/s_context.hc?s1=10&s2=0&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 50. ftp://ftp.solucorp.qc.ca/pub/vserver - 51. http://www.solucorp.qc.ca/virtualfs - 52. http://www.vmware.com/ - 53. ftp://ftp.solucorp.qc.ca/pub/vserver - 54. ftp://ftp.solucorp.qc.ca/pub/vserver/kernel-2.4.20ctx-17.tar.gz - 55. ftp://ftp.solucorp.qc.ca/pub/vserver/kernel-2.4.20ctxsmp-17.tar.gz - 56. ftp://ftp.solucorp.qc.ca/pub/vserver/vserver-0.22-1.src.rpm - 57. ftp://ftp.solucorp.qc.ca/pub/vserver/vserver-0.22-1.i386.rpm - 58. ftp://ftp.solucorp.qc.ca/pub/vserver/vserver-admin-0.22-1.i386.rpm - 59. http://www.solucorp.qc.ca/linuxconf/download.hc - 60. ftp://ftp.solucorp.qc.ca/pub/vserver/vserver-0.22.src.tar.gz - 61. ftp://ftp.solucorp.qc.ca/pub/vserver/patch-2.4.20ctx-17.gz - 62. ftp://ftp.solucorp.qc.ca/pub/vserver/patches - 63. mailto:jack@solucorp.qc.ca - 64. http://www.solucorp.qc.ca/howto.hc?projet=vserver - 65. mailto:vserver@solucorp.qc.ca - 66. http://www.solucorp.qc.ca/mlist/index.hc?list=vserver - 67. http://www.paul.sladen.org/vserver/archives/ - 68. http://www.solucorp.qc.ca/changes.hc?projet=vserver - 69. http://www.solucorp.qc.ca/miscprj/s_context.hc - 70. http://www.solucorp.qc.ca/tlmp - 71. http://remtk/solucor/miscprj/s_context.hc?s1=0&s2=0&s3=0&s4=0&full=0&prjstate=1&nodoc=0 - 72. http://remtk/solucor/miscprj/s_context.hc - 73. http://www.solucorp.qc.ca/tlmp/tlmpdoc.hc - 74. mailto:jack@solucorp.qc.ca diff --git a/util-vserver/ensc_wrappers/Makefile-files b/util-vserver/ensc_wrappers/Makefile-files deleted file mode 100644 index b92da7f..0000000 --- a/util-vserver/ensc_wrappers/Makefile-files +++ /dev/null @@ -1,33 +0,0 @@ -## $Id$ --*- makefile -*-- - -## 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. - -noinst_HEADERS += ensc_wrappers/wrappers-clone.hc \ - ensc_wrappers/wrappers-dirent.hc \ - ensc_wrappers/wrappers-fcntl.hc \ - ensc_wrappers/wrappers-io.hc \ - ensc_wrappers/wrappers-ioctl.hc \ - ensc_wrappers/wrappers-iosock.hc \ - ensc_wrappers/wrappers-mount.hc \ - ensc_wrappers/wrappers-pivot.hc \ - ensc_wrappers/wrappers-resource.hc \ - ensc_wrappers/wrappers-socket.hc \ - ensc_wrappers/wrappers-stdlib.hc \ - ensc_wrappers/wrappers-unistd.hc \ - ensc_wrappers/wrappers-vserver.hc \ - ensc_wrappers/wrappers-wait.hc \ - ensc_wrappers/wrappers.h \ - ensc_wrappers/wrappers_handler.hc diff --git a/util-vserver/ensc_wrappers/wrappers-clone.hc b/util-vserver/ensc_wrappers/wrappers-clone.hc deleted file mode 100644 index 943514f..0000000 --- a/util-vserver/ensc_wrappers/wrappers-clone.hc +++ /dev/null @@ -1,34 +0,0 @@ -// $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. - - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -inline static WRAPPER_DECL pid_t -Eclone(int (*fn)(void *), void *child_stack, int flags, void *arg) -{ - pid_t res; -#ifndef __dietlibc__ - res = clone(fn, child_stack, flags, arg); -#else - res = clone((void*(*)(void*))(fn), child_stack, flags, arg); -#endif - FatalErrnoError(res==-1, "clone()"); - return res; -} diff --git a/util-vserver/ensc_wrappers/wrappers-dirent.hc b/util-vserver/ensc_wrappers/wrappers-dirent.hc deleted file mode 100644 index d7fe433..0000000 --- a/util-vserver/ensc_wrappers/wrappers-dirent.hc +++ /dev/null @@ -1,57 +0,0 @@ -// $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. - - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -inline static WRAPPER_DECL DIR * -Eopendir(const char *name) -{ - DIR * res = opendir(name); - - FatalErrnoError(res==0, "opendir()"); - return res; -} - -inline static WRAPPER_DECL struct dirent * -Ereaddir(DIR *dir) -{ - struct dirent *res; - - errno = 0; - res = readdir(dir); - - FatalErrnoError(res==0 && errno!=0, "readdir()"); - return res; -} - -#ifndef __dietlibc__ -inline static WRAPPER_DECL void -Ereaddir_r(DIR *dir, struct dirent *entry, struct dirent **result) -{ - errno = 0; - FatalErrnoError(readdir_r(dir, entry, result)==0 && errno!=0, "readdir_r()"); -} -#endif - -inline static WRAPPER_DECL void -Eclosedir(DIR *dir) -{ - FatalErrnoError(closedir(dir)==-1, "closedir()"); -} diff --git a/util-vserver/ensc_wrappers/wrappers-fcntl.hc b/util-vserver/ensc_wrappers/wrappers-fcntl.hc deleted file mode 100644 index 698ac53..0000000 --- a/util-vserver/ensc_wrappers/wrappers-fcntl.hc +++ /dev/null @@ -1,64 +0,0 @@ -// $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. - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -inline static WRAPPER_DECL int -Eopen(char const *fname, int flags, mode_t mode) -{ - int res = open(fname, flags, mode); - FatalErrnoError(res==-1, "open()"); - - return res; -} - -inline static WRAPPER_DECL int -EopenD(char const *fname, int flags, mode_t mode) -{ - ENSC_DETAIL1(msg, "open", fname, 1); - - { - int res = open(fname, flags, mode); - FatalErrnoError(res==-1, msg); - return res; - } -} - - -inline static WRAPPER_DECL void -Emkdir(const char *pathname, mode_t mode) -{ - FatalErrnoError(mkdir(pathname,mode)==-1, "mkdir()"); -} - -inline static WRAPPER_DECL void -EmkdirD(const char *pathname, mode_t mode) -{ - ENSC_DETAIL1(msg, "mkdir", pathname, 1); - FatalErrnoError(mkdir(pathname,mode)==-1, msg); -} - -inline static WRAPPER_DECL int -Efcntl(int fd, int cmd, long arg) -{ - register int res = fcntl(fd, cmd, arg); - FatalErrnoError(res==-1, "fcntl()"); - - return res; -} diff --git a/util-vserver/ensc_wrappers/wrappers-io.hc b/util-vserver/ensc_wrappers/wrappers-io.hc deleted file mode 100644 index 3b212e6..0000000 --- a/util-vserver/ensc_wrappers/wrappers-io.hc +++ /dev/null @@ -1,98 +0,0 @@ -// $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. - - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -#include - -inline static UNUSED bool -WwriteAll(int fd, void const *ptr_v, size_t len, int *err) -{ - register char const *ptr = ptr_v; - - if (err) *err = 0; - - while (len>0) { - ssize_t res = TEMP_FAILURE_RETRY(write(fd, ptr, len)); - if (res<=0) { - if (err) *err = errno; - return false; - } - - ptr += res; - len -= res; - } - return true; -} - -inline static UNUSED void -EwriteAll(int fd, void const *ptr_v, size_t len) -{ - register char const *ptr = ptr_v; - - while (len>0) { - size_t res = TEMP_FAILURE_RETRY(write(fd, ptr, len)); - FatalErrnoError(res==(size_t)-1, "write()"); - - ptr += res; - len -= res; - } -} - - -inline static UNUSED bool -WreadAll(int fd, void *ptr_v, size_t len, int *err) -{ - register char *ptr = ptr_v; - - if (err) *err = 0; - - while (len>0) { - ssize_t res = TEMP_FAILURE_RETRY(read(fd, ptr, len)); - if (res==-1) { - if (err) *err = errno; - return false; - } - - if (res==0) return false; - - ptr += res; - len -= res; - } - return true; -} - -inline static UNUSED bool -EreadAll(int fd, void *ptr_v, size_t len) -{ - register char *ptr = ptr_v; - - while (len>0) { - size_t res = TEMP_FAILURE_RETRY(read(fd, ptr, len)); - FatalErrnoError(res==(size_t)-1, "read()"); - - if (res==0) return false; - - ptr += res; - len -= res; - } - - return true; -} diff --git a/util-vserver/ensc_wrappers/wrappers-ioctl.hc b/util-vserver/ensc_wrappers/wrappers-ioctl.hc deleted file mode 100644 index 7656bf1..0000000 --- a/util-vserver/ensc_wrappers/wrappers-ioctl.hc +++ /dev/null @@ -1,29 +0,0 @@ -// $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. - - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -inline static WRAPPER_DECL void -Eioctl(int fd, int request, void *p) -{ - int res = ioctl(fd, request, p); - FatalErrnoError(res<0, "ioctl()"); -} - diff --git a/util-vserver/ensc_wrappers/wrappers-iosock.hc b/util-vserver/ensc_wrappers/wrappers-iosock.hc deleted file mode 100644 index b527afb..0000000 --- a/util-vserver/ensc_wrappers/wrappers-iosock.hc +++ /dev/null @@ -1,98 +0,0 @@ -// $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. - - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -#include - -inline static WRAPPER_DECL bool -WsendAll(int fd, void const *ptr_v, size_t len, int *err) -{ - register char const *ptr = ptr_v; - if (err) *err = 0; - - while (len>0) { - size_t res = TEMP_FAILURE_RETRY(send(fd, ptr, len, MSG_NOSIGNAL)); - if (res==(size_t)-1) { - if (err) *err = errno; - return false; - } - - if (res==0) return false; - - ptr += res; - len -= res; - } - return true; -} - -inline static WRAPPER_DECL void -EsendAll(int fd, void const *ptr_v, size_t len) -{ - register char const *ptr = ptr_v; - - while (len>0) { - size_t res = TEMP_FAILURE_RETRY(send(fd, ptr, len, MSG_NOSIGNAL)); - FatalErrnoError(res==(size_t)-1, "send()"); - - ptr += res; - len -= res; - } -} - - -inline static WRAPPER_DECL bool -WrecvAll(int fd, void *ptr_v, size_t len, int *err) -{ - register char *ptr = ptr_v; - if (err) *err = 0; - - while (len>0) { - size_t res = TEMP_FAILURE_RETRY(recv(fd, ptr, len, MSG_NOSIGNAL)); - if (res==(size_t)-1) { - if (err) *err = errno; - return false; - } - - if (res==0) return false; - - ptr += res; - len -= res; - } - return true; -} - -inline static WRAPPER_DECL bool -ErecvAll(int fd, void *ptr_v, size_t len) -{ - register char *ptr = ptr_v; - - while (len>0) { - size_t res = TEMP_FAILURE_RETRY(recv(fd, ptr, len, MSG_NOSIGNAL)); - FatalErrnoError(res==(size_t)-1, "recv()"); - - if (res==0) return false; - - ptr += res; - len -= res; - } - - return true; -} diff --git a/util-vserver/ensc_wrappers/wrappers-mount.hc b/util-vserver/ensc_wrappers/wrappers-mount.hc deleted file mode 100644 index d4f3c54..0000000 --- a/util-vserver/ensc_wrappers/wrappers-mount.hc +++ /dev/null @@ -1,35 +0,0 @@ -// $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. - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -inline static WRAPPER_DECL void -Eumount2(char const *path, int flag) -{ - FatalErrnoError(umount2(path,flag)==-1, "umount2()"); -} - -inline static WRAPPER_DECL void -Emount(const char *source, const char *target, - const char *filesystemtype, unsigned long mountflags, - const void *data) -{ - FatalErrnoError(mount(source, target, filesystemtype, - mountflags, data)==-1, "mount()"); -} diff --git a/util-vserver/ensc_wrappers/wrappers-pivot.hc b/util-vserver/ensc_wrappers/wrappers-pivot.hc deleted file mode 100644 index dc4cd90..0000000 --- a/util-vserver/ensc_wrappers/wrappers-pivot.hc +++ /dev/null @@ -1,27 +0,0 @@ -// $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. - - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -inline static WRAPPER_DECL void -Epivot_root(const char *new_root, const char *put_old) -{ - FatalErrnoError(pivot_root(new_root, put_old)==-1, "pivot_root()"); -} diff --git a/util-vserver/ensc_wrappers/wrappers-resource.hc b/util-vserver/ensc_wrappers/wrappers-resource.hc deleted file mode 100644 index b7a4b57..0000000 --- a/util-vserver/ensc_wrappers/wrappers-resource.hc +++ /dev/null @@ -1,32 +0,0 @@ -// $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. - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -inline static WRAPPER_DECL void -Egetrlimit(int resource, struct rlimit *rlim) -{ - FatalErrnoError(getrlimit(resource, rlim)==-1, "getrlimit()"); -} - -inline static WRAPPER_DECL void -Esetrlimit(int resource, struct rlimit const *rlim) -{ - FatalErrnoError(setrlimit(resource, rlim)==-1, "setrlimit()"); -} diff --git a/util-vserver/ensc_wrappers/wrappers-socket.hc b/util-vserver/ensc_wrappers/wrappers-socket.hc deleted file mode 100644 index 8f3d027..0000000 --- a/util-vserver/ensc_wrappers/wrappers-socket.hc +++ /dev/null @@ -1,78 +0,0 @@ -// $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. - - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers-socket.hc can not be used in this way -#endif - -inline static WRAPPER_DECL int -Esocket(int domain, int type, int protocol) -{ - register int res = socket(domain, type, protocol); - FatalErrnoError(res==-1, "socket()"); - return res; -} - -inline static WRAPPER_DECL void -Econnect(int sockfd, void const *serv_addr, socklen_t addrlen) -{ - FatalErrnoError(connect(sockfd, serv_addr, addrlen)==-1, "connect()"); -} - -inline static WRAPPER_DECL void -Ebind(int sockfd, void *my_addr, socklen_t addrlen) -{ - FatalErrnoError(bind(sockfd, my_addr, addrlen)==-1, "bind()"); -} - -inline static WRAPPER_DECL int -Eaccept(int s, void *addr, socklen_t *addrlen) -{ - register int res = accept(s,addr,addrlen); - FatalErrnoError(res==-1, "accept()"); - return res; -} - -inline static WRAPPER_DECL void -Elisten(int sock, int backlog) -{ - FatalErrnoError(listen(sock, backlog)==-1, "bind()"); -} - -inline static WRAPPER_DECL void -Eshutdown(int s, int how) -{ - FatalErrnoError(shutdown(s,how)==-1, "shutdown()"); -} - -inline static WRAPPER_DECL ssize_t -Erecv(int s, void *buf, size_t len, int flags) -{ - register ssize_t res = recv(s,buf,len,flags); - FatalErrnoError(res==-1, "recv()"); - return res; -} - -inline static WRAPPER_DECL int -Eselect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - struct timeval *timeout) -{ - register int res = select(n, readfds,writefds,exceptfds, timeout); - FatalErrnoError(res==-1, "select()"); - return res; -} diff --git a/util-vserver/ensc_wrappers/wrappers-stdlib.hc b/util-vserver/ensc_wrappers/wrappers-stdlib.hc deleted file mode 100644 index 4e0abb7..0000000 --- a/util-vserver/ensc_wrappers/wrappers-stdlib.hc +++ /dev/null @@ -1,41 +0,0 @@ -// $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. - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -inline static WRAPPER_DECL void * -Emalloc(size_t size) -{ - register void *res = malloc(size); - FatalErrnoError(res==0 && size!=0, "malloc()"); - return res; -} - -/*@unused@*/ -inline static WRAPPER_DECL /*@null@*//*@only@*/ void * -Erealloc(/*@only@*//*@out@*//*@null@*/ void *ptr, - size_t new_size) - /*@ensures maxSet(result) == new_size@*/ - /*@modifies *ptr@*/ -{ - register void *res = realloc(ptr, new_size); - FatalErrnoError(res==0 && new_size!=0, "realloc()"); - - return res; -} diff --git a/util-vserver/ensc_wrappers/wrappers-unistd.hc b/util-vserver/ensc_wrappers/wrappers-unistd.hc deleted file mode 100644 index 908fee9..0000000 --- a/util-vserver/ensc_wrappers/wrappers-unistd.hc +++ /dev/null @@ -1,196 +0,0 @@ -// $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. - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -inline static WRAPPER_DECL void -Eclose(int s) -{ - FatalErrnoError(close(s)==-1, "close()"); -} - -inline static WRAPPER_DECL void -Echdir(char const path[]) -{ - FatalErrnoError(chdir(path)==-1, "chdir()"); -} - -inline static WRAPPER_DECL void -Efchdir(int fd) -{ - FatalErrnoError(fchdir(fd)==-1, "fchdir()"); -} - -inline static WRAPPER_DECL void -Echroot(char const path[]) -{ - FatalErrnoError(chroot(path)==-1, "chroot()"); -} - -inline static WRAPPER_DECL NORETURN void -Eexecv(char const *path, char *argv[]) -{ - execv(path,argv); - FatalErrnoErrorFail("execv()"); -} - -inline static WRAPPER_DECL NORETURN void -Eexecvp(char const *path, char *argv[]) -{ - execvp(path,argv); - FatalErrnoErrorFail("execvp()"); -} - -inline static WRAPPER_DECL NORETURN void -EexecvpD(char const *path, char *argv[]) -{ - execvp(path,argv); - { - ENSC_DETAIL1(msg, "execvp", path, 1); - FatalErrnoErrorFail(msg); - } -} - -inline static WRAPPER_DECL void -Epipe(int filedes[2]) -{ - FatalErrnoError(pipe(filedes)==-1, "pipe()"); -} - -inline static WRAPPER_DECL pid_t -Efork() -{ - pid_t res; - res = fork(); - FatalErrnoError(res==-1, "fork()"); - return res; -} - -inline static WRAPPER_DECL size_t -Eread(int fd, void *ptr, size_t len) -{ - size_t res = read(fd, ptr, len); - FatalErrnoError((ssize_t)(res)==-1, "read()"); - - return res; -} - -inline static WRAPPER_DECL size_t -Ewrite(int fd, void const *ptr, size_t len) -{ - size_t res = write(fd, ptr, len); - FatalErrnoError((ssize_t)(res)==-1, "write()"); - - return res; -} - -inline static WRAPPER_DECL void -Ereadlink(const char *path, char *buf, size_t bufsiz) -{ - FatalErrnoError(readlink(path, buf, bufsiz)==-1, "readlink()"); -} - -inline static WRAPPER_DECL void -EreadlinkD(const char *path, char *buf, size_t bufsiz) -{ - ENSC_DETAIL1(msg, "readlink", path, 1); - FatalErrnoError(readlink(path, buf, bufsiz)==-1, msg); -} - -inline static WRAPPER_DECL void -Esymlink(const char *oldpath, const char *newpath) -{ - FatalErrnoError(symlink(oldpath, newpath)==-1, "symlink()"); -} - -inline static WRAPPER_DECL void -EsymlinkD(const char *oldpath, const char *newpath) -{ - ENSC_DETAIL2(msg, "symlink", oldpath, newpath, 1, 1); - FatalErrnoError(symlink(oldpath, newpath)==-1, msg); -} - -inline static WRAPPER_DECL void -Eunlink(char const *pathname) -{ - FatalErrnoError(unlink(pathname)==-1, "unlink()"); -} - -inline static void -Esetuid(uid_t uid) -{ - FatalErrnoError(setuid(uid)==-1, "setuid()"); -} - -inline static void -Esetgid(gid_t gid) -{ - FatalErrnoError(setgid(gid)==-1, "setgid()"); -} - -#if defined(_GRP_H) && (defined(__USE_BSD) || defined(__dietlibc__)) -inline static void -Esetgroups(size_t size, const gid_t *list) -{ - FatalErrnoError(setgroups(size, list)==-1, "setgroups()"); -} -#endif - -inline static WRAPPER_DECL int -Edup2(int oldfd, int newfd) -{ - register int res = dup2(oldfd, newfd); - FatalErrnoError(res==-1, "dup2()"); - - return res; -} - -inline static WRAPPER_DECL int -Edup(int fd) -{ - register int res = dup(fd); - FatalErrnoError(res==-1, "dup()"); - - return res; -} - -inline static WRAPPER_DECL pid_t -Esetsid() -{ - register pid_t const res = setsid(); - FatalErrnoError(res==-1, "setsid()"); - - return res; -} - -inline static WRAPPER_DECL int -Emkstemp(char *template) -{ - int res = mkstemp(template); - FatalErrnoError(res==-1, "mkstemp()"); - return res; -} - -inline static WRAPPER_DECL off_t -Elseek(int fildes, off_t offset, int whence) -{ - off_t res = lseek(fildes, offset, whence); - FatalErrnoError(res==(off_t)-1, "lseek()"); - return res; -} diff --git a/util-vserver/ensc_wrappers/wrappers-vserver.hc b/util-vserver/ensc_wrappers/wrappers-vserver.hc deleted file mode 100644 index 189c61c..0000000 --- a/util-vserver/ensc_wrappers/wrappers-vserver.hc +++ /dev/null @@ -1,108 +0,0 @@ -// $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. - - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -inline static WRAPPER_DECL xid_t -Evc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags) -{ - register xid_t res = vc_new_s_context(ctx,remove_cap,flags); - FatalErrnoError(res==VC_NOCTX, "vc_new_s_context()"); - return res; -} - -inline static WRAPPER_DECL xid_t -Evc_get_task_xid(pid_t pid) -{ - register xid_t res = vc_get_task_xid(pid); - FatalErrnoError(res==VC_NOCTX, "vc_get_task_xid()"); - return res; -} - -inline static WRAPPER_DECL xid_t -Evc_ctx_create(xid_t xid) -{ - register xid_t res = vc_ctx_create(xid); - FatalErrnoError(res==VC_NOCTX, "vc_ctx_create()"); - return res; -} - -inline static WRAPPER_DECL void -Evc_ctx_migrate(xid_t xid) -{ - FatalErrnoError(vc_ctx_migrate(xid)==-1, "vc_ctx_migrate()"); -} - -inline static WRAPPER_DECL void -Evc_get_cflags(xid_t xid, struct vc_ctx_flags *flags) -{ - FatalErrnoError(vc_get_cflags(xid, flags)==-1, "vc_get_cflags()"); -} - -inline static WRAPPER_DECL void -Evc_set_cflags(xid_t xid, struct vc_ctx_flags const *flags) -{ - FatalErrnoError(vc_set_cflags(xid, flags)==-1, "vc_set_cflags()"); -} - -inline static WRAPPER_DECL void -Evc_set_vhi_name(xid_t xid, vc_uts_type type, - char const *val, size_t len) -{ - FatalErrnoError(vc_set_vhi_name(xid,type,val,len)==-1, "vc_set_vhi_name()"); -} - -inline static WRAPPER_DECL void -Evc_get_ccaps(xid_t xid, struct vc_ctx_caps *caps) -{ - FatalErrnoError(vc_get_ccaps(xid, caps)==-1, "vc_get_ccaps()"); -} - -inline static WRAPPER_DECL void -Evc_set_ccaps(xid_t xid, struct vc_ctx_caps const *caps) -{ - FatalErrnoError(vc_set_ccaps(xid, caps)==-1, "vc_set_ccaps()"); -} - -inline static WRAPPER_DECL xid_t -Evc_xidopt2xid(char const *id, bool honor_static) -{ - char const * err; - xid_t rc = vc_xidopt2xid(id, honor_static, &err); - if (__builtin_expect(rc==VC_NOCTX,0)) { - ENSC_DETAIL1(msg, "vc_xidopt2xid", id, 1); -#if 1 - FatalErrnoErrorFail(msg); -#else - { - size_t l1 = strlen(msg); - size_t l2 = strlen(err); - char buf[l1 + l2 + sizeof(": ")]; - memcpy(buf, msg, l1); - memcpy(buf+l1, ": ", 2); - memcpy(buf+l1+2, err, l2+1); - - FatalErrnoErrorFail(buf); - } -#endif - } - - return rc; -} diff --git a/util-vserver/ensc_wrappers/wrappers-wait.hc b/util-vserver/ensc_wrappers/wrappers-wait.hc deleted file mode 100644 index 4391a24..0000000 --- a/util-vserver/ensc_wrappers/wrappers-wait.hc +++ /dev/null @@ -1,31 +0,0 @@ -// $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. - - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -inline static WRAPPER_DECL pid_t -Ewait4(pid_t pid, int *status, int options, - struct rusage *rusage) -{ - pid_t res; - res = wait4(pid, status, options, rusage); - FatalErrnoError(res==-1, "wait4()"); - return res; -} diff --git a/util-vserver/ensc_wrappers/wrappers.h b/util-vserver/ensc_wrappers/wrappers.h deleted file mode 100644 index fbfafbd..0000000 --- a/util-vserver/ensc_wrappers/wrappers.h +++ /dev/null @@ -1,112 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003,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. - - -#ifndef H_UTIL_VSERVER_SRC_WRAPPERS_H -#define H_UTIL_VSERVER_SRC_WRAPPERS_H - -#define WRAPPER_DECL UNUSED ALWAYSINLINE -#define H_ENSC_IN_WRAPPERS_H 1 - -#include "wrappers_handler.hc" - -#define ENSC_DOQUOTE_COND(PTR, VAL, LEN, DO_QUOTE) \ - if (DO_QUOTE) *PTR++ = '"'; \ - memcpy(PTR, VAL, LEN); PTR += LEN; \ - if (DO_QUOTE) *PTR++ = '"' \ - -#define ENSC_DETAIL1(RES,FUNC,VAL,DO_QUOTE) \ - size_t l_ = strlen(VAL); \ - char RES[l_ + sizeof(FUNC "(\"\")")]; \ - char * ptr_ = RES; \ - memcpy(ptr_, FUNC "(", sizeof(FUNC)); ptr_ += sizeof(FUNC); \ - ENSC_DOQUOTE_COND(ptr_, VAL, l_, DO_QUOTE); \ - *ptr_++ = ')'; \ - *ptr_ = '\0'; - -#define ENSC_DETAIL2(RES,FUNC, VAL0,VAL1, DO_QUOTE0,DO_QUOTE1) \ - size_t l0_ = strlen(VAL0); \ - size_t l1_ = strlen(VAL1); \ - char RES[l0_ + l1_ + sizeof(FUNC "('','')")]; \ - char * ptr_ = RES; \ - memcpy(ptr_, FUNC "(", sizeof(FUNC)); ptr_ += sizeof(FUNC); \ - ENSC_DOQUOTE_COND(ptr_, VAL0, l0_, DO_QUOTE0); \ - *ptr_++ = ','; \ - ENSC_DOQUOTE_COND(ptr_, VAL1, l1_, DO_QUOTE1); \ - *ptr_++ = ')'; \ - *ptr_ = '\0'; - - -#ifdef ENSC_WRAPPERS_UNISTD -# include "wrappers-unistd.hc" -#endif - -#ifdef ENSC_WRAPPERS_FCNTL -# include "wrappers-fcntl.hc" -#endif - -#ifdef ENSC_WRAPPERS_MOUNT -# include "wrappers-mount.hc" -#endif - -#ifdef ENSC_WRAPPERS_RESOURCE -# include "wrappers-resource.hc" -#endif - -#ifdef ENSC_WRAPPERS_IOCTL -# include "wrappers-ioctl.hc" -#endif - -#ifdef ENSC_WRAPPERS_WAIT -# include "wrappers-wait.hc" -#endif - -#ifdef ENSC_WRAPPERS_VSERVER -# include "wrappers-vserver.hc" -#endif - -#ifdef ENSC_WRAPPERS_IO -# include "wrappers-io.hc" -#endif - -#ifdef ENSC_WRAPPERS_IOSOCK -# include "wrappers-iosock.hc" -#endif - -#ifdef ENSC_WRAPPERS_DIRENT -# include "wrappers-dirent.hc" -#endif - -#ifdef ENSC_WRAPPERS_CLONE -# include "wrappers-clone.hc" -#endif - -#ifdef ENSC_WRAPPERS_STDLIB -# include "wrappers-stdlib.hc" -#endif - -#ifdef ENSC_WRAPPERS_SOCKET -# include "wrappers-socket.hc" -#endif - -#undef ENSC_DETAIL2 -#undef ENSC_DETAIL1 -#undef ENSC_DOQUOTE_COND -#undef H_ENSC_IN_WRAPPERS_H -#undef WRAPPER_DECL - -#endif // H_UTIL_VSERVER_SRC_WRAPPERS_H diff --git a/util-vserver/ensc_wrappers/wrappers_handler.hc b/util-vserver/ensc_wrappers/wrappers_handler.hc deleted file mode 100644 index b89baf7..0000000 --- a/util-vserver/ensc_wrappers/wrappers_handler.hc +++ /dev/null @@ -1,49 +0,0 @@ -// $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. - - -#ifndef H_ENSC_IN_WRAPPERS_H -# error wrappers_handler.hc can not be used in this way -#endif - -#include -#include -#include - -static inline ALWAYSINLINE NORETURN void -FatalErrnoErrorFail(char const msg[]) -{ - extern int wrapper_exit_code; - -#ifdef ENSC_WRAPPERS_PREFIX - { - int old_errno = errno; - WRITE_MSG(2, ENSC_WRAPPERS_PREFIX); - errno = old_errno; - } -#endif - perror(msg); - - exit(wrapper_exit_code); -} - -static UNUSED void -FatalErrnoError(bool condition, char const msg[]) /*@*/ -{ - if (__builtin_expect(!condition,true)) return; - FatalErrnoErrorFail(msg); -} diff --git a/util-vserver/kernel/context.h b/util-vserver/kernel/context.h deleted file mode 100644 index a51a035..0000000 --- a/util-vserver/kernel/context.h +++ /dev/null @@ -1,174 +0,0 @@ -#ifndef _VX_CONTEXT_H -#define _VX_CONTEXT_H - -#include - -#define MAX_S_CONTEXT 65535 /* Arbitrary limit */ -#define MIN_D_CONTEXT 49152 /* dynamic contexts start here */ - -#define VX_DYNAMIC_ID ((uint32_t)-1) /* id for dynamic context */ - -#ifdef __KERNEL__ - -#include -#include - -#define _VX_INFO_DEF_ -#include "cvirt.h" -#include "limit.h" -#include "sched.h" -#undef _VX_INFO_DEF_ - -struct vx_info { - struct list_head vx_list; /* linked list of contexts */ - xid_t vx_id; /* context id */ - atomic_t vx_refcount; /* refcount */ - struct vx_info *vx_parent; /* parent context */ - - struct namespace *vx_namespace; /* private namespace */ - struct fs_struct *vx_fs; /* private namespace fs */ - uint64_t vx_flags; /* VX_INFO_xxx */ - uint64_t vx_bcaps; /* bounding caps (system) */ - uint64_t vx_ccaps; /* context caps (vserver) */ - - pid_t vx_initpid; /* PID of fake init process */ - - struct _vx_cvirt cvirt; /* virtual/bias stuff */ - struct _vx_limit limit; /* vserver limits */ - struct _vx_sched sched; /* vserver scheduler */ - - char vx_name[65]; /* vserver name */ -}; - - -extern spinlock_t vxlist_lock; -extern struct list_head vx_infos; - - -#define VX_ADMIN 0x0001 -#define VX_WATCH 0x0002 -#define VX_DUMMY 0x0008 - -#define VX_IDENT 0x0010 -#define VX_EQUIV 0x0020 -#define VX_PARENT 0x0040 -#define VX_CHILD 0x0080 - -#define VX_ARG_MASK 0x00F0 - -#define VX_DYNAMIC 0x0100 -#define VX_STATIC 0x0200 - -#define VX_ATR_MASK 0x0F00 - - -void free_vx_info(struct vx_info *); - -extern struct vx_info *find_vx_info(int); -extern struct vx_info *find_or_create_vx_info(int); -extern int vx_info_id_valid(int); - -extern int vx_migrate_task(struct task_struct *, struct vx_info *); - -#endif /* __KERNEL__ */ - -#include "switch.h" - -/* vinfo commands */ - -#define VCMD_task_xid VC_CMD(VINFO, 1, 0) -#define VCMD_task_nid VC_CMD(VINFO, 2, 0) - -#ifdef __KERNEL__ -extern int vc_task_xid(uint32_t, void __user *); - -#endif /* __KERNEL__ */ - -#define VCMD_vx_info VC_CMD(VINFO, 5, 0) -#define VCMD_nx_info VC_CMD(VINFO, 6, 0) - -struct vcmd_vx_info_v0 { - uint32_t xid; - uint32_t initpid; - /* more to come */ -}; - -#ifdef __KERNEL__ -extern int vc_vx_info(uint32_t, void __user *); - -#endif /* __KERNEL__ */ - -#define VCMD_ctx_create VC_CMD(VPROC, 1, 0) -#define VCMD_ctx_migrate VC_CMD(PROCMIG, 1, 0) - -#ifdef __KERNEL__ -extern int vc_ctx_create(uint32_t, void __user *); -extern int vc_ctx_migrate(uint32_t, void __user *); - -#endif /* __KERNEL__ */ - -#define VCMD_get_cflags VC_CMD(FLAGS, 1, 0) -#define VCMD_set_cflags VC_CMD(FLAGS, 2, 0) - -struct vcmd_ctx_flags_v0 { - uint64_t flagword; - uint64_t mask; -}; - -#ifdef __KERNEL__ -extern int vc_get_cflags(uint32_t, void __user *); -extern int vc_set_cflags(uint32_t, void __user *); - -#endif /* __KERNEL__ */ - -#define VXF_INFO_LOCK 0x00000001 -#define VXF_INFO_SCHED 0x00000002 -#define VXF_INFO_NPROC 0x00000004 -#define VXF_INFO_PRIVATE 0x00000008 - -#define VXF_INFO_INIT 0x00000010 -#define VXF_INFO_HIDE 0x00000020 -#define VXF_INFO_ULIMIT 0x00000040 -#define VXF_INFO_NSPACE 0x00000080 - -#define VXF_SCHED_HARD 0x00000100 -#define VXF_SCHED_PRIO 0x00000200 -#define VXF_SCHED_PAUSE 0x00000400 - -#define VXF_VIRT_MEM 0x00010000 -#define VXF_VIRT_UPTIME 0x00020000 -#define VXF_VIRT_CPU 0x00040000 - -#define VXF_HIDE_MOUNT 0x01000000 -#define VXF_HIDE_NETIF 0x02000000 - -#define VXF_STATE_SETUP (1ULL<<32) -#define VXF_STATE_INIT (1ULL<<33) - - -#define VXF_ONE_TIME (0x0003ULL<<32) - -#define VCMD_get_ccaps VC_CMD(FLAGS, 3, 0) -#define VCMD_set_ccaps VC_CMD(FLAGS, 4, 0) - -struct vcmd_ctx_caps_v0 { - uint64_t bcaps; - uint64_t ccaps; - uint64_t cmask; -}; - -#ifdef __KERNEL__ -extern int vc_get_ccaps(uint32_t, void __user *); -extern int vc_set_ccaps(uint32_t, void __user *); - -#endif /* __KERNEL__ */ - -#define VXC_SET_UTSNAME 0x00000001 -#define VXC_SET_RLIMIT 0x00000002 - -#define VXC_ICMP_PING 0x00000100 - -#define VXC_SECURE_MOUNT 0x00010000 - - -#endif /* _VX_CONTEXT_H */ diff --git a/util-vserver/kernel/cvirt.h b/util-vserver/kernel/cvirt.h deleted file mode 100644 index a8a242e..0000000 --- a/util-vserver/kernel/cvirt.h +++ /dev/null @@ -1,109 +0,0 @@ -#if defined(__KERNEL__) && defined(_VX_INFO_DEF_) - -#include -#include -#include -#include -#include - -/* context sub struct */ - -struct sock_acc { - atomic_t count; - atomic_t total; -}; - -struct _vx_cvirt { - int nr_threads; - int nr_running; - int max_threads; - unsigned long total_forks; - - unsigned int bias_cswtch; - struct timespec bias_idle; - struct timespec bias_tp; - uint64_t bias_jiffies; - - struct new_utsname utsname; - - struct sock_acc sock[5][3]; -}; - - -static inline long vx_sock_count(struct _vx_cvirt *cvirt, int type, int pos) -{ - return atomic_read(&cvirt->sock[type][pos].count); -} - - -static inline long vx_sock_total(struct _vx_cvirt *cvirt, int type, int pos) -{ - return atomic_read(&cvirt->sock[type][pos].total); -} - - -extern uint64_t vx_idle_jiffies(void); - -static inline void vx_info_init_cvirt(struct _vx_cvirt *cvirt) -{ - int i,j; - uint64_t idle_jiffies = vx_idle_jiffies(); - - cvirt->nr_threads = 1; - // new->virt.bias_cswtch = kstat.context_swtch; - cvirt->bias_jiffies = get_jiffies_64(); - - jiffies_to_timespec(idle_jiffies, &cvirt->bias_idle); - do_posix_clock_monotonic_gettime(&cvirt->bias_tp); - - down_read(&uts_sem); - cvirt->utsname = system_utsname; - up_read(&uts_sem); - - for (i=0; i<5; i++) { - for (j=0; j<3; j++) { - atomic_set(&cvirt->sock[i][j].count, 0); - atomic_set(&cvirt->sock[i][j].total, 0); - } - } -} - -static inline int vx_info_proc_cvirt(struct _vx_cvirt *cvirt, char *buffer) -{ - int i,j, length = 0; - static char *type[] = { "UNSPEC", "UNIX", "INET", "INET6", "OTHER" }; - - for (i=0; i<5; i++) { - length += sprintf(buffer + length, - "%s:", type[i]); - for (j=0; j<3; j++) { - length += sprintf(buffer + length, - "\t%12lu/%-12lu" - ,vx_sock_count(cvirt, i, j) - ,vx_sock_total(cvirt, i, j) - ); - } - buffer[length++] = '\n'; - } - return length; -} - -#else /* _VX_INFO_DEF_ */ -#ifndef _VX_CVIRT_H -#define _VX_CVIRT_H - -#include "switch.h" - -/* cvirt vserver commands */ - - -#ifdef __KERNEL__ - -struct timespec; - -void vx_vsi_uptime(struct timespec *uptime, struct timespec *idle); - -#endif /* __KERNEL__ */ - -#endif /* _VX_CVIRT_H */ -#endif diff --git a/util-vserver/kernel/inode.h b/util-vserver/kernel/inode.h deleted file mode 100644 index aa8852f..0000000 --- a/util-vserver/kernel/inode.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef _VX_INODE_H -#define _VX_INODE_H - -#include "switch.h" - -/* inode vserver commands */ - -#define VCMD_get_iattr_v0 VC_CMD(INODE, 1, 0) -#define VCMD_set_iattr_v0 VC_CMD(INODE, 2, 0) - -#define VCMD_get_iattr VC_CMD(INODE, 1, 1) -#define VCMD_set_iattr VC_CMD(INODE, 2, 1) - -struct vcmd_ctx_iattr_v0 { - /* device handle in id */ - uint64_t ino; - uint32_t xid; - uint32_t flags; - uint32_t mask; -}; - -struct vcmd_ctx_iattr_v1 { - const char __user *name; - uint32_t xid; - uint32_t flags; - uint32_t mask; -}; - - -#define IATTR_XID 0x01000000 - -#define IATTR_ADMIN 0x00000001 -#define IATTR_WATCH 0x00000002 -#define IATTR_HIDE 0x00000004 -#define IATTR_FLAGS 0x00000007 - -#define IATTR_BARRIER 0x00010000 -#define IATTR_IUNLINK 0x00020000 -#define IATTR_IMMUTABLE 0x00040000 - - -#ifdef CONFIG_PROC_SECURE -#define IATTR_PROC_DEFAULT ( IATTR_ADMIN | IATTR_HIDE ) -#define IATTR_PROC_SYMLINK ( IATTR_ADMIN ) -#else -#define IATTR_PROC_DEFAULT ( IATTR_ADMIN ) -#define IATTR_PROC_SYMLINK ( IATTR_ADMIN ) -#endif - -#ifdef __KERNEL__ - -#define vx_hide_check(c,m) (((m) & IATTR_HIDE) ? vx_check(c,m) : 1) - -extern int vc_get_iattr_v0(uint32_t, void __user *); -extern int vc_set_iattr_v0(uint32_t, void __user *); - -extern int vc_get_iattr(uint32_t, void __user *); -extern int vc_set_iattr(uint32_t, void __user *); - -#endif /* __KERNEL__ */ - -/* inode ioctls */ - -#define FIOC_GETXFLG _IOR('x', 5, long) -#define FIOC_SETXFLG _IOW('x', 6, long) - -#endif /* _VX_INODE_H */ diff --git a/util-vserver/kernel/legacy.h b/util-vserver/kernel/legacy.h deleted file mode 100644 index 1372c0f..0000000 --- a/util-vserver/kernel/legacy.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _VX_LEGACY_H -#define _VX_LEGACY_H - -#include "switch.h" -#include "network.h" - -/* compatibiliy vserver commands */ - -#define VCMD_new_s_context VC_CMD(COMPAT, 1, 1) -#define VCMD_set_ipv4root VC_CMD(COMPAT, 2, 3) - -#define VCMD_create_context VC_CMD(VSETUP, 1, 0) - -/* compatibiliy vserver arguments */ - -struct vcmd_new_s_context_v1 { - uint32_t remove_cap; - uint32_t flags; -}; - -struct vcmd_set_ipv4root_v3 { - /* number of pairs in id */ - uint32_t broadcast; - struct { - uint32_t ip; - uint32_t mask; - } nx_mask_pair[NB_IPV4ROOT]; -}; - - -#define VX_INFO_LOCK 1 /* Can't request a new vx_id */ -#define VX_INFO_NPROC 4 /* Limit number of processes in a context */ -#define VX_INFO_PRIVATE 8 /* Noone can join this security context */ -#define VX_INFO_INIT 16 /* This process wants to become the */ - /* logical process 1 of the security */ - /* context */ -#define VX_INFO_HIDEINFO 32 /* Hide some information in /proc */ -#define VX_INFO_ULIMIT 64 /* Use ulimit of the current process */ - /* to become the global limits */ - /* of the context */ -#define VX_INFO_NAMESPACE 128 /* save private namespace */ - - -#define NB_S_CONTEXT 16 - -#define NB_IPV4ROOT 16 - - -#ifdef __KERNEL__ -extern int vc_new_s_context(uint32_t, void __user *); -extern int vc_set_ipv4root(uint32_t, void __user *); - -#endif /* __KERNEL__ */ -#endif /* _VX_LEGACY_H */ diff --git a/util-vserver/kernel/limit.h b/util-vserver/kernel/limit.h deleted file mode 100644 index 74e02cd..0000000 --- a/util-vserver/kernel/limit.h +++ /dev/null @@ -1,97 +0,0 @@ -#if defined(__KERNEL__) && defined(_VX_INFO_DEF_) - -#include -#include - -/* context sub struct */ - -#define NUM_RLIMITS 16 - -#define VLIMIT_SOCK 16 - - -struct _vx_limit { - atomic_t ticks; - - unsigned long rlim[NUM_RLIMITS]; /* Per context limit */ - atomic_t res[NUM_RLIMITS]; /* Current value */ -}; - -static inline void vx_info_init_limit(struct _vx_limit *limit) -{ - int lim; - - for (lim=0; limrlim[lim] = RLIM_INFINITY; - atomic_set(&limit->res[lim], 0); - } -} - -static inline int vx_info_proc_limit(struct _vx_limit *limit, char *buffer) -{ - return sprintf(buffer, - "PROC:\t%8d/%ld\n" - "VM:\t%8d/%ld\n" - "VML:\t%8d/%ld\n" - "RSS:\t%8d/%ld\n" - "FILES:\t%8d/%ld\n" - ,atomic_read(&limit->res[RLIMIT_NPROC]) - ,limit->rlim[RLIMIT_NPROC] - ,atomic_read(&limit->res[RLIMIT_AS]) - ,limit->rlim[RLIMIT_AS] - ,atomic_read(&limit->res[RLIMIT_MEMLOCK]) - ,limit->rlim[RLIMIT_MEMLOCK] - ,atomic_read(&limit->res[RLIMIT_RSS]) - ,limit->rlim[RLIMIT_RSS] - ,atomic_read(&limit->res[RLIMIT_NOFILE]) - ,limit->rlim[RLIMIT_NOFILE] - ); -} - -#else /* _VX_INFO_DEF_ */ -#ifndef _VX_LIMIT_H -#define _VX_LIMIT_H - -#include "switch.h" - -/* 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) - -struct vcmd_ctx_rlimit_v0 { - uint32_t id; - uint64_t minimum; - uint64_t softlimit; - uint64_t maximum; -}; - -struct vcmd_ctx_rlimit_mask_v0 { - uint32_t minimum; - uint32_t softlimit; - uint32_t maximum; -}; - -#define CRLIM_UNSET (0ULL) -#define CRLIM_INFINITY (~0ULL) -#define CRLIM_KEEP (~1ULL) - -#ifdef __KERNEL__ - -#include - -extern int vc_get_rlimit(uint32_t, void __user *); -extern int vc_set_rlimit(uint32_t, void __user *); -extern int vc_get_rlimit_mask(uint32_t, void __user *); - -struct sysinfo; - -void vx_vsi_meminfo(struct sysinfo *); -void vx_vsi_swapinfo(struct sysinfo *); - - -#endif /* __KERNEL__ */ - -#endif /* _VX_LIMIT_H */ -#endif diff --git a/util-vserver/kernel/namespace.h b/util-vserver/kernel/namespace.h deleted file mode 100644 index 140fc79..0000000 --- a/util-vserver/kernel/namespace.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef _VX_NAMESPACE_H -#define _VX_NAMESPACE_H - -#include - - -/* virtual host info names */ - -#define VCMD_vx_set_vhi_name VC_CMD(VHOST, 1, 0) -#define VCMD_vx_get_vhi_name VC_CMD(VHOST, 2, 0) - -struct vcmd_vx_vhi_name_v0 { - uint32_t field; - char name[65]; -}; - - -enum vx_vhi_name_field { - VHIN_CONTEXT=0, - VHIN_SYSNAME, - VHIN_NODENAME, - VHIN_RELEASE, - VHIN_VERSION, - VHIN_MACHINE, - VHIN_DOMAINNAME, -}; - - -#ifdef __KERNEL__ - -#include - -extern int vc_set_vhi_name(uint32_t, void __user *); -extern int vc_get_vhi_name(uint32_t, void __user *); - -#endif /* __KERNEL__ */ - -#define VCMD_enter_namespace VC_CMD(PROCALT, 1, 0) -#define VCMD_cleanup_namespace VC_CMD(PROCALT, 2, 0) -#define VCMD_set_namespace VC_CMD(PROCALT, 3, 0) - -#ifdef __KERNEL__ - -struct vx_info; -struct namespace; -struct fs_struct; - -extern int vx_set_namespace(struct vx_info *, struct namespace *, struct fs_struct *); - -extern int vc_enter_namespace(uint32_t, void __user *); -extern int vc_cleanup_namespace(uint32_t, void __user *); -extern int vc_set_namespace(uint32_t, void __user *); - -#endif /* __KERNEL__ */ -#endif /* _VX_NAMESPACE_H */ diff --git a/util-vserver/kernel/network.h b/util-vserver/kernel/network.h deleted file mode 100644 index b3c39b0..0000000 --- a/util-vserver/kernel/network.h +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef _VX_NETWORK_H -#define _VX_NETWORK_H - -#define MAX_N_CONTEXT 65535 /* Arbitrary limit */ - -#define IP_DYNAMIC_ID ((uint32_t)-1) /* id for dynamic context */ - -#define NB_IPV4ROOT 16 - -#ifdef __KERNEL__ - -#include -#include -#include -#include -#include - - -struct nx_info { - struct list_head nx_list; /* linked list of nxinfos */ - nid_t nx_id; /* vnet id */ - atomic_t nx_refcount; - - uint64_t nx_flags; /* network flag word */ - uint64_t nx_ncaps; /* network capabilities */ - - int nbipv4; - __u32 ipv4[NB_IPV4ROOT]; /* Process can only bind to these IPs */ - /* The first one is used to connect */ - /* and for bind any service */ - /* The other must be used explicity */ - __u32 mask[NB_IPV4ROOT]; /* Netmask for each ipv4 */ - /* Used to select the proper source */ - /* address for sockets */ - __u32 v4_bcast; /* Broadcast address to receive UDP */ - - char nx_name[65]; /* network context name */ -}; - - -extern spinlock_t nxlist_lock; -extern struct list_head nx_infos; - - -void free_nx_info(struct nx_info *); -struct nx_info *create_nx_info(void); - -extern struct nx_info *find_nx_info(int); -extern int nx_info_id_valid(int); - -struct in_ifaddr; -struct net_device; - -int ifa_in_nx_info(struct in_ifaddr *, struct nx_info *); -int dev_in_nx_info(struct net_device *, struct nx_info *); - - -#endif /* __KERNEL__ */ - -#include "switch.h" - -/* vinfo commands */ - -#define VCMD_task_nid VC_CMD(VINFO, 2, 0) - -#ifdef __KERNEL__ -extern int vc_task_nid(uint32_t, void __user *); - -#endif /* __KERNEL__ */ - -#define VCMD_nx_info VC_CMD(VINFO, 6, 0) - -struct vcmd_nx_info_v0 { - uint32_t nid; - /* more to come */ -}; - -#ifdef __KERNEL__ -extern int vc_nx_info(uint32_t, void __user *); - -#endif /* __KERNEL__ */ - -#define VCMD_net_create VC_CMD(VNET, 1, 0) -#define VCMD_net_migrate VC_CMD(NETMIG, 1, 0) - -#define VCMD_net_add VC_CMD(NETALT, 1, 0) -#define VCMD_net_remove VC_CMD(NETALT, 2, 0) - -struct vcmd_net_nx_v0 { - uint16_t type; - uint16_t count; - uint32_t ip[4]; - uint32_t mask[4]; - /* more to come */ -}; - -// IPN_TYPE_IPV4 - - -#ifdef __KERNEL__ -extern int vc_net_create(uint32_t, void __user *); -extern int vc_net_migrate(uint32_t, void __user *); - -#endif /* __KERNEL__ */ - -#define VCMD_get_nflags VC_CMD(FLAGS, 5, 0) -#define VCMD_set_nflags VC_CMD(FLAGS, 6, 0) - -struct vcmd_net_flags_v0 { - uint64_t flagword; - uint64_t mask; -}; - -#ifdef __KERNEL__ -extern int vc_get_nflags(uint32_t, void __user *); -extern int vc_set_nflags(uint32_t, void __user *); - -#endif /* __KERNEL__ */ - -#define IPF_STATE_SETUP (1ULL<<32) - - -#define IPF_ONE_TIME (0x0001ULL<<32) - -#define VCMD_get_ncaps VC_CMD(FLAGS, 7, 0) -#define VCMD_set_ncaps VC_CMD(FLAGS, 8, 0) - -struct vcmd_net_caps_v0 { - uint64_t ncaps; - uint64_t cmask; -}; - -#ifdef __KERNEL__ -extern int vc_get_ncaps(uint32_t, void __user *); -extern int vc_set_ncaps(uint32_t, void __user *); - -#endif /* __KERNEL__ */ - -#define IPC_WOSSNAME 0x00000001 - - -#endif /* _VX_NETWORK_H */ diff --git a/util-vserver/kernel/sched.h b/util-vserver/kernel/sched.h deleted file mode 100644 index 1054da8..0000000 --- a/util-vserver/kernel/sched.h +++ /dev/null @@ -1,134 +0,0 @@ -#if defined(__KERNEL__) && defined(_VX_INFO_DEF_) - -#include -#include -#include -#include -#include - -/* context sub struct */ - -struct _vx_sched { - spinlock_t tokens_lock; /* lock for this structure */ - - int fill_rate; /* Fill rate: add X tokens... */ - int interval; /* Divisor: per Y jiffies */ - atomic_t tokens; /* number of CPU tokens in this context */ - int tokens_min; /* Limit: minimum for unhold */ - int tokens_max; /* Limit: no more than N tokens */ - uint32_t jiffies; /* add an integral multiple of Y to this */ - - uint64_t ticks; /* token tick events */ - cpumask_t cpus_allowed; /* cpu mask for context */ -}; - -static inline void vx_info_init_sched(struct _vx_sched *sched) -{ - /* scheduling; hard code starting values as constants */ - sched->fill_rate = 1; - sched->interval = 4; - sched->tokens_min = HZ >> 4; - sched->tokens_max = HZ >> 1; - sched->jiffies = jiffies; - sched->tokens_lock = SPIN_LOCK_UNLOCKED; - - atomic_set(&sched->tokens, HZ >> 2); - sched->cpus_allowed = CPU_MASK_ALL; -} - -static inline int vx_info_proc_sched(struct _vx_sched *sched, char *buffer) -{ - return sprintf(buffer, - "Ticks:\t%16lld\n" - "Token:\t\t%8d\n" - "FillRate:\t%8d\n" - "Interval:\t%8d\n" - "TokensMin:\t%8d\n" - "TokensMax:\t%8d\n" - ,sched->ticks - ,atomic_read(&sched->tokens) - ,sched->fill_rate - ,sched->interval - ,sched->tokens_min - ,sched->tokens_max - ); -} - - -#else /* _VX_INFO_DEF_ */ -#ifndef _VX_SCHED_H -#define _VX_SCHED_H - -#include "switch.h" - -/* sched vserver commands */ - -#define VCMD_set_sched VC_CMD(SCHED, 1, 2) - -struct vcmd_set_sched_v2 { - int32_t fill_rate; - int32_t interval; - int32_t tokens; - int32_t tokens_min; - int32_t tokens_max; - uint64_t cpu_mask; -}; - -#define SCHED_KEEP (-2) - -#ifdef __KERNEL__ - -extern int vc_set_sched_v1(uint32_t, void __user *); -extern int vc_set_sched(uint32_t, void __user *); - - -#define VAVAVOOM_RATIO 50 - -#include "context.h" - - -/* scheduling stuff */ - -int effective_vavavoom(struct task_struct *, int); - -int vx_tokens_recalc(struct vx_info *); - -/* new stuff ;) */ - -static inline int vx_tokens_avail(struct vx_info *vxi) -{ - return atomic_read(&vxi->sched.tokens); -} - -static inline void vx_consume_token(struct vx_info *vxi) -{ - atomic_dec(&vxi->sched.tokens); -} - -static inline int vx_need_resched(struct task_struct *p) -{ -#ifdef CONFIG_VSERVER_HARDCPU - struct vx_info *vxi = p->vx_info; - - if (vxi) { - int tokens; - - p->time_slice--; - if (atomic_read(&vxi->vx_refcount) < 1) - printk("need_resched: p=%p, s=%ld, ref=%d, id=%d/%d\n", - p, p->state, atomic_read(&vxi->vx_refcount), - vxi->vx_id, p->xid); - if ((tokens = vx_tokens_avail(vxi)) > 0) - vx_consume_token(vxi); - return ((p->time_slice == 0) || (tokens < 1)); - } -#endif - p->time_slice--; - return (p->time_slice == 0); -} - - -#endif /* __KERNEL__ */ - -#endif /* _VX_SCHED_H */ -#endif diff --git a/util-vserver/kernel/signal.h b/util-vserver/kernel/signal.h deleted file mode 100644 index 3911127..0000000 --- a/util-vserver/kernel/signal.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _VX_SIGNAL_H -#define _VX_SIGNAL_H - -#include "switch.h" - -/* context signalling */ - -#define VCMD_ctx_kill VC_CMD(PROCTRL, 1, 0) - -struct vcmd_ctx_kill_v0 { - int32_t pid; - int32_t sig; -}; - -#ifdef __KERNEL__ -extern int vc_ctx_kill(uint32_t, void __user *); - -#endif /* __KERNEL__ */ -#endif /* _VX_SIGNAL_H */ diff --git a/util-vserver/kernel/switch.h b/util-vserver/kernel/switch.h deleted file mode 100644 index 5fef690..0000000 --- a/util-vserver/kernel/switch.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef _VX_SWITCH_H -#define _VX_SWITCH_H - -#include - -#define VC_CATEGORY(c) (((c) >> 24) & 0x3F) -#define VC_COMMAND(c) (((c) >> 16) & 0xFF) -#define VC_VERSION(c) ((c) & 0xFFF) - -#define VC_CMD(c,i,v) ((((VC_CAT_ ## c) & 0x3F) << 24) \ - | (((i) & 0xFF) << 16) | ((v) & 0xFFF)) - -/* - - Syscall Matrix V2.6 - - |VERSION|CREATE |MODIFY |MIGRATE|CONTROL|EXPERIM| |SPECIAL|SPECIAL| - |STATS |DESTROY|ALTER |CHANGE |LIMIT |TEST | | | | - |INFO |SETUP | |MOVE | | | | | | - -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ - SYSTEM |VERSION|VSETUP |VHOST | | | | |DEVICES| | - HOST | 00| 01| 02| 03| 04| 05| | 06| 07| - -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ - CPU | |VPROC |PROCALT|PROCMIG|PROCTRL| | |SCHED. | | - PROCESS| 08| 09| 10| 11| 12| 13| | 14| 15| - -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ - MEMORY | | | | | | | |SWAP | | - | 16| 17| 18| 19| 20| 21| | 22| 23| - -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ - NETWORK| |VNET |NETALT |NETMIG |NETCTL | | |SERIAL | | - | 24| 25| 26| 27| 28| 29| | 30| 31| - -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ - DISK | | | | | | | |INODE | | - VFS | 32| 33| 34| 35| 36| 37| | 38| 39| - -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ - OTHER | | | | | | | |VINFO | | - | 40| 41| 42| 43| 44| 45| | 46| 47| - =======+=======+=======+=======+=======+=======+=======+ +=======+=======+ - SPECIAL| | | | |FLAGS | | | | | - | 48| 49| 50| 51| 52| 53| | 54| 55| - -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ - SPECIAL| | | | |RLIMIT |SYSCALL| | |COMPAT | - | 56| 57| 58| 59| 60|TEST 61| | 62| 63| - -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ - -*/ - -#define VC_CAT_VERSION 0 - -#define VC_CAT_VSETUP 1 -#define VC_CAT_VHOST 2 - -#define VC_CAT_VPROC 9 -#define VC_CAT_PROCALT 10 -#define VC_CAT_PROCMIG 11 -#define VC_CAT_PROCTRL 12 - -#define VC_CAT_SCHED 14 - -#define VC_CAT_VNET 25 -#define VC_CAT_NETALT 26 -#define VC_CAT_NETMIG 27 -#define VC_CAT_NETCTRL 28 - -#define VC_CAT_INODE 38 - -#define VC_CAT_VINFO 46 - -#define VC_CAT_FLAGS 52 -#define VC_CAT_RLIMIT 60 - -#define VC_CAT_SYSTEST 61 -#define VC_CAT_COMPAT 63 - -/* interface version */ - -#define VCI_VERSION 0x00010016 - - -/* query version */ - -#define VCMD_get_version VC_CMD(VERSION, 0, 0) - - -#ifdef __KERNEL__ - -#include - -#define ENOTSUP -EOPNOTSUPP - -#else /* __KERNEL__ */ -#define __user -#endif /* __KERNEL__ */ - -#endif /* _VX_SWITCH_H */ diff --git a/util-vserver/kernel/xid.h b/util-vserver/kernel/xid.h deleted file mode 100644 index ba52c25..0000000 --- a/util-vserver/kernel/xid.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef _LINUX_XID_H_ -#define _LINUX_XID_H_ - -#ifdef CONFIG_INOXID_NONE - -#define MAX_UID 0xFFFFFFFF -#define MAX_GID 0xFFFFFFFF - -#define INOXID_XID(uid, gid, xid) (0) - -#define XIDINO_UID(uid, xid) (uid) -#define XIDINO_GID(gid, xid) (gid) - -#endif - - -#ifdef CONFIG_INOXID_GID16 - -#define MAX_UID 0xFFFFFFFF -#define MAX_GID 0x0000FFFF - -#define INOXID_XID(uid, gid, xid) (((gid) >> 16) & 0xFFFF) - -#define XIDINO_UID(uid, xid) (uid) -#define XIDINO_GID(gid, xid) (((gid) & 0xFFFF) | ((xid) << 16)) - - -#endif - - -#ifdef CONFIG_INOXID_GID24 - -#define MAX_UID 0x00FFFFFF -#define MAX_GID 0x00FFFFFF - -#define INOXID_XID(uid, gid, xid) ((((uid) >> 16) & 0xFF00) | (((gid) >> 24) & 0xFF)) - -#define XIDINO_UID(uid, xid) (((uid) & 0xFFFFFF) | (((xid) & 0xFF00) << 16)) -#define XIDINO_GID(gid, xid) (((gid) & 0xFFFFFF) | (((xid) & 0x00FF) << 24)) - -#endif - - -#ifdef CONFIG_INOXID_GID32 - -#define MAX_UID 0xFFFFFFFF -#define MAX_GID 0xFFFFFFFF - -#define INOXID_XID(uid, gid, xid) (xid) - -#define XIDINO_UID(uid, xid) (uid) -#define XIDINO_GID(gid, xid) (gid) - -#endif - - -#ifdef CONFIG_INOXID_RUNTIME - -#define MAX_UID 0xFFFFFFFF -#define MAX_GID 0xFFFFFFFF - -#define INOXID_XID(uid, gid, xid) (0) - -#define XIDINO_UID(uid, xid) (uid) -#define XIDINO_GID(gid, xid) (gid) - -#endif - - -#define INOXID_UID(uid, gid) ((uid) & MAX_UID) -#define INOXID_GID(uid, gid) ((gid) & MAX_GID) - -static inline uid_t vx_map_uid(uid_t uid) -{ - if ((uid > MAX_UID) && (uid != -1)) - uid = -2; - return (uid & MAX_UID); -} - -static inline gid_t vx_map_gid(gid_t gid) -{ - if ((gid > MAX_GID) && (gid != -1)) - gid = -2; - return (gid & MAX_GID); -} - - -#ifdef CONFIG_VSERVER_LEGACY -#define FIOC_GETXID _IOR('x', 1, long) -#define FIOC_SETXID _IOW('x', 2, long) -#define FIOC_SETXIDJ _IOW('x', 3, long) -#endif - -#endif /* _LINUX_XID_H_ */ diff --git a/util-vserver/lib/.cvsignore b/util-vserver/lib/.cvsignore deleted file mode 100644 index 5b3dc3a..0000000 --- a/util-vserver/lib/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -*.la -*.lo -.buexcl -.deps -.dirstamp -.libs -util-vserver.pc diff --git a/util-vserver/lib/Makefile-files b/util-vserver/lib/Makefile-files deleted file mode 100644 index 0a74781..0000000 --- a/util-vserver/lib/Makefile-files +++ /dev/null @@ -1,170 +0,0 @@ -## $Id$ -*- makefile -*- - -## Copyright (C) 2003 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; either version 2, or (at your option) -## any later version. -## -## 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. -## - -lib_VERSION = 0.0.0 - -lib_compat_SRCS = lib/cflags-compat.c \ - lib/cflags_list-compat.c -lib_legacy_SRCS = lib/getprocentry-legacy.c -lib_management_SRCS = lib/createskeleton.c \ - lib/getvserverbyctx.c \ - lib/getvserverbyctx-compat.hc \ - lib/getvserverbyctx-v13.hc \ - lib/getvservercfgstyle.c \ - lib/getvserverappdir.c \ - lib/getvservercfgdir.c \ - lib/getvserverctx.c \ - lib/getvservername.c \ - lib/getvservervdir.c \ - lib/xidopt2xid.c -lib_v11_SRCS = lib/syscall_rlimit.c \ - lib/syscall_rlimit-v11.hc \ - lib/syscall_kill.c \ - lib/syscall_kill-v11.hc -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_setnamespace-v13.hc \ - lib/syscall_cleanupnamespace.c \ - lib/syscall_cleanupnamespace-v13.hc \ - lib/syscall_getiattr.c \ - lib/syscall_getiattr-fscompat.hc \ - lib/syscall_getiattr-v13.hc \ - 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-net.hc \ - lib/syscall_getvxinfo.c \ - lib/syscall_getvxinfo-v13.hc \ - lib/syscall_getvxinfo-oldproc.hc \ - lib/syscall_getvhiname.c \ - lib/syscall_getvhiname-v13.hc \ - lib/syscall_getvhiname-olduts.hc \ - lib/syscall_setvhiname.c \ - lib/syscall_setvhiname-v13.hc \ - lib/syscall_setvhiname-olduts.hc \ - lib/syscall_getccaps.c \ - 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/bcaps_list-v13.c \ - lib/ccaps-v13.c \ - lib/ccaps_list-v13.c \ - lib/cflags-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 - -lib_SRCS = lib/syscall.c \ - lib/checkversion.c \ - lib/isdirectory.c \ - lib/getnbipv4root.c \ - lib/getversion.c \ - lib/capabilities.c \ - lib/getinsecurebcaps.c \ - lib/isdynamicxid.c \ - lib/issupported.c \ - lib/issupportedstring.c \ - lib/listparser_uint32.c \ - lib/listparser_uint64.c \ - lib/syscall-syscall.c \ - lib/val2text-t2v-uint32.c \ - lib/val2text-t2v-uint64.c \ - lib/val2text-v2t-uint32.c \ - lib/val2text-v2t-uint64.c \ - lib/parselimit.c \ - $(lib_legacy_SRCS) \ - $(lib_compat_SRCS) \ - $(lib_management_SRCS) \ - $(lib_v11_SRCS) \ - $(lib_v13_SRCS) \ - $(ensc_fmt_SRCS) - -include_HEADERS += lib/vserver.h - -noinst_HEADERS += lib/syscall-compat.hc \ - lib/syscall-legacy.hc \ - lib/createskeleton-full.hc \ - lib/createskeleton-short.hc \ - lib/fmt.h \ - lib/getversion-internal.hc \ - lib/safechroot-internal.hc \ - lib/ioctl-getext2flags.hc \ - lib/ioctl-getfilecontext.hc \ - lib/ioctl-setext2flags.hc \ - lib/ioctl-setfilecontext.hc \ - lib/ioctl-getxflg.hc \ - lib/ioctl-setxflg.hc \ - lib/ext2fs.h \ - lib/listparser.hc \ - lib/val2text.hc \ - lib/virtual.h \ - lib/internal.h \ - lib/utils-legacy.h \ - lib/vserver-internal.h - -lib_LTLIBRARIES += lib/libvserver.la - -lib_libvserver_la_SOURCES = $(lib_SRCS) -lib_libvserver_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIB_DEBUG_CPPFLAGS) -lib_libvserver_la_LDFLAGS = -version $(lib_VERSION) - -DIETPROGS += lib/lib_libvserver_la-% \ - lib/lib_libvserver_a-% \ - lib/lib_libvserver_pic_a-% - -include $(srcdir)/lib/apidoc/Makefile-files -include $(srcdir)/lib/testsuite/Makefile-files diff --git a/util-vserver/lib/apidoc/.cvsignore b/util-vserver/lib/apidoc/.cvsignore deleted file mode 100644 index d8dfac7..0000000 --- a/util-vserver/lib/apidoc/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.apidoc -Doxyfile -html -latex -man diff --git a/util-vserver/lib/apidoc/Doxyfile.in b/util-vserver/lib/apidoc/Doxyfile.in deleted file mode 100644 index 534b8dc..0000000 --- a/util-vserver/lib/apidoc/Doxyfile.in +++ /dev/null @@ -1,215 +0,0 @@ -# Doxyfile 1.3.6 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "@PACKAGE@ (libvserver)" -PROJECT_NUMBER = @PACKAGE_VERSION@ -OUTPUT_DIRECTORY = -OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO -INHERIT_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 -ALIASES = -OPTIMIZE_OUTPUT_FOR_C = YES -OPTIMIZE_OUTPUT_JAVA = NO -SUBGROUPING = YES -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = NO -EXTRACT_PRIVATE = YES -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_BY_SCOPE_NAME = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = @top_srcdir@/lib -FILE_PATTERNS = vserver.h \ - internal.h -RECURSIVE = NO -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = @top_srcdir@/lib/apidoc -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = YES -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -VERBATIM_HEADERS = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = YES -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = YES -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = YES -LATEX_HIDE_INDICES = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = YES -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = YES -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = VC_ATTR_UNUSED= \ - VC_ATTR_NONNULL(X)= \ - VC_ATTR_NORETURN= \ - VC_ATTR_ALWAYSINLINE= \ - VC_ATTR_PURE= \ - IS_DOXYGEN=1 -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -UML_LOOK = YES -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = YES -GRAPHICAL_HIERARCHY = YES -DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -MAX_DOT_GRAPH_DEPTH = 0 -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO diff --git a/util-vserver/lib/apidoc/Makefile-files b/util-vserver/lib/apidoc/Makefile-files deleted file mode 100644 index 0f9d8d4..0000000 --- a/util-vserver/lib/apidoc/Makefile-files +++ /dev/null @@ -1,31 +0,0 @@ -## $Id$ --*- makefile -*-- - -## 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. - -CLEANFILES += lib/apidoc/.apidoc -EXTRA_DIST += lib/apidoc/list2xxx.syntax - -doc: lib/apidoc/.apidoc -clean-local: clean_lib_apidoc - -clean_lib_apidoc: - -rm -rf lib/apidoc/html lib/apidoc/latex lib/apidoc/man - -lib/apidoc/.apidoc: lib/apidoc/Doxyfile lib/vserver.h lib/internal.h - -rm -rf lib/apidoc/html lib/apidoc/latex lib/apidoc/man - cd "$$(dirname '$<')" && $(DOXYGEN) "$$(basename '$<')" - $(MAKE) -j1 -C lib/apidoc/latex - touch '$@' diff --git a/util-vserver/lib/apidoc/list2xxx.syntax b/util-vserver/lib/apidoc/list2xxx.syntax deleted file mode 100644 index 1706e9b..0000000 --- a/util-vserver/lib/apidoc/list2xxx.syntax +++ /dev/null @@ -1,5 +0,0 @@ -LIST <- ELEM | ELEM ',' LIST -ELEM <- '~' ELEM | MASK | NAME -MASK <- NUMBER | '^' NUMBER -NUMBER <- 0[0-7]* | [1-9][0-9]* | 0x[0-9,a-f]+ -NAME <- | "all" | "any" | "none" diff --git a/util-vserver/lib/bcaps-v13.c b/util-vserver/lib/bcaps-v13.c deleted file mode 100644 index 6a0a6db..0000000 --- a/util-vserver/lib/bcaps-v13.c +++ /dev/null @@ -1,101 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" -#include -#include - -#include -#include -#include - -#ifndef CAP_QUOTACTL -# define CAP_QUOTACTL VC_CAP_QUOTACTL -#endif - -#define DECL(VAL) { #VAL, sizeof(#VAL)-1, 1 << (CAP_ ## VAL) } - -static struct Mapping_uint64 const VALUES[] = { - DECL(CHOWN), - DECL(DAC_OVERRIDE), - DECL(DAC_READ_SEARCH), - DECL(FOWNER), - DECL(FSETID), - DECL(KILL), - DECL(SETGID), - DECL(SETUID), - DECL(SETPCAP), - DECL(LINUX_IMMUTABLE), - DECL(NET_BIND_SERVICE), - DECL(NET_BROADCAST), - DECL(NET_ADMIN), - DECL(NET_RAW), - DECL(IPC_LOCK), - DECL(IPC_OWNER), - DECL(SYS_MODULE), - DECL(SYS_RAWIO), - DECL(SYS_CHROOT), - DECL(SYS_PTRACE), - DECL(SYS_PACCT), - DECL(SYS_ADMIN), - DECL(SYS_BOOT), - DECL(SYS_NICE), - DECL(SYS_RESOURCE), - DECL(SYS_TIME), - DECL(SYS_TTY_CONFIG), - DECL(MKNOD), - DECL(LEASE), - DECL(QUOTACTL), -}; - -inline static char const * -removePrefix(char const *str, size_t *len) -{ - if ((len==0 || *len==0 || *len>4) && - strncasecmp("cap_", str, 4)==0) { - if (len && *len>4) *len -= 4; - return str+4; - } - else - return str; -} - -uint_least64_t -vc_text2bcap(char const *str, size_t len) -{ - char const * tmp = removePrefix(str, &len); - ssize_t idx = utilvserver_value2text_uint64(tmp, len, - VALUES, DIM_OF(VALUES)); - if (idx==-1) return 0; - else return VALUES[idx].val; -} - -char const * -vc_lobcap2text(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; -} diff --git a/util-vserver/lib/bcaps_list-v13.c b/util-vserver/lib/bcaps_list-v13.c deleted file mode 100644 index c61014e..0000000 --- a/util-vserver/lib/bcaps_list-v13.c +++ /dev/null @@ -1,38 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" - -#include - -int -vc_list2bcap(char const *str, size_t len, - struct vc_err_listparser *err, - struct vc_ctx_caps *caps) -{ - return utilvserver_listparser_uint64(str, len, - err ? &err->ptr : 0, - err ? &err->len : 0, - &caps->bcaps, &caps->bmask, - vc_text2bcap); -} diff --git a/util-vserver/lib/capabilities.c b/util-vserver/lib/capabilities.c deleted file mode 100644 index fcee4f0..0000000 --- a/util-vserver/lib/capabilities.c +++ /dev/null @@ -1,86 +0,0 @@ -// $Id$ --*- c -*-- - -// Copyright (C) 2003 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 -#endif - - -#include "vserver.h" -#include - -#if 1 -# define DECLARECAP(X,Y) { #X, VC_##X } -#else -# define DECLARECAP(X,Y) { #X, Y } -#endif - -static struct { - char const * const id; - unsigned char bit; -} const CAP2BIT[] = { - DECLARECAP(CAP_CHOWN, 0), - DECLARECAP(CAP_DAC_OVERRIDE, 1), - DECLARECAP(CAP_DAC_READ_SEARCH, 2), - DECLARECAP(CAP_FOWNER, 3), - DECLARECAP(CAP_FSETID, 4), - DECLARECAP(CAP_KILL, 5), - DECLARECAP(CAP_SETGID, 6), - DECLARECAP(CAP_SETUID, 7), - DECLARECAP(CAP_SETPCAP, 8), - DECLARECAP(CAP_LINUX_IMMUTABLE, 9), - DECLARECAP(CAP_NET_BIND_SERVICE, 10), - DECLARECAP(CAP_NET_BROADCAST, 11), - DECLARECAP(CAP_NET_ADMIN, 12), - DECLARECAP(CAP_NET_RAW, 13), - DECLARECAP(CAP_IPC_LOCK, 14), - DECLARECAP(CAP_IPC_OWNER, 15), - DECLARECAP(CAP_SYS_MODULE, 16), - DECLARECAP(CAP_SYS_RAWIO, 17), - DECLARECAP(CAP_SYS_CHROOT, 18), - DECLARECAP(CAP_SYS_PTRACE, 19), - DECLARECAP(CAP_SYS_PACCT, 20), - DECLARECAP(CAP_SYS_ADMIN, 21), - DECLARECAP(CAP_SYS_BOOT, 22), - DECLARECAP(CAP_SYS_NICE, 23), - DECLARECAP(CAP_SYS_RESOURCE, 24), - DECLARECAP(CAP_SYS_TIME, 25), - DECLARECAP(CAP_SYS_TTY_CONFIG, 26), - DECLARECAP(CAP_MKNOD, 27), - DECLARECAP(CAP_LEASE, 28), - DECLARECAP(CAP_QUOTACTL, 29), -}; - -int -vc_text2cap(char const *str) -{ - size_t i; - if (strncmp(str, "CAP_", 4)==0) str += 4; - - for (i=0; i=sizeof(CAP2BIT)/sizeof(CAP2BIT[0])) return 0; - return CAP2BIT[bit].id; -} diff --git a/util-vserver/lib/ccaps-v13.c b/util-vserver/lib/ccaps-v13.c deleted file mode 100644 index 39d2e03..0000000 --- a/util-vserver/lib/ccaps-v13.c +++ /dev/null @@ -1,56 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" -#include - -#include -#include - -#define DECL(STR, VAL) { STR, sizeof(STR)-1, VAL } - -static struct Mapping_uint64 const VALUES[] = { - DECL("utsname", VC_VXC_SET_UTSNAME), - DECL("rlimit", VC_VXC_SET_RLIMIT), - DECL("ping", VC_VXC_ICMP_PING), - DECL("mount", VC_VXC_SECURE_MOUNT), -}; - -uint_least64_t -vc_text2ccap(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_loccap2text(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; -} diff --git a/util-vserver/lib/ccaps_list-v13.c b/util-vserver/lib/ccaps_list-v13.c deleted file mode 100644 index f52bfe7..0000000 --- a/util-vserver/lib/ccaps_list-v13.c +++ /dev/null @@ -1,38 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" - -#include - -int -vc_list2ccap(char const *str, size_t len, - struct vc_err_listparser *err, - struct vc_ctx_caps *caps) -{ - return utilvserver_listparser_uint64(str, len, - err ? &err->ptr : 0, - err ? &err->len : 0, - &caps->ccaps, &caps->cmask, - vc_text2ccap); -} diff --git a/util-vserver/lib/cflags-compat.c b/util-vserver/lib/cflags-compat.c deleted file mode 100644 index efc11f4..0000000 --- a/util-vserver/lib/cflags-compat.c +++ /dev/null @@ -1,70 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include -#include - -#define DECL(STR, VAL) { STR, sizeof(STR)-1, VAL } - -static struct { - char const * const id; - size_t len; - unsigned char val; -} const FLAGVALUES[] = { - DECL("lock", S_CTX_INFO_LOCK), - DECL("sched", S_CTX_INFO_SCHED), - DECL("nproc", S_CTX_INFO_NPROC), - DECL("private", S_CTX_INFO_PRIVATE), - DECL("fakeinit", S_CTX_INFO_INIT), - DECL("hideinfo", S_CTX_INFO_HIDEINFO), - DECL("ulimit", S_CTX_INFO_ULIMIT), - DECL("namespace", S_CTX_INFO_NAMESPACE), -}; - -uint_least32_t -vc_text2cflag_compat(char const *str, size_t len) -{ - size_t i; - if (len==0) len=strlen(str); - - for (i=0; i0; i/=2, --idx) - if (val & i) return FLAGVALUES[idx].id; - - return 0; -} diff --git a/util-vserver/lib/cflags-v13.c b/util-vserver/lib/cflags-v13.c deleted file mode 100644 index e6e4649..0000000 --- a/util-vserver/lib/cflags-v13.c +++ /dev/null @@ -1,74 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" -#include - -#include -#include - -#define DECL(STR, VAL) { STR, sizeof(STR)-1, VAL } - -static struct Mapping_uint64 const VALUES[] = { - DECL("lock", VC_VXF_INFO_LOCK), - DECL("nproc", VC_VXF_INFO_NPROC), - DECL("private", VC_VXF_INFO_PRIVATE), - DECL("fakeinit", VC_VXF_INFO_INIT), - - DECL("hideinfo", VC_VXF_INFO_HIDEINFO), - DECL("ulimit", VC_VXF_INFO_ULIMIT), - DECL("namespace", VC_VXF_INFO_NAMESPACE), - - DECL("sched_hard", VC_VXF_SCHED_HARD), - DECL("sched_prio", VC_VXF_SCHED_PRIO), - DECL("sched_pause", VC_VXF_SCHED_PAUSE), - - DECL("virt_mem", VC_VXF_VIRT_MEM), - DECL("virt_uptime", VC_VXF_VIRT_UPTIME), - DECL("virt_cpu", VC_VXF_VIRT_CPU), - - DECL("hide_mount", VC_VXF_HIDE_MOUNT), - DECL("hide_netif", VC_VXF_HIDE_NETIF), - - DECL("state_setup", VC_VXF_STATE_SETUP), - DECL("state_init", VC_VXF_STATE_INIT), -}; - -uint_least64_t -vc_text2cflag(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_locflag2text(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; -} diff --git a/util-vserver/lib/cflags_list-compat.c b/util-vserver/lib/cflags_list-compat.c deleted file mode 100644 index 692bacc..0000000 --- a/util-vserver/lib/cflags_list-compat.c +++ /dev/null @@ -1,62 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include - -uint_least32_t -vc_list2cflag_compat(char const *str, size_t len, - struct vc_err_listparser *err) -{ - uint32_t res = 0; - - if (len==0) len = strlen(str); - - for (;len>0;) { - char const *ptr = strchr(str, ','); - size_t cnt = ptr ? (size_t)(ptr-str) : len; - unsigned int tmp; - - if (cnt>=len) { cnt=len; len=0; } - else len-=(cnt+1); - - tmp = vc_text2cflag_compat(str,cnt); - - if (tmp!=0) res |= tmp; - else { - if (err) { - err->ptr = str; - err->len = cnt; - } - return res; - } - - if (ptr==0) break; - str = ptr+1; - } - - if (err) { - err->ptr = 0; - err->len = 0; - } - return res; -} diff --git a/util-vserver/lib/cflags_list-v13.c b/util-vserver/lib/cflags_list-v13.c deleted file mode 100644 index ea14e64..0000000 --- a/util-vserver/lib/cflags_list-v13.c +++ /dev/null @@ -1,38 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" - -#include - -int -vc_list2cflag(char const *str, size_t len, - struct vc_err_listparser *err, - struct vc_ctx_flags *flags) -{ - return utilvserver_listparser_uint64(str, len, - err ? &err->ptr : 0, - err ? &err->len : 0, - &flags->flagword, &flags->mask, - vc_text2cflag); -} diff --git a/util-vserver/lib/checkversion.c b/util-vserver/lib/checkversion.c deleted file mode 100644 index 4180b2f..0000000 --- a/util-vserver/lib/checkversion.c +++ /dev/null @@ -1,43 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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 -#endif - -#include "vserver.h" -#include "vserver-internal.h" -#include "getversion-internal.hc" - -int -utilvserver_checkCompatVersion() -{ - static int res=0; - static int v_errno; - - if (res==0) { - res = vc_get_version_internal(VC_CAT_COMPAT); - v_errno = errno; -#ifdef VC_ENABLE_API_LEGACY - if (res==-1 && (errno==ENOSYS || errno==EINVAL)) res=0; -#endif - } - - errno = v_errno; - return res; -} diff --git a/util-vserver/lib/createskeleton-full.hc b/util-vserver/lib/createskeleton-full.hc deleted file mode 100644 index e7c622c..0000000 --- a/util-vserver/lib/createskeleton-full.hc +++ /dev/null @@ -1,127 +0,0 @@ -// $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. - -#include -#include -#include -#include -#include - -#define CONCAT_TWO_ARGS(BUF, LHS,RHS) \ - size_t BUF ## l1 = strlen(LHS); \ - size_t BUF ## l2 = strlen(RHS); \ - char BUF[BUF ## l1 + BUF ## l2 + 2]; \ - \ - memcpy(BUF, LHS, BUF ## l1 + 1); \ - if (BUF ## l2>0) { \ - memcpy(BUF+BUF ## l1, "/", BUF ## l1); \ - memcpy(BUF+BUF ## l1+1, RHS, BUF ## l2+1); \ - } - -static inline int -mkdir2(char const *lhs, char const *rhs, int mode) -{ - CONCAT_TWO_ARGS(buf, lhs, rhs); - return mkdir(buf, mode); -} - -static inline int -setIAttr2(char const *lhs, char const *rhs, int flags) -{ - CONCAT_TWO_ARGS(buf, lhs, rhs); - - return vc_set_iattr(buf, 0, flags, VC_IMMUTABLE_ALL); -} - -static inline int -symlink2(char const *old_lhs, char const *old_rhs, - char const *new_lhs, char const *new_rhs) -{ - CONCAT_TWO_ARGS(old_buf, old_lhs, old_rhs); - - { - CONCAT_TWO_ARGS(new_buf, new_lhs, new_rhs); - return symlink(old_buf, new_buf); - } -} - -#undef CONCAT_TWO_ARGS - -static inline int -vc_createSkeleton_full(char const *id, char const *name, int flags) -{ - if (mkdir(id, 0755)==-1) return -1; - - if (mkdir2(id, "apps", 0755)==-1 || - ((flags&vcSKEL_INTERFACES) && mkdir2(id, "interfaces", 755)==-1) || - ((flags&vcSKEL_PKGMGMT) && ( - mkdir2(id, "apps/pkgmgmt", 0755)==-1))) - return -1; - - for (;;) { - char const *basedir = CONFDIR "/.defaults/run.rev"; - - if (!utilvserver_isDirectory(basedir, true)) basedir = DEFAULT_PKGSTATEREVDIR; - if (!utilvserver_isDirectory(basedir, true)) break; - - if (symlink2(basedir, "", id, "run.rev")==-1) - return -1; - - break; - } - - for (;;) { - char const *basedir = CONFDIR "/.defaults/run"; - - if (!utilvserver_isDirectory(basedir, true)) basedir = DEFAULT_PKGSTATEDIR; - if (!utilvserver_isDirectory(basedir, true)) break; - - if (symlink2(basedir, name, id, "run")==-1) - return -1; - - break; - } - - while (flags&vcSKEL_PKGMGMT) { - char const *basedir = CONFDIR "/.defaults/apps/pkgmgmt/base"; - - if (!utilvserver_isDirectory(basedir, true)) basedir = DEFAULT_VSERVERPKGDIR; - if (!utilvserver_isDirectory(basedir, true)) break; - - if (mkdir2(basedir, name, 0755)==-1 || - symlink2(basedir, name, id, "apps/pkgmgmt/base")==-1) - return -1; - - break; - } - - while (flags&vcSKEL_FILESYSTEM) { - char const *basedir = CONFDIR "/.defaults/vdirbase"; - - if (!utilvserver_isDirectory(basedir, true)) basedir = DEFAULT_VSERVERDIR; - if (!utilvserver_isDirectory(basedir, true)) break; - - if (mkdir2(basedir, name, 0755)==-1 || - setIAttr2(basedir, name, 0)==-1 || - symlink2(basedir, name, id, "vdir")==-1) - return -1; - - break; - } - - return 0; -} diff --git a/util-vserver/lib/createskeleton-short.hc b/util-vserver/lib/createskeleton-short.hc deleted file mode 100644 index 0397913..0000000 --- a/util-vserver/lib/createskeleton-short.hc +++ /dev/null @@ -1,31 +0,0 @@ -// $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. - -#include -#include - -static inline int -vc_createSkeleton_short(char const *id, int flags) -{ - size_t l = strlen(id); - char buf[sizeof(CONFDIR "/") + l]; - - memcpy(buf, CONFDIR "/", sizeof(CONFDIR "/")-1); - memcpy(buf+sizeof(CONFDIR "/")-1, id, l+1); - - return vc_createSkeleton_full(buf, id, flags); -} diff --git a/util-vserver/lib/createskeleton.c b/util-vserver/lib/createskeleton.c deleted file mode 100644 index 528f2e7..0000000 --- a/util-vserver/lib/createskeleton.c +++ /dev/null @@ -1,49 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" - -#include "pathconfig.h" - -#include "createskeleton-full.hc" -#include "createskeleton-short.hc" - -#include - -int -vc_createSkeleton(char const *id, vcCfgStyle style, int flags) -{ - if (style==vcCFG_NONE || style==vcCFG_AUTO) { - if (strchr(id, '/')!=0) style = vcCFG_RECENT_FULL; - else style = vcCFG_RECENT_SHORT; - } - - switch (style) { - case vcCFG_RECENT_SHORT : return vc_createSkeleton_short(id, flags); - case vcCFG_RECENT_FULL : return vc_createSkeleton_full(id, 0, flags); - default : ; - } - - errno = EINVAL; - return -1; -} diff --git a/util-vserver/lib/ext2fs.h b/util-vserver/lib/ext2fs.h deleted file mode 100644 index 1102310..0000000 --- a/util-vserver/lib/ext2fs.h +++ /dev/null @@ -1,30 +0,0 @@ -// $Id$ --*- c -*-- - -// Copyright (C) 2003 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. - - -#ifndef H_UTIL_VSERVER_SRC_EXT2FS_H -#define H_UTIL_VSERVER_SRC_EXT2FS_H - -#ifdef ENSC_HAVE_EXT2FS_EXT2_FS_H -# include -#elif defined(ENSC_HAVE_LINUX_EXT2_FS_H) -# include -#else -# error Do not know how to include -#endif - -#endif // H_UTIL_VSERVER_SRC_EXT2FS_H diff --git a/util-vserver/lib/fmt.h b/util-vserver/lib/fmt.h deleted file mode 100644 index e256afb..0000000 --- a/util-vserver/lib/fmt.h +++ /dev/null @@ -1,24 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_FMT_H -#define H_UTIL_VSERVER_LIB_FMT_H - -#include "../ensc_fmt/fmt.h" - -#endif // H_UTIL_VSERVER_LIB_FMT_H diff --git a/util-vserver/lib/getinsecurebcaps.c b/util-vserver/lib/getinsecurebcaps.c deleted file mode 100644 index f6e61c1..0000000 --- a/util-vserver/lib/getinsecurebcaps.c +++ /dev/null @@ -1,41 +0,0 @@ -// $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 -#endif - -#include "vserver.h" - -uint_least64_t -vc_get_insecurebcaps() -{ - return ( (1< -// -// 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 -#endif - -#include "vserver.h" -#include "linuxvirtual.h" - -size_t -vc_get_nb_ipv4root() -{ - return NB_IPV4ROOT; -} diff --git a/util-vserver/lib/getprocentry-legacy.c b/util-vserver/lib/getprocentry-legacy.c deleted file mode 100644 index f88fa95..0000000 --- a/util-vserver/lib/getprocentry-legacy.c +++ /dev/null @@ -1,84 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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 -#endif - -#include "utils-legacy.h" -#include "internal.h" -#include "vserver-internal.h" - -#include -#include -#include -#include -#include - -static volatile size_t proc_bufsize = 4097; - -size_t -utilvserver_getProcEntryBufsize() -{ - return proc_bufsize; -} - -char * -utilvserver_getProcEntry(pid_t pid, - char *str, - char *buf, size_t bufsize) -{ - char status_name[ sizeof("/proc//status") + sizeof(unsigned int)*3 + 1 ]; - int fd; - size_t len; - char * res = 0; - - if (pid<0 || (uint32_t)(pid)>99999) { - errno = EBADR; - return 0; - } - - if (pid==0) strcpy(status_name, "/proc/self/status"); - else { - strcpy(status_name, "/proc/"); - len = utilvserver_fmt_uint(status_name+sizeof("/proc/")-1, pid); - strcpy(status_name+sizeof("/proc/")+len-1, "/status"); - } - - fd = open(status_name, O_RDONLY); - if (fd==-1) return 0; - - len = read(fd, buf, bufsize); - close(fd); - - if (len -// -// 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. - - -#ifndef H_UTIL_VSERVER_LIB_GETVERSION_INTERNAL_H -#define H_UTIL_VSERVER_LIB_GETVERSION_INTERNAL_H - -#ifdef HAVE_CONFIG_H -# include -#endif - -#define _LINUX_TYPES_H 1 -#include "linuxvirtual.h" - -static inline ALWAYSINLINE UNUSED int -vc_get_version_internal(int cat) -{ - return vserver(VCMD_get_version, cat, 0); -} - -#endif // H_UTIL_VSERVER_LIB_GETVERSION_INTERNAL_H diff --git a/util-vserver/lib/getversion.c b/util-vserver/lib/getversion.c deleted file mode 100644 index 4234d83..0000000 --- a/util-vserver/lib/getversion.c +++ /dev/null @@ -1,30 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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 -#endif - -#include "vserver-internal.h" -#include "getversion-internal.hc" - -int -vc_get_version() -{ - return vc_get_version_internal(VC_CAT_COMPAT); -} diff --git a/util-vserver/lib/getvserverappdir.c b/util-vserver/lib/getvserverappdir.c deleted file mode 100644 index 71e2c07..0000000 --- a/util-vserver/lib/getvserverappdir.c +++ /dev/null @@ -1,73 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" -#include "pathconfig.h" - -#include - -char * -vc_getVserverAppDir(char const *id, vcCfgStyle style, char const *app) -{ - size_t l1 = strlen(id); - size_t l2 = strlen(app); - char *res = 0; - - if (style==vcCFG_NONE || style==vcCFG_AUTO) - style = vc_getVserverCfgStyle(id); - - switch (style) { - case vcCFG_NONE : return 0; - case vcCFG_LEGACY : return 0; - case vcCFG_RECENT_FULL : - case vcCFG_RECENT_SHORT : - { - char buf[sizeof(CONFDIR) + l1 + l2 + sizeof("//apps/") - 1]; - char * ptr = buf; - - if (style==vcCFG_RECENT_FULL) - memcpy(ptr, id, l1); - else { - memcpy(ptr, CONFDIR "/", sizeof(CONFDIR "/")-1); - ptr += sizeof(CONFDIR "/")-1; - memcpy(ptr, id, l1); - } - - ptr += l1; - memcpy(ptr, "/apps/", 6); ptr += 6; - memcpy(ptr, app, l2); ptr += l2; - *ptr = '\0'; - - res = strdup(buf); - break; - } - default : return 0; - } - - if (!utilvserver_isDirectory(res, true)) { - free(res); - res = 0; - } - - return res; -} diff --git a/util-vserver/lib/getvserverbyctx-compat.hc b/util-vserver/lib/getvserverbyctx-compat.hc deleted file mode 100644 index 9418e2f..0000000 --- a/util-vserver/lib/getvserverbyctx-compat.hc +++ /dev/null @@ -1,114 +0,0 @@ -// $Id$ --*- c -*-- - -// Copyright (C) 2003 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 -#endif - -#include "vserver.h" -#include "internal.h" -#include "pathconfig.h" -#include "compat-c99.h" - -#include -#include - -#ifdef VC_ENABLE_API_COMPAT -#include -#include - - -static char * -handleLegacy(xid_t xid) -{ - DIR *dir = opendir(DEFAULT_PKGSTATEDIR); - struct dirent *ep; - char * result = 0; - - if (dir==0) return 0; - while ((ep=readdir(dir))!=0) { - char * const name = ep->d_name; - size_t l = name ? strlen(name) : 0; - xid_t cur_xid; - - if (l<=4 || strcmp(name+l-4, ".ctx")!=0) continue; - name[l-4] = '\0'; - cur_xid = vc_getVserverCtx(name, vcCFG_LEGACY, false, 0); - if (cur_xid!=xid) continue; - - result = strdup(name); - break; - } - - closedir(dir); - return result; -} -#else -static inline char * -handleLegacy(xid_t UNUSED xid) -{ - return 0; -} -#endif - -static char * -vc_getVserverByCtx_compat(xid_t ctx, vcCfgStyle *style, char const *revdir) -{ - if (revdir==0) revdir = DEFAULT_PKGSTATEREVDIR; - - { - vcCfgStyle cur_style = vcCFG_NONE; - size_t l = strlen(revdir); - size_t l1; - char path[l + sizeof(unsigned int)*3 + 3]; - - strcpy(path, revdir); - path[l] = '/'; - l1 = utilvserver_fmt_uint(path+l+1, ctx); - path[l+1+l1] = '\0'; - - if (style==0 || *style==vcCFG_AUTO) { - if (access(path, F_OK)==0) cur_style = vcCFG_RECENT_FULL; - else cur_style = vcCFG_LEGACY; - } - else - cur_style = *style; - - switch (cur_style) { - case vcCFG_RECENT_SHORT : - case vcCFG_RECENT_FULL : - // check if expected ctx == actual ctx - if (vc_getVserverCtx(path, vcCFG_RECENT_FULL, false, 0)!=ctx) return 0; - - if (style) *style = vcCFG_RECENT_FULL; - return strdup(path); - // TODO: handle legacy - case vcCFG_LEGACY : - { - char * tmp = handleLegacy(ctx); - if (tmp && style) - *style = vcCFG_LEGACY; - - return tmp; - } - - default : - return 0; - } - } -} diff --git a/util-vserver/lib/getvserverbyctx-v13.hc b/util-vserver/lib/getvserverbyctx-v13.hc deleted file mode 100644 index 7cd90a8..0000000 --- a/util-vserver/lib/getvserverbyctx-v13.hc +++ /dev/null @@ -1,35 +0,0 @@ -// $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 -#endif - -static char * -vc_getVserverByCtx_v13(xid_t ctx, vcCfgStyle *style, char const UNUSED *revdir) -{ - char buf[128]; - - if (vc_get_vhi_name(ctx, vcVHI_CONTEXT, buf, sizeof buf)!=-1 && - vc_getVserverCtx(buf, vcCFG_RECENT_FULL, false, 0)==ctx) { - if (style) *style = vcCFG_RECENT_FULL; - return strdup(buf); - } - else - return 0; -} diff --git a/util-vserver/lib/getvserverbyctx.c b/util-vserver/lib/getvserverbyctx.c deleted file mode 100644 index 8ceda6f..0000000 --- a/util-vserver/lib/getvserverbyctx.c +++ /dev/null @@ -1,41 +0,0 @@ -// $Id$ --*- c -*-- - -// Copyright (C) 2003 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 -#endif - -#include "vserver.h" -#include "internal.h" -#include "pathconfig.h" -#include "compat-c99.h" - -#include -#include - -#include "getvserverbyctx-compat.hc" -#include "getvserverbyctx-v13.hc" - -char * -vc_getVserverByCtx(xid_t ctx, vcCfgStyle *style, char const *revdir) -{ - if (vc_isSupported(vcFEATURE_MIGRATE)) - return vc_getVserverByCtx_v13(ctx, style, revdir); - else - return vc_getVserverByCtx_compat(ctx, style, revdir); -} diff --git a/util-vserver/lib/getvservercfgdir.c b/util-vserver/lib/getvservercfgdir.c deleted file mode 100644 index b846d73..0000000 --- a/util-vserver/lib/getvservercfgdir.c +++ /dev/null @@ -1,61 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" -#include "pathconfig.h" - -#include - -char * -vc_getVserverCfgDir(char const *id, vcCfgStyle style) -{ - size_t l1 = strlen(id); - char *res = 0; - - if (style==vcCFG_NONE || style==vcCFG_AUTO) - style = vc_getVserverCfgStyle(id); - - switch (style) { - case vcCFG_NONE : return 0; - case vcCFG_LEGACY : return 0; - case vcCFG_RECENT_FULL : res = strdup(id); break; - case vcCFG_RECENT_SHORT : - { - char buf[sizeof(CONFDIR) + l1 + sizeof("/") - 1]; - - strcpy(buf, CONFDIR "/"); - strcpy(buf+sizeof(CONFDIR "/") - 1, id); - - res = strdup(buf); - break; - } - default : return 0; - } - - if (!utilvserver_isDirectory(res, true)) { - free(res); - res = 0; - } - - return res; -} diff --git a/util-vserver/lib/getvservercfgstyle.c b/util-vserver/lib/getvservercfgstyle.c deleted file mode 100644 index 28550e6..0000000 --- a/util-vserver/lib/getvservercfgstyle.c +++ /dev/null @@ -1,95 +0,0 @@ -// $Id$ --*- c -*-- - -// Copyright (C) 2003 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 -#endif - -#include "vserver.h" -#include "pathconfig.h" -#include "internal.h" - -#include -#include -#include -#include - -static inline bool -isRelPath(char const *p) -{ - return p[0]=='.' && (p[1]=='/' || (p[1]=='.' && p[2]=='/')); -} - -static inline bool -isAbsPath(char const *p) -{ - return p[0]=='/'; -} - -#define ISDIR utilvserver_isDirectory(buf, true) - -vcCfgStyle -vc_getVserverCfgStyle(char const *id) -{ - vcCfgStyle res = vcCFG_NONE; - size_t l1 = strlen(id); - char buf[l1 + - MAX(sizeof(CONFDIR "/"),sizeof(DEFAULT_VSERVERDIR "/")) + - MAX(sizeof("/legacy"), sizeof(".conf")) - 1]; - char * marker = 0; - bool is_path; - - strcpy(buf, id); - marker = buf+l1; - strcpy(marker, "/vdir"); - - is_path = isAbsPath(buf) || isRelPath(buf); - if (is_path && ISDIR) - res = vcCFG_RECENT_FULL; - else if (!is_path) { - strcpy(buf, CONFDIR "/"); - strcpy(buf+sizeof(CONFDIR "/") - 1, id); - marker = buf+sizeof(CONFDIR "/")+l1 - 1; - strcpy(marker, "/vdir"); - - if (ISDIR) res = vcCFG_RECENT_SHORT; - else { - strcpy(buf, DEFAULT_VSERVERDIR "/"); - strcpy(buf+sizeof(DEFAULT_VSERVERDIR)+1 - 1, id); - - if (ISDIR) res = vcCFG_LEGACY; - } - - if (res==vcCFG_LEGACY) { - strcpy(buf, CONFDIR "/"); - strcpy(buf+sizeof(CONFDIR "/") - 1, id); - strcpy(buf+sizeof(CONFDIR "/")+l1 - 1, ".conf"); - - if (!ISDIR) res = vcCFG_NONE; - } - } - - - if (res==vcCFG_RECENT_FULL || res==vcCFG_RECENT_SHORT) { - assert(marker!=0); - strcpy(marker, "/legacy"); - if (access(buf, F_OK)==0) res=vcCFG_LEGACY; - } - - return res; -} diff --git a/util-vserver/lib/getvserverctx.c b/util-vserver/lib/getvserverctx.c deleted file mode 100644 index cf7a4f9..0000000 --- a/util-vserver/lib/getvserverctx.c +++ /dev/null @@ -1,156 +0,0 @@ -// $Id$ --*- c -*-- - -// Copyright (C) 2003 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 -#endif - -#include "vserver.h" -#include "pathconfig.h" -#include "compat-c99.h" -#include "lib_internal/util.h" - -#include -#include -#include -#include -#include -#include - -#ifdef VC_ENABLE_API_COMPAT -#include - -static xid_t -extractLegacyXID(char const *dir, char const *basename) -{ - size_t l1 = strlen(dir); - size_t l2 = strlen(basename); - char path[l1 + l2 + sizeof("/.ctx")]; - char * ptr = path; - int fd; - ssize_t len; - xid_t result = VC_NOXID; - - ptr = Xmemcpy(ptr, dir, l1); - *ptr++ = '/'; - ptr = Xmemcpy(ptr, basename, l2); - ptr = Xmemcpy(ptr, ".ctx", 5); - - fd = open(path, O_RDONLY); - if (fd==-1) return VC_NOXID; - - len = lseek(fd, 0, SEEK_END); - - if (len!=-1 && lseek(fd, 0, SEEK_SET)!=-1) { - char buf[len+2]; - char const *pos = 0; - - buf[0] = '\n'; - - if (read(fd, buf+1, len+1)==len) { - buf[len+1] = '\0'; - pos = strstr(buf, "\nS_CONTEXT="); - } - - if (pos) pos += 11; - if (*pos>='1' && *pos<='9') - result = atoi(pos); - } - - close(fd); - return result; -} -#else -static xid_t -extractLegacyXID(char const UNUSED *dir, char const UNUSED *basename) -{ - return VC_NOXID; -} -#endif - - -static xid_t -getCtxFromFile(char const *pathname) -{ - int fd; - off_t len; - - fd = open(pathname, O_RDONLY); - - if (fd==-1 || - (len=lseek(fd, 0, SEEK_END))==-1 || - (len>50) || - (lseek(fd, 0, SEEK_SET)==-1)) - return VC_NOCTX; - - { - char buf[len+1]; - char *errptr; - xid_t res; - - if (TEMP_FAILURE_RETRY(read(fd, buf, len+1))!=len) - return VC_NOCTX; - - res = strtol(buf, &errptr, 10); - if (*errptr!='\0' && *errptr!='\n') return VC_NOCTX; - - return res; - } -} - -xid_t -vc_getVserverCtx(char const *id, vcCfgStyle style, bool honor_static, bool *is_running) -{ - size_t l1 = strlen(id); - char buf[sizeof(CONFDIR "//") + l1 + sizeof("/context")]; - - if (style==vcCFG_NONE || style==vcCFG_AUTO) - style = vc_getVserverCfgStyle(id); - - if (is_running) *is_running = false; - - switch (style) { - case vcCFG_NONE : return VC_NOCTX; - case vcCFG_LEGACY : - return extractLegacyXID(DEFAULT_PKGSTATEDIR, id); - case vcCFG_RECENT_SHORT : - case vcCFG_RECENT_FULL : { - size_t idx = 0; - xid_t res = 0; - - if (style==vcCFG_RECENT_SHORT) { - memcpy(buf, CONFDIR "/", sizeof(CONFDIR "/")-1); - idx = sizeof(CONFDIR "/") - 1; - } - memcpy(buf+idx, id, l1); idx += l1; - memcpy(buf+idx, "/run", 5); // appends '\0' too - - res = getCtxFromFile(buf); - if (is_running) *is_running = res!=VC_NOCTX; - - if (res==VC_NOCTX && honor_static) { - memcpy(buf+idx, "/context", 9); // appends '\0' too - - res = getCtxFromFile(buf); - } - - return res; - } - default : return VC_NOCTX; - } -} diff --git a/util-vserver/lib/getvservername.c b/util-vserver/lib/getvservername.c deleted file mode 100644 index 212c9df..0000000 --- a/util-vserver/lib/getvservername.c +++ /dev/null @@ -1,104 +0,0 @@ -// $Id$ --*- c -*-- - -// Copyright (C) 2003 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 -#endif - -#include "vserver.h" -#include "pathconfig.h" - -#include -#include -#include -#include -#include -#include - -static char * -getRecentName(char *start, char *end) -{ - char *res = 0; - int fd; - char buf[PATH_MAX]; - - strcpy(end, "/name"); - fd = open(start, O_RDONLY); - if (fd!=-1) { - off_t len; - - if ((len=lseek(fd, 0, SEEK_END))!=-1 && - (len0 && buf[len-1]=='\n') --len; - buf[len] = '\0'; - if (len>0) res = buf; - } - - close(fd); - return strdup(res); - } - - close(fd); - } - - if (res==0) { - *end = '\0'; - res = realpath(start, buf); - //printf("start='%s', res='%s'\n", start,res); - if (res==0) res = start; - - res = basename(res); - } - - return strdup(res); -} - -char * -vc_getVserverName(char const *id, vcCfgStyle style) -{ - size_t l1 = strlen(id); - - if (style==vcCFG_NONE || style==vcCFG_AUTO) - style = vc_getVserverCfgStyle(id); - - switch (style) { - case vcCFG_NONE : return 0; - case vcCFG_LEGACY : return strdup(id); - case vcCFG_RECENT_SHORT : - { - char buf[sizeof(CONFDIR "/") + l1 + sizeof("/name") - 1]; - - strcpy(buf, CONFDIR "/"); - strcpy(buf+sizeof(CONFDIR "/") - 1, id); - - return getRecentName(buf, buf+sizeof(CONFDIR "/")+l1 - 1); - } - case vcCFG_RECENT_FULL : - { - char buf[l1 + sizeof("/name")]; - strcpy(buf, id); - - return getRecentName(buf, buf+l1); - } - default : return 0; - } -} diff --git a/util-vserver/lib/getvservervdir.c b/util-vserver/lib/getvservervdir.c deleted file mode 100644 index 8ac43fd..0000000 --- a/util-vserver/lib/getvservervdir.c +++ /dev/null @@ -1,113 +0,0 @@ -// $Id$ --*- c -*-- - -// Copyright (C) 2003 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 -#endif - -#include "vserver.h" -#include "internal.h" -#include "pathconfig.h" - -#include -#include -#include -#include - -static char * -getDir(char *dir, bool physical) -{ - int fd; - char tmp[PATH_MAX]; - - if (!physical) return strdup(dir); - - fd = open(".", O_RDONLY); - if (fd==-1) return 0; - - if (chdir(dir)!=-1 && - getcwd(tmp, sizeof tmp)!=0) - dir = strdup(tmp); - else - dir = 0; - - if (fchdir(fd)==-1) { - write(2, "FATAL error: failed to restore directory\n", 41); - abort(); - } - close(fd); - return dir; -} - -char * -vc_getVserverVdir(char const *id, vcCfgStyle style, bool physical) -{ - size_t l1 = strlen(id); - char *res = 0; - - if (style==vcCFG_NONE || style==vcCFG_AUTO) - style = vc_getVserverCfgStyle(id); - - switch (style) { - case vcCFG_NONE : return 0; - case vcCFG_LEGACY : - { - char buf[sizeof(DEFAULT_VSERVERDIR "/") + l1]; - - strcpy(buf, DEFAULT_VSERVERDIR "/"); - strcpy(buf+sizeof(DEFAULT_VSERVERDIR "/") - 1, id); - - res = getDir(buf, physical); - break; - } - - case vcCFG_RECENT_SHORT : - { - char buf[sizeof(CONFDIR) + l1 + sizeof("//vdir") - 1]; - - strcpy(buf, CONFDIR "/"); - strcpy(buf+sizeof(CONFDIR "/") - 1, id); - strcpy(buf+sizeof(CONFDIR "/")+l1 - 1, "/vdir"); - - res = getDir(buf, physical); - break; - } - - case vcCFG_RECENT_FULL : - { - char buf[l1 + sizeof("/vdir")]; - - strcpy(buf, id); - strcpy(buf+l1, "/vdir"); - - res = getDir(buf, physical); - break; - } - - default : return 0; - } - - // ignore physical-case; we went into the directory while determining - // the physical path so the directory exists - if (!physical && !utilvserver_isDirectory(res, true)) { - free(res); - res = 0; - } - - return res; -} diff --git a/util-vserver/lib/internal.h b/util-vserver/lib/internal.h deleted file mode 100644 index 3a8786d..0000000 --- a/util-vserver/lib/internal.h +++ /dev/null @@ -1,82 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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. - -/** \file internal.h - * \brief Declarations which are used by util-vserver internally. - */ - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_H -#define H_UTIL_VSERVER_LIB_INTERNAL_H - -#include "fmt.h" -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -int utilvserver_checkCompatVersion(); -bool utilvserver_isDirectory(char const *path, bool follow_link); - -int utilvserver_listparser_uint32(char const *str, size_t len, - char const **err_ptr, size_t *err_len, - uint_least32_t *flag, - uint_least32_t *mask, - uint_least32_t (*func)(char const*, - size_t)) NONNULL((1,5,6,7)); - -int utilvserver_listparser_uint64(char const *str, size_t len, - char const **err_ptr, size_t *err_len, - uint_least64_t *flag, - uint_least64_t *mask, - uint_least64_t (*func)(char const*, - size_t)) NONNULL((1,5,6,7)); - -struct Mapping_uint32 { - char const * const id; - size_t len; - uint_least32_t val; -}; - -struct Mapping_uint64 { - char const * const id; - size_t len; - uint_least64_t val; -}; - -ssize_t utilvserver_value2text_uint32(char const *str, size_t len, - struct Mapping_uint32 const *map, - size_t map_len) NONNULL((1,3)); - -ssize_t utilvserver_value2text_uint64(char const *str, size_t len, - struct Mapping_uint64 const *map, - size_t map_len) NONNULL((1,3)); - -ssize_t utilvserver_text2value_uint32(uint_least32_t *val, - struct Mapping_uint32 const *map, - size_t map_len) NONNULL((1,2)); - -ssize_t utilvserver_text2value_uint64(uint_least64_t *val, - struct Mapping_uint64 const *map, - size_t map_len) NONNULL((1,2)); -#ifdef __cplusplus -} -#endif - - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_H diff --git a/util-vserver/lib/ioctl-getext2flags.hc b/util-vserver/lib/ioctl-getext2flags.hc deleted file mode 100644 index b04ab16..0000000 --- a/util-vserver/lib/ioctl-getext2flags.hc +++ /dev/null @@ -1,48 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "ext2fs.h" - -#include - -#ifndef EXT2_IMMUTABLE_FILE_FL -# define EXT2_IMMUTABLE_FILE_FL 0x00000010 -#endif - -#ifndef EXT2_IMMUTABLE_LINK_FL -# define EXT2_IMMUTABLE_LINK_FL 0x00008000 -#endif - -static inline ALWAYSINLINE int -vc_X_get_ext2flags(int fd, long *flags) -{ - int rc; - - *flags = 0; - rc = ioctl(fd, EXT2_IOC_GETFLAGS, flags); - *flags = EXT2FLAGS_KERNEL2USER(*flags); - - ENSC_FIX_IOCTL(rc); - - return rc; -} diff --git a/util-vserver/lib/ioctl-getfilecontext.hc b/util-vserver/lib/ioctl-getfilecontext.hc deleted file mode 100644 index 3ff8c50..0000000 --- a/util-vserver/lib/ioctl-getfilecontext.hc +++ /dev/null @@ -1,38 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "ext2fs.h" - -#include - -static inline ALWAYSINLINE xid_t -vc_X_get_filecontext(int fd) -{ - int c; - int rc = ioctl(fd, EXT2_IOC_GETCONTEXT, &c); - - ENSC_FIX_IOCTL(rc); - - if (rc==-1) return VC_NOCTX; - else return c; -} diff --git a/util-vserver/lib/ioctl-getxflg.hc b/util-vserver/lib/ioctl-getxflg.hc deleted file mode 100644 index 6006f97..0000000 --- a/util-vserver/lib/ioctl-getxflg.hc +++ /dev/null @@ -1,43 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "ext2fs.h" - -#include - -#define FIOC_GETXFLG _IOR('x', 5, long) - -static inline ALWAYSINLINE int -vc_X_get_xflg(int fd, long *flags) -{ - int rc; - *flags = 0; - rc = ioctl(fd, FIOC_GETXFLG, flags); - - if (rc<-1) { - errno = -rc; - rc = -1; - } - - return rc; -} diff --git a/util-vserver/lib/ioctl-setext2flags.hc b/util-vserver/lib/ioctl-setext2flags.hc deleted file mode 100644 index 47f6752..0000000 --- a/util-vserver/lib/ioctl-setext2flags.hc +++ /dev/null @@ -1,56 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "ext2fs.h" - -#include - -#ifndef EXT2_IMMUTABLE_FILE_FL -# define EXT2_IMMUTABLE_FILE_FL 0x00000010 -#endif - -#ifndef EXT2_IMMUTABLE_LINK_FL -# define EXT2_IMMUTABLE_LINK_FL 0x00008000 -#endif - -static inline ALWAYSINLINE int -vc_X_set_ext2flags(int fd, long set_flags, long del_flags) -{ - long old_flags = 0; - int rc; - - set_flags = EXT2FLAGS_USER2KERNEL(set_flags); - del_flags = EXT2FLAGS_USER2KERNEL(del_flags); - - if (del_flags!=-1) { - if (ioctl(fd, EXT2_IOC_GETFLAGS, &old_flags)==-1) return -1; - old_flags &= ~del_flags; - } - - old_flags |= set_flags; - rc = ioctl(fd, EXT2_IOC_SETFLAGS, &old_flags); - - ENSC_FIX_IOCTL(rc); - - return rc; -} diff --git a/util-vserver/lib/ioctl-setfilecontext.hc b/util-vserver/lib/ioctl-setfilecontext.hc deleted file mode 100644 index f39b993..0000000 --- a/util-vserver/lib/ioctl-setfilecontext.hc +++ /dev/null @@ -1,37 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "ext2fs.h" - -#include - -static inline ALWAYSINLINE int -vc_X_set_filecontext(int fd, xid_t ctx) -{ - int c = ctx; - int rc = ioctl(fd, EXT2_IOC_SETCONTEXT, &c); - - ENSC_FIX_IOCTL(rc); - - return rc; -} diff --git a/util-vserver/lib/ioctl-setxflg.hc b/util-vserver/lib/ioctl-setxflg.hc deleted file mode 100644 index f320ee5..0000000 --- a/util-vserver/lib/ioctl-setxflg.hc +++ /dev/null @@ -1,39 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "ext2fs.h" - -#include - -#define FIOC_SETXFLG _IOW('x', 6, long) - -static inline ALWAYSINLINE int -vc_X_set_xflg(int fd, long flags) -{ - int rc; - rc = ioctl(fd, FIOC_SETXFLG, &flags); - - ENSC_FIX_IOCTL(rc); - - return rc; -} diff --git a/util-vserver/lib/isdirectory.c b/util-vserver/lib/isdirectory.c deleted file mode 100644 index bfe0f35..0000000 --- a/util-vserver/lib/isdirectory.c +++ /dev/null @@ -1,37 +0,0 @@ -// $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 -#endif - -#include "internal.h" - -#include -#include -#include - -bool -utilvserver_isDirectory(char const *path, bool follow_link) -{ - struct stat st; - if ( ( follow_link && stat(path, &st)==-1) || - (!follow_link && lstat(path, &st)==-1) ) return false; - - return S_ISDIR(st.st_mode); -} diff --git a/util-vserver/lib/isdynamicxid.c b/util-vserver/lib/isdynamicxid.c deleted file mode 100644 index 084819a..0000000 --- a/util-vserver/lib/isdynamicxid.c +++ /dev/null @@ -1,30 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "linuxvirtual.h" - -bool -vc_is_dynamic_xid(xid_t xid) -{ - return xid>=MIN_D_CONTEXT; -} diff --git a/util-vserver/lib/issupported.c b/util-vserver/lib/issupported.c deleted file mode 100644 index a0c8baf..0000000 --- a/util-vserver/lib/issupported.c +++ /dev/null @@ -1,48 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "assert.h" - -bool -vc_isSupported(vcFeatureSet feature) -{ - int ver = vc_get_version(); - if (ver==-1) return false; - - switch (feature) { - case vcFEATURE_COMPAT : return true; - case vcFEATURE_VSHELPER0 : return ver >= 0x00010000 && ver < 0x00010010; - case vcFEATURE_VSHELPER : return ver >= 0x00010000; - case vcFEATURE_VKILL : return ver >= 0x00010004; - case vcFEATURE_RLIMIT : return ver >= 0x00010004; - case vcFEATURE_VINFO : return ver >= 0x00010010; - case vcFEATURE_VHI : return ver >= 0x00010010; - case vcFEATURE_IATTR : return ver >= 0x00010011; - case vcFEATURE_MIGRATE : return ver >= 0x00010012; - case vcFEATURE_NAMESPACE : return ver >= 0x00010012; - case vcFEATURE_SCHED : return ver >= 0x00020000; // todo - default : assert(false); - } - - return false; -} diff --git a/util-vserver/lib/issupportedstring.c b/util-vserver/lib/issupportedstring.c deleted file mode 100644 index 596337d..0000000 --- a/util-vserver/lib/issupportedstring.c +++ /dev/null @@ -1,49 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "lib_internal/util-dimof.h" -#include - -#define DECL(F) \ - { vcFEATURE_ ## F, #F } - -static struct { - vcFeatureSet feature; - char const * name; -} FEATURES[] = { - DECL(VKILL), DECL(IATTR), DECL(RLIMIT), DECL(COMPAT), - DECL(MIGRATE), DECL(NAMESPACE), DECL(SCHED), DECL(VINFO), - DECL(VHI), DECL(VSHELPER0), DECL(VSHELPER) -}; - -bool -vc_isSupportedString(char const *str) -{ - size_t i; - for (i=0; i -// -// 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 -#endif - -#include -#include -#include - -#define TONUMBER_uint64(S,E,B) strtoll(S,E,B) -#define TONUMBER_uint32(S,E,B) strtol (S,E,B) - -#define ISNUMBER(TYPE,SHORT) \ - static inline ALWAYSINLINE bool \ - isNumber_##SHORT(char const **str,size_t *len,TYPE *res,char end_chr) \ - { \ - char *err_ptr; \ - if (**str=='^') { \ - *res = ((TYPE)(1)) << TONUMBER_##SHORT(++*str, &err_ptr, 0); \ - if (len) --*len; \ - } \ - else \ - *res = TONUMBER_##SHORT(*str, &err_ptr, 0); \ - return err_ptr>*str && *err_ptr==end_chr; \ - } - - -#define LISTPARSER(TYPE,SHORT) \ - ISNUMBER(TYPE,SHORT) \ - int \ - utilvserver_listparser_ ## SHORT(char const *str, size_t len, \ - char const **err_ptr, \ - size_t *err_len, \ - TYPE *flag, \ - TYPE *mask, \ - TYPE (*func)(char const *, size_t)) \ - { \ - if (len==0) len = strlen(str); \ - for (;len>0;) { \ - char const *ptr = strchr(str, ','); \ - size_t cnt; \ - TYPE tmp = 0; \ - bool is_neg = false; \ - bool allow_zero = true; \ - \ - while (len>0 && (*str=='!' || *str=='~')) { \ - is_neg = !is_neg; \ - ++str; \ - --len; \ - } \ - \ - cnt = ptr ? (size_t)(ptr-str) : len; \ - if (cnt>=len) { cnt=len; len=0; } \ - else len-=(cnt+1); \ - \ - if (cnt==0) \ - allow_zero = false; \ - else if (strncasecmp(str,"all",cnt)==0 || \ - strncasecmp(str,"any",cnt)==0) \ - tmp = ~(TYPE)(0); \ - else if (strncasecmp(str,"none",cnt)==0) {} \ - else if (!isNumber_##SHORT(&str, &cnt, &tmp, str[cnt])) { \ - tmp = (*func)(str,cnt); \ - allow_zero = false; \ - } \ - \ - if (tmp!=0 || allow_zero) { \ - if (!is_neg) *flag |= tmp; \ - else *flag &= ~tmp; \ - *mask |= tmp; \ - } \ - else { \ - if (err_ptr) *err_ptr = str; \ - if (err_len) *err_len = cnt; \ - return -1; \ - } \ - \ - if (ptr==0) break; \ - str = ptr+1; \ - } \ - \ - if (err_ptr) *err_ptr = 0; \ - if (err_len) *err_len = 0; \ - return 0; \ - } diff --git a/util-vserver/lib/listparser_uint32.c b/util-vserver/lib/listparser_uint32.c deleted file mode 100644 index b128dbd..0000000 --- a/util-vserver/lib/listparser_uint32.c +++ /dev/null @@ -1,26 +0,0 @@ -// $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 -#endif - -#include "internal.h" -#include "listparser.hc" - -LISTPARSER(uint_least32_t, uint32) diff --git a/util-vserver/lib/listparser_uint64.c b/util-vserver/lib/listparser_uint64.c deleted file mode 100644 index 97a8d02..0000000 --- a/util-vserver/lib/listparser_uint64.c +++ /dev/null @@ -1,26 +0,0 @@ -// $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 -#endif - -#include "internal.h" -#include "listparser.hc" - -LISTPARSER(uint_least64_t, uint64) diff --git a/util-vserver/lib/ncaps-net.c b/util-vserver/lib/ncaps-net.c deleted file mode 100644 index 36d6f44..0000000 --- a/util-vserver/lib/ncaps-net.c +++ /dev/null @@ -1,53 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" -#include - -#include -#include - -#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; -} diff --git a/util-vserver/lib/ncaps_list-net.c b/util-vserver/lib/ncaps_list-net.c deleted file mode 100644 index dbc3c01..0000000 --- a/util-vserver/lib/ncaps_list-net.c +++ /dev/null @@ -1,38 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" - -#include - -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); -} diff --git a/util-vserver/lib/nflags-net.c b/util-vserver/lib/nflags-net.c deleted file mode 100644 index f72a984..0000000 --- a/util-vserver/lib/nflags-net.c +++ /dev/null @@ -1,53 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" -#include - -#include -#include - -#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; -} diff --git a/util-vserver/lib/nflags_list-net.c b/util-vserver/lib/nflags_list-net.c deleted file mode 100644 index c95dd36..0000000 --- a/util-vserver/lib/nflags_list-net.c +++ /dev/null @@ -1,38 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "internal.h" - -#include - -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); -} diff --git a/util-vserver/lib/parselimit.c b/util-vserver/lib/parselimit.c deleted file mode 100644 index 4cb34e1..0000000 --- a/util-vserver/lib/parselimit.c +++ /dev/null @@ -1,50 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include -#include - -bool -vc_parseLimit(char const *buf, vc_limit_t *res) -{ - char * errptr; - - if (strncmp(buf, "inf", 3)==0) { - *res = VC_LIM_INFINITY; - return true; - } - - *res = strtoll(buf, &errptr, 0); - - if (errptr!=buf) { - switch (*errptr) { - case 'M' : *res *= 1024; /* fallthrough */ - case 'K' : *res *= 1024; ++errptr; break; - case 'm' : *res *= 1000; /* fallthrough */ - case 'k' : *res *= 1000; ++errptr; break; - default : break; - } - } - - return errptr!=buf && (*errptr=='\0' || *errptr=='\n'); -} diff --git a/util-vserver/lib/safechroot-internal.hc b/util-vserver/lib/safechroot-internal.hc deleted file mode 100644 index 0539889..0000000 --- a/util-vserver/lib/safechroot-internal.hc +++ /dev/null @@ -1,48 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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. - - -#ifndef H_UTIL_VSERVER_LIB_SAFECHROOT_INTERNAL_H -#define H_UTIL_VSERVER_LIB_SAFECHROOT_INTERNAL_H - -#ifdef HAVE_CONFIG_H -# include -#endif -#include "compat.h" - -#include -#include - -#ifndef NDEBUG -static void -vc_tell_unsafe_chroot() -{ - static int flag = -1; - if (flag==-1) { - char const * const e = getenv("VC_TELL_UNSAFE_CHROOT"); - flag = e ? atoi(e) : 0; - flag = flag ? 1 : 0; - } - - if (flag) write(2, "Unsafe chroot() used\n", 23); -} -#else -static ALWAYSINLINE UNUSED void vc_tell_unsafe_chroot() {} -#endif - - -#endif // H_UTIL_VSERVER_LIB_SAFECHROOT_INTERNAL_H diff --git a/util-vserver/lib/syscall-compat.hc b/util-vserver/lib/syscall-compat.hc deleted file mode 100644 index d827e83..0000000 --- a/util-vserver/lib/syscall-compat.hc +++ /dev/null @@ -1,58 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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 -#endif -#include "compat.h" - -#include "safechroot-internal.hc" -#include "vserver.h" - -#include - -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(VCMD_new_s_context, CTX_USER2KERNEL(ctx), &msg); -} - -static inline ALWAYSINLINE int -vc_set_ipv4root_compat(uint32_t bcast, size_t nb, struct vc_ip_mask_pair const *ips) -{ - struct vcmd_set_ipv4root_v3 msg; - size_t i; - - if (nb>NB_IPV4ROOT) { - errno = -EOVERFLOW; - return -1; - } - - msg.broadcast = bcast; - - for (i=0; i -// based on syscall.cc by Jacques Gelinas -// -// 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; either version 2, or (at your option) -// any later version. -// -// 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. - -/* - This tells the system call number for new_s_context and set_ipv4root - using /proc/self/status. This helps until the vserver project is - included officially in the kernel (and has its own syscall). - - We rely on /proc/self/status to find the syscall number. - - If it is not there, we rely on adm/unistd.h. - - If this file does not have those system calls (not a patched kernel source) - we rely on static values in this file. -*/ -#include "safechroot-internal.hc" - -#include -#include -#include -#include -#include -#include - -// Here is the trick. We keep a copy of the define, then undef it -// and then later, we try to locate the value reading /proc/self/status -// If this fails, we have the old preserved copy. -static int def_NR_set_ipv4root = 274; -#undef __NR_set_ipv4root - -static int __NR_set_ipv4root_rev0; -static int __NR_set_ipv4root_rev1; -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 - -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 rev_s_context=0; - - -#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 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 1){ - 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){ - 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){ - return set_ipv4root_rev2 (ip,nb,bcast); - }else if (rev_ipv4root == 3){ - return set_ipv4root_rev3 (ip,nb,bcast,mask); - } - errno = EINVAL; - return -1; -} - -static ALWAYSINLINE int -vc_set_ipv4root_legacy(uint32_t bcast, size_t nb, struct vc_ip_mask_pair const *ips) -{ - unsigned long ip[nb]; - unsigned long mask[nb]; - size_t i; - - for (i=0; i -// -// 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 -#endif - -#include "vserver-internal.h" - -int -vc_syscall(uint32_t cmd, xid_t xid, void *data) __attribute__((__alias__("vserver"))); diff --git a/util-vserver/lib/syscall.c b/util-vserver/lib/syscall.c deleted file mode 100644 index cde39e3..0000000 --- a/util-vserver/lib/syscall.c +++ /dev/null @@ -1,64 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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 -#endif - -#include "compat.h" -#include "vserver.h" -#include "internal.h" - -#define _LINUX_TYPES_H 1 -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_COMPAT) && defined(VC_ENABLE_API_LEGACY) -# define VC_MULTIVERSION_SYSCALL 1 -#endif -#include "vserver-internal.h" - -#ifdef VC_ENABLE_API_COMPAT -# include "syscall-compat.hc" -#endif - -#ifdef VC_ENABLE_API_LEGACY -# include "syscall-legacy.hc" -#endif - -#include -#include - - -#if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY) - -xid_t -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)); -} - -int -vc_set_ipv4root(uint32_t bcast, size_t nb, struct vc_ip_mask_pair const *ips) -{ - CALL_VC(CALL_VC_COMPAT(vc_set_ipv4root, bcast, nb, ips), - CALL_VC_LEGACY(vc_set_ipv4root, bcast, nb, ips)); -} - -LINK_WARNING("vc_new_s_context", "warning: vc_new_s_context() is obsoleted; use vc_create_context() instead of"); -#endif diff --git a/util-vserver/lib/syscall_cleanupnamespace-v13.hc b/util-vserver/lib/syscall_cleanupnamespace-v13.hc deleted file mode 100644 index e4ceb0c..0000000 --- a/util-vserver/lib/syscall_cleanupnamespace-v13.hc +++ /dev/null @@ -1,29 +0,0 @@ -// $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 -#endif - -#include "vserver.h" - -static inline ALWAYSINLINE int -vc_cleanup_namespace_v13(int UNUSED tmp) -{ - return vserver(VCMD_cleanup_namespace, 0, 0); -} diff --git a/util-vserver/lib/syscall_cleanupnamespace.c b/util-vserver/lib/syscall_cleanupnamespace.c deleted file mode 100644 index 0b7aff4..0000000 --- a/util-vserver/lib/syscall_cleanupnamespace.c +++ /dev/null @@ -1,36 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "linuxvirtual.h" - -#include "vserver-internal.h" - -#ifdef VC_ENABLE_API_V13 -# include "syscall_cleanupnamespace-v13.hc" -#endif - -int -vc_cleanup_namespace() -{ - CALL_VC(CALL_VC_V13(vc_cleanup_namespace,0)); -} diff --git a/util-vserver/lib/syscall_ctxcreate-v13.hc b/util-vserver/lib/syscall_ctxcreate-v13.hc deleted file mode 100644 index 3de1d25..0000000 --- a/util-vserver/lib/syscall_ctxcreate-v13.hc +++ /dev/null @@ -1,29 +0,0 @@ -// $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 -#endif - -static inline ALWAYSINLINE xid_t -vc_ctx_create_v13(xid_t xid) -{ - xid_t res = vserver(VCMD_ctx_create, CTX_USER2KERNEL(xid), 0); - - return CTX_KERNEL2USER(res); -} diff --git a/util-vserver/lib/syscall_ctxcreate.c b/util-vserver/lib/syscall_ctxcreate.c deleted file mode 100644 index b175a0b..0000000 --- a/util-vserver/lib/syscall_ctxcreate.c +++ /dev/null @@ -1,37 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "vserver-internal.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_V13) -# include "syscall_ctxcreate-v13.hc" -#endif - -#if defined(VC_ENABLE_API_V13) -xid_t -vc_ctx_create(xid_t xid) -{ - CALL_VC(CALL_VC_V13A(vc_ctx_create, xid)); -} -#endif diff --git a/util-vserver/lib/syscall_ctxmigrate-v13.hc b/util-vserver/lib/syscall_ctxmigrate-v13.hc deleted file mode 100644 index bc18a19..0000000 --- a/util-vserver/lib/syscall_ctxmigrate-v13.hc +++ /dev/null @@ -1,27 +0,0 @@ -// $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 -#endif - -static inline ALWAYSINLINE int -vc_ctx_migrate_v13(xid_t xid) -{ - return vserver(VCMD_ctx_migrate, CTX_USER2KERNEL(xid), 0); -} diff --git a/util-vserver/lib/syscall_ctxmigrate.c b/util-vserver/lib/syscall_ctxmigrate.c deleted file mode 100644 index d98da5c..0000000 --- a/util-vserver/lib/syscall_ctxmigrate.c +++ /dev/null @@ -1,37 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "vserver-internal.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_V13) -# include "syscall_ctxmigrate-v13.hc" -#endif - -#if defined(VC_ENABLE_API_V13) -int -vc_ctx_migrate(xid_t xid) -{ - CALL_VC(CALL_VC_V13A(vc_ctx_migrate, xid)); -} -#endif diff --git a/util-vserver/lib/syscall_enternamespace-v13.hc b/util-vserver/lib/syscall_enternamespace-v13.hc deleted file mode 100644 index 7b40b14..0000000 --- a/util-vserver/lib/syscall_enternamespace-v13.hc +++ /dev/null @@ -1,29 +0,0 @@ -// $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 -#endif - -#include "vserver.h" - -static inline ALWAYSINLINE int -vc_enter_namespace_v13(xid_t xid) -{ - return vserver(VCMD_enter_namespace, CTX_USER2KERNEL(xid), 0); -} diff --git a/util-vserver/lib/syscall_enternamespace.c b/util-vserver/lib/syscall_enternamespace.c deleted file mode 100644 index ca4518c..0000000 --- a/util-vserver/lib/syscall_enternamespace.c +++ /dev/null @@ -1,36 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "linuxvirtual.h" - -#include "vserver-internal.h" - -#ifdef VC_ENABLE_API_V13 -# include "syscall_enternamespace-v13.hc" -#endif - -int -vc_enter_namespace(xid_t xid) -{ - CALL_VC(CALL_VC_V13(vc_enter_namespace, xid)); -} diff --git a/util-vserver/lib/syscall_getccaps-v13.hc b/util-vserver/lib/syscall_getccaps-v13.hc deleted file mode 100644 index 28295ce..0000000 --- a/util-vserver/lib/syscall_getccaps-v13.hc +++ /dev/null @@ -1,36 +0,0 @@ -// $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 -#endif - -static inline ALWAYSINLINE int -vc_get_ccaps_v13(xid_t xid, struct vc_ctx_caps *caps) -{ - struct vcmd_ctx_caps_v0 k_caps; - int res; - - res = vserver(VCMD_get_ccaps, CTX_USER2KERNEL(xid), &k_caps); - caps->bcaps = k_caps.bcaps; - caps->bmask = ~0ull; - caps->ccaps = k_caps.ccaps; - caps->cmask = k_caps.cmask; - - return res; -} diff --git a/util-vserver/lib/syscall_getccaps.c b/util-vserver/lib/syscall_getccaps.c deleted file mode 100644 index e5f867e..0000000 --- a/util-vserver/lib/syscall_getccaps.c +++ /dev/null @@ -1,42 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "vserver-internal.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_V13) -# include "syscall_getccaps-v13.hc" -#endif - -#if defined(VC_ENABLE_API_V13) -int -vc_get_ccaps(xid_t xid, struct vc_ctx_caps *caps) -{ - if (caps==0) { - errno = EFAULT; - return -1; - } - - CALL_VC(CALL_VC_V13A(vc_get_ccaps, xid, caps)); -} -#endif diff --git a/util-vserver/lib/syscall_getcflags-v13.hc b/util-vserver/lib/syscall_getcflags-v13.hc deleted file mode 100644 index 18916a9..0000000 --- a/util-vserver/lib/syscall_getcflags-v13.hc +++ /dev/null @@ -1,39 +0,0 @@ -// $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 -#endif - -static inline ALWAYSINLINE int -vc_get_cflags_v13(xid_t xid, struct vc_ctx_flags *flags) -{ - struct vcmd_ctx_flags_v0 k_flags; - int res; - - if (flags==0) { - errno = EFAULT; - return -1; - } - - res = vserver(VCMD_get_cflags, CTX_USER2KERNEL(xid), &k_flags); - flags->flagword = k_flags.flagword; - flags->mask = k_flags.mask; - - return res; -} diff --git a/util-vserver/lib/syscall_getcflags.c b/util-vserver/lib/syscall_getcflags.c deleted file mode 100644 index 5f447a5..0000000 --- a/util-vserver/lib/syscall_getcflags.c +++ /dev/null @@ -1,37 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "vserver-internal.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_V13) -# include "syscall_getcflags-v13.hc" -#endif - -#if defined(VC_ENABLE_API_V13) -int -vc_get_cflags(xid_t xid, struct vc_ctx_flags *flags) -{ - CALL_VC(CALL_VC_V13A(vc_get_cflags, xid, flags)); -} -#endif diff --git a/util-vserver/lib/syscall_getiattr-fscompat.hc b/util-vserver/lib/syscall_getiattr-fscompat.hc deleted file mode 100644 index c07bae3..0000000 --- a/util-vserver/lib/syscall_getiattr-fscompat.hc +++ /dev/null @@ -1,90 +0,0 @@ -// $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 -#endif - -#include "ioctl-getext2flags.hc" -#include "ioctl-getfilecontext.hc" -#include "ioctl-getxflg.hc" - -#include -static inline ALWAYSINLINE int -vc_get_iattr_fscompat(char const *filename, - xid_t * /*@null@*/ xid, - uint32_t * /*@null@*/ flags, - uint32_t * mask) -{ - struct stat st; - int stat_rc; - int fd; - int old_mask = *mask; - - *mask = 0; - - if (lstat(filename, &st)==-1) return -1; - if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) return 0; - - fd = open(filename, O_RDONLY); - if (fd==-1) return -1; - - stat_rc = fstat(fd, &st); - if (stat_rc==-1) goto err; - - if ( old_mask&VC_IATTR_XID ) { - *xid = vc_X_get_filecontext(fd); - if (*xid!=VC_NOCTX) *mask |= VC_IATTR_XID; - } - - if ( old_mask&VC_IATTR_IUNLINK ) { - long tmp; - int rc = vc_X_get_ext2flags(fd, &tmp); - - if (rc!=-1) { - *mask |= VC_IATTR_IUNLINK; - if (tmp & (VC_IMMUTABLE_FILE_FL|VC_IMMUTABLE_LINK_FL)) - *flags |= VC_IATTR_IUNLINK; - } - } - - if ( (old_mask&VC_IATTR_BARRIER) && S_ISDIR(st.st_mode)) { - *mask |= VC_IATTR_BARRIER; - if ((st.st_mode&0777) == 0) *flags |= VC_IATTR_BARRIER; - } - - if ( (old_mask&(VC_IATTR_WATCH|VC_IATTR_HIDE)) ){ - long tmp; - int rc = vc_X_get_xflg(fd, &tmp); - if (rc!=-1) { - *mask |= (VC_IATTR_WATCH|VC_IATTR_HIDE); - if (tmp&1) *flags |= VC_IATTR_HIDE; - if (tmp&2) *flags |= VC_IATTR_WATCH; - } - } - - close(fd); - return 0; - err: - { - int old_errno = errno; - close(fd); - errno = old_errno; - return -1; - } -} diff --git a/util-vserver/lib/syscall_getiattr-v13.hc b/util-vserver/lib/syscall_getiattr-v13.hc deleted file mode 100644 index 409c9a5..0000000 --- a/util-vserver/lib/syscall_getiattr-v13.hc +++ /dev/null @@ -1,40 +0,0 @@ -// $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 -#endif - -#include "vserver.h" - -static inline ALWAYSINLINE int -vc_get_iattr_v13(char const *filename, - xid_t *xid, uint32_t *flags, uint32_t *mask) -{ - struct vcmd_ctx_iattr_v1 attr; - int rc; - - attr.name = filename; - - rc = vserver(VCMD_get_iattr, 0, &attr); - if (xid) *xid = CTX_KERNEL2USER(attr.xid); - if (flags) *flags = attr.flags; - if (mask) *mask = attr.mask; - - return rc; -} diff --git a/util-vserver/lib/syscall_getiattr.c b/util-vserver/lib/syscall_getiattr.c deleted file mode 100644 index e63ddf0..0000000 --- a/util-vserver/lib/syscall_getiattr.c +++ /dev/null @@ -1,52 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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 -#endif - -#include "vserver.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_FSCOMPAT) && defined(VC_ENABLE_API_V13) -# define VC_MULTIVERSION_SYSCALL 1 -#endif -#include "vserver-internal.h" - -#ifdef VC_ENABLE_API_V13 -# include "syscall_getiattr-v13.hc" -#endif - -#ifdef VC_ENABLE_API_FSCOMPAT -# include "syscall_getiattr-fscompat.hc" -#endif - -int -vc_get_iattr(char const *filename, xid_t *xid, uint32_t *flags, uint32_t *mask) -{ - if ( (mask==0) || - ((*mask&VC_IATTR_XID) && xid==0) || - ((*mask&~VC_IATTR_XID) && flags==0) ) { - errno = EFAULT; - return -1; - } - if ( flags ) *flags &= ~*mask; - - CALL_VC(CALL_VC_V13 (vc_get_iattr, filename, xid, flags, mask), - CALL_VC_FSCOMPAT(vc_get_iattr, filename, xid, flags, mask)); -} diff --git a/util-vserver/lib/syscall_getncaps-net.hc b/util-vserver/lib/syscall_getncaps-net.hc deleted file mode 100644 index b3f8f81..0000000 --- a/util-vserver/lib/syscall_getncaps-net.hc +++ /dev/null @@ -1,34 +0,0 @@ -// $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 -#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; -} diff --git a/util-vserver/lib/syscall_getncaps.c b/util-vserver/lib/syscall_getncaps.c deleted file mode 100644 index 4c10553..0000000 --- a/util-vserver/lib/syscall_getncaps.c +++ /dev/null @@ -1,42 +0,0 @@ -// $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 -#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 diff --git a/util-vserver/lib/syscall_getnflags-net.hc b/util-vserver/lib/syscall_getnflags-net.hc deleted file mode 100644 index c8fb940..0000000 --- a/util-vserver/lib/syscall_getnflags-net.hc +++ /dev/null @@ -1,34 +0,0 @@ -// $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 -#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; -} diff --git a/util-vserver/lib/syscall_getnflags.c b/util-vserver/lib/syscall_getnflags.c deleted file mode 100644 index 1deca24..0000000 --- a/util-vserver/lib/syscall_getnflags.c +++ /dev/null @@ -1,42 +0,0 @@ -// $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 -#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 diff --git a/util-vserver/lib/syscall_getnxinfo-net.hc b/util-vserver/lib/syscall_getnxinfo-net.hc deleted file mode 100644 index a8c0918..0000000 --- a/util-vserver/lib/syscall_getnxinfo-net.hc +++ /dev/null @@ -1,34 +0,0 @@ -// $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 -#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; -} diff --git a/util-vserver/lib/syscall_getnxinfo.c b/util-vserver/lib/syscall_getnxinfo.c deleted file mode 100644 index 27d6de1..0000000 --- a/util-vserver/lib/syscall_getnxinfo.c +++ /dev/null @@ -1,42 +0,0 @@ -// $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 -#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 diff --git a/util-vserver/lib/syscall_gettasknid-net.hc b/util-vserver/lib/syscall_gettasknid-net.hc deleted file mode 100644 index 67bac49..0000000 --- a/util-vserver/lib/syscall_gettasknid-net.hc +++ /dev/null @@ -1,28 +0,0 @@ -// $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 -#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); -} diff --git a/util-vserver/lib/syscall_gettasknid.c b/util-vserver/lib/syscall_gettasknid.c deleted file mode 100644 index 3ee0666..0000000 --- a/util-vserver/lib/syscall_gettasknid.c +++ /dev/null @@ -1,37 +0,0 @@ -// $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 -#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 diff --git a/util-vserver/lib/syscall_gettaskxid-oldproc.hc b/util-vserver/lib/syscall_gettaskxid-oldproc.hc deleted file mode 100644 index 4b4a1ce..0000000 --- a/util-vserver/lib/syscall_gettaskxid-oldproc.hc +++ /dev/null @@ -1,47 +0,0 @@ -// $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 -#endif - -#include "utils-legacy.h" - -static xid_t -getctx_legacy_internal(pid_t pid) -{ - size_t bufsize = utilvserver_getProcEntryBufsize(); - char buf[bufsize]; - char *pos = 0; - - pos = utilvserver_getProcEntry(pid, "\ns_context: ", buf, bufsize); - - if (pos!=0) return atoi(pos); - else return VC_NOCTX; -} - -static inline ALWAYSINLINE xid_t -vc_get_task_xid_oldproc(pid_t pid) -{ - xid_t res; - do { - res = getctx_legacy_internal(pid); - } while (res==VC_NOCTX && errno==EAGAIN); - - return res; -} diff --git a/util-vserver/lib/syscall_gettaskxid-v13.hc b/util-vserver/lib/syscall_gettaskxid-v13.hc deleted file mode 100644 index 18c0215..0000000 --- a/util-vserver/lib/syscall_gettaskxid-v13.hc +++ /dev/null @@ -1,28 +0,0 @@ -// $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 -#endif - -static inline ALWAYSINLINE xid_t -vc_get_task_xid_v13(pid_t pid) -{ - xid_t res=vserver(VCMD_task_xid, pid, 0); - return CTX_KERNEL2USER(res); -} diff --git a/util-vserver/lib/syscall_gettaskxid.c b/util-vserver/lib/syscall_gettaskxid.c deleted file mode 100644 index e7b152c..0000000 --- a/util-vserver/lib/syscall_gettaskxid.c +++ /dev/null @@ -1,44 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_OLDPROC) && defined(VC_ENABLE_API_V13) -# define VC_MULTIVERSION_SYSCALL 1 -#endif -#include "vserver-internal.h" - -#ifdef VC_ENABLE_API_V13 -# include "syscall_gettaskxid-v13.hc" -#endif - -#ifdef VC_ENABLE_API_OLDPROC -# include "syscall_gettaskxid-oldproc.hc" -#endif - -xid_t -vc_get_task_xid(pid_t pid) -{ - CALL_VC(CALL_VC_V13 (vc_get_task_xid, pid), - CALL_VC_OLDPROC(vc_get_task_xid, pid)); -} diff --git a/util-vserver/lib/syscall_getvhiname-olduts.hc b/util-vserver/lib/syscall_getvhiname-olduts.hc deleted file mode 100644 index 6130455..0000000 --- a/util-vserver/lib/syscall_getvhiname-olduts.hc +++ /dev/null @@ -1,38 +0,0 @@ -// $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 -#endif - -static inline ALWAYSINLINE int -vc_get_vhi_name_olduts(xid_t xid, vc_uts_type type, char *val, size_t len) -{ - if (xid!=VC_SAMECTX) { - errno = ESRCH; - return -1; - } - - switch (type) { - case vcVHI_NODENAME : return gethostname (val, len); - case vcVHI_DOMAINNAME : return getdomainname(val, len); - default : - errno = ENOENT; - return -1; - } -} diff --git a/util-vserver/lib/syscall_getvhiname-v13.hc b/util-vserver/lib/syscall_getvhiname-v13.hc deleted file mode 100644 index 5fa8aec..0000000 --- a/util-vserver/lib/syscall_getvhiname-v13.hc +++ /dev/null @@ -1,40 +0,0 @@ -// $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 -#endif - -#include - -static inline ALWAYSINLINE int -vc_get_vhi_name_v13(xid_t xid, vc_uts_type type, char *val, size_t len) -{ - struct vcmd_vx_vhi_name_v0 cmd; - int rc; - size_t l = sizeof(cmd.name); - - cmd.field = VHI_USER2KERNEL(type); - rc = vserver(VCMD_vx_get_vhi_name, CTX_USER2KERNEL(xid), &cmd); - ENSC_FIX_IOCTL(rc); - if (rc==-1) return -1; - - l = l>len ? len : l; - strncpy(val, cmd.name, l); - return 0; -} diff --git a/util-vserver/lib/syscall_getvhiname.c b/util-vserver/lib/syscall_getvhiname.c deleted file mode 100644 index 17f5cae..0000000 --- a/util-vserver/lib/syscall_getvhiname.c +++ /dev/null @@ -1,44 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_OLDUTS) && defined(VC_ENABLE_API_V13) -# define VC_MULTIVERSION_SYSCALL 1 -#endif -#include "vserver-internal.h" - -#ifdef VC_ENABLE_API_V13 -# include "syscall_getvhiname-v13.hc" -#endif - -#ifdef VC_ENABLE_API_OLDUTS -# include "syscall_getvhiname-olduts.hc" -#endif - -int -vc_get_vhi_name(xid_t xid, vc_uts_type type, char *val, size_t len) -{ - CALL_VC(CALL_VC_V13 (vc_get_vhi_name, xid, type, val, len), - CALL_VC_OLDUTS(vc_get_vhi_name, xid, type, val, len)); -} diff --git a/util-vserver/lib/syscall_getvxinfo-oldproc.hc b/util-vserver/lib/syscall_getvxinfo-oldproc.hc deleted file mode 100644 index 09d7b22..0000000 --- a/util-vserver/lib/syscall_getvxinfo-oldproc.hc +++ /dev/null @@ -1,29 +0,0 @@ -// $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 -#endif - -static inline ALWAYSINLINE int -vc_get_vx_info_oldproc(xid_t UNUSED xid, struct vc_vx_info UNUSED *info) -{ - // TODO: ??? - errno = ENOSYS; - return -1; -} diff --git a/util-vserver/lib/syscall_getvxinfo-v13.hc b/util-vserver/lib/syscall_getvxinfo-v13.hc deleted file mode 100644 index f4584d8..0000000 --- a/util-vserver/lib/syscall_getvxinfo-v13.hc +++ /dev/null @@ -1,44 +0,0 @@ -// $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 -#endif - -static inline ALWAYSINLINE int -vc_get_vx_info_v13(xid_t xid, struct vc_vx_info *info) -{ - if (xid==0 || xid==1) { - info->xid = xid; - info->initpid = -1; - - return 0; - } - else { - struct vcmd_vx_info_v0 res; - int rc; - - rc = vserver(VCMD_vx_info, CTX_USER2KERNEL(xid), &res); - if (rc==-1) return -1; - - info->xid = CTX_KERNEL2USER(res.xid); - info->initpid = res.initpid; - - return rc; - } -} diff --git a/util-vserver/lib/syscall_getvxinfo.c b/util-vserver/lib/syscall_getvxinfo.c deleted file mode 100644 index 78be327..0000000 --- a/util-vserver/lib/syscall_getvxinfo.c +++ /dev/null @@ -1,48 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_OLDPROC) && defined(VC_ENABLE_API_V13) -# define VC_MULTIVERSION_SYSCALL 1 -#endif -#include "vserver-internal.h" - -#ifdef VC_ENABLE_API_V13 -# include "syscall_getvxinfo-v13.hc" -#endif - -#ifdef VC_ENABLE_API_OLDPROC -# include "syscall_getvxinfo-oldproc.hc" -#endif - -int -vc_get_vx_info(xid_t xid, struct vc_vx_info *info) -{ - if (info==0) { - errno = EFAULT; - return -1; - } - CALL_VC(CALL_VC_V13 (vc_get_vx_info, xid, info), - CALL_VC_OLDPROC(vc_get_vx_info, xid, info)); -} diff --git a/util-vserver/lib/syscall_kill-v11.hc b/util-vserver/lib/syscall_kill-v11.hc deleted file mode 100644 index 10e1d3c..0000000 --- a/util-vserver/lib/syscall_kill-v11.hc +++ /dev/null @@ -1,31 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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 -#endif - -static inline ALWAYSINLINE int -vc_ctx_kill_v11(xid_t ctx, pid_t pid, int sig) -{ - struct vcmd_ctx_kill_v0 param = { .pid = 0 }; - param.pid = pid; - param.sig = sig; - - return vserver(VCMD_ctx_kill, CTX_USER2KERNEL(ctx), ¶m); -} diff --git a/util-vserver/lib/syscall_kill.c b/util-vserver/lib/syscall_kill.c deleted file mode 100644 index 96a0046..0000000 --- a/util-vserver/lib/syscall_kill.c +++ /dev/null @@ -1,48 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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 -#endif - -#include "vserver.h" -#include "vserver-internal.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_V11) || defined(VC_ENABLE_API_V13) -# include "syscall_kill-v11.hc" -#endif - -#ifdef VC_ENABLE_API_V13 -# define vc_ctx_kill_v13 vc_ctx_kill_v11 -#endif - - -#if defined(VC_ENABLE_API_V11) || defined(VC_ENABLE_API_V13) - - // NOTICE: the reverse order of V11 -> V13 is correct here since these are - // the same syscalls - -int -vc_ctx_kill(xid_t ctx, pid_t pid, int sig) -{ - CALL_VC(CALL_VC_V11(vc_ctx_kill, ctx, pid, sig), - CALL_VC_V13(vc_ctx_kill, ctx, pid, sig)); -} - -#endif diff --git a/util-vserver/lib/syscall_netadd-net.hc b/util-vserver/lib/syscall_netadd-net.hc deleted file mode 100644 index 2204953..0000000 --- a/util-vserver/lib/syscall_netadd-net.hc +++ /dev/null @@ -1,32 +0,0 @@ -// $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 -#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); -} diff --git a/util-vserver/lib/syscall_netadd.c b/util-vserver/lib/syscall_netadd.c deleted file mode 100644 index 1619e19..0000000 --- a/util-vserver/lib/syscall_netadd.c +++ /dev/null @@ -1,42 +0,0 @@ -// $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 -#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 diff --git a/util-vserver/lib/syscall_netcreate-net.hc b/util-vserver/lib/syscall_netcreate-net.hc deleted file mode 100644 index 1ce4cd0..0000000 --- a/util-vserver/lib/syscall_netcreate-net.hc +++ /dev/null @@ -1,29 +0,0 @@ -// $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 -#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); -} diff --git a/util-vserver/lib/syscall_netcreate.c b/util-vserver/lib/syscall_netcreate.c deleted file mode 100644 index c72e1b4..0000000 --- a/util-vserver/lib/syscall_netcreate.c +++ /dev/null @@ -1,37 +0,0 @@ -// $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 -#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 diff --git a/util-vserver/lib/syscall_netmigrate-net.hc b/util-vserver/lib/syscall_netmigrate-net.hc deleted file mode 100644 index 833f396..0000000 --- a/util-vserver/lib/syscall_netmigrate-net.hc +++ /dev/null @@ -1,27 +0,0 @@ -// $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 -#endif - -static inline ALWAYSINLINE int -vc_net_migrate_net(nid_t nid) -{ - return vserver(VCMD_net_migrate, NID_USER2KERNEL(nid), 0); -} diff --git a/util-vserver/lib/syscall_netmigrate.c b/util-vserver/lib/syscall_netmigrate.c deleted file mode 100644 index 0649636..0000000 --- a/util-vserver/lib/syscall_netmigrate.c +++ /dev/null @@ -1,37 +0,0 @@ -// $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 -#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 diff --git a/util-vserver/lib/syscall_netremove-net.hc b/util-vserver/lib/syscall_netremove-net.hc deleted file mode 100644 index 5139f0f..0000000 --- a/util-vserver/lib/syscall_netremove-net.hc +++ /dev/null @@ -1,32 +0,0 @@ -// $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 -#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); -} diff --git a/util-vserver/lib/syscall_netremove.c b/util-vserver/lib/syscall_netremove.c deleted file mode 100644 index c588432..0000000 --- a/util-vserver/lib/syscall_netremove.c +++ /dev/null @@ -1,42 +0,0 @@ -// $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 -#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 diff --git a/util-vserver/lib/syscall_rlimit-v11.hc b/util-vserver/lib/syscall_rlimit-v11.hc deleted file mode 100644 index b42bb13..0000000 --- a/util-vserver/lib/syscall_rlimit-v11.hc +++ /dev/null @@ -1,75 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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 -#endif - -#define KERN2USR(LIMIT) \ - (((LIMIT)==CRLIM_INFINITY) ? VC_LIM_INFINITY : \ - ((LIMIT)==CRLIM_KEEP) ? VC_LIM_KEEP : (LIMIT)) - -#define USR2KERN(LIMIT) \ - (((LIMIT)==VC_LIM_INFINITY) ? CRLIM_INFINITY : \ - ((LIMIT)==VC_LIM_KEEP) ? CRLIM_KEEP : (LIMIT)) - -static inline ALWAYSINLINE int -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 = vserver(VCMD_get_rlimit, CTX_USER2KERNEL(ctx), &vc_lim); - lim->min = KERN2USR(vc_lim.minimum); - lim->soft = KERN2USR(vc_lim.softlimit); - lim->hard = KERN2USR(vc_lim.maximum); - - return rc; -} - -static inline ALWAYSINLINE int -vc_set_rlimit_v11(xid_t ctx, int resource, struct vc_rlimit const *lim) -{ - struct vcmd_ctx_rlimit_v0 vc_lim; - - vc_lim.id = resource; - vc_lim.minimum = USR2KERN(lim->min); - vc_lim.softlimit = USR2KERN(lim->soft); - vc_lim.maximum = USR2KERN(lim->hard); - - return vserver(VCMD_set_rlimit, CTX_USER2KERNEL(ctx), &vc_lim); -} - -static inline ALWAYSINLINE int -vc_get_rlimit_mask_v11(xid_t ctx, int UNUSED tmp, struct vc_rlimit_mask *lim) -{ - struct vcmd_ctx_rlimit_mask_v0 vc_lim; - int rc; - - rc = vserver(VCMD_get_rlimit_mask, CTX_USER2KERNEL(ctx), &vc_lim); - - lim->min = vc_lim.minimum; - lim->soft = vc_lim.softlimit; - lim->hard = vc_lim.maximum; - - return rc; -} - -#undef KERN2USR -#undef USR2KERN diff --git a/util-vserver/lib/syscall_rlimit.c b/util-vserver/lib/syscall_rlimit.c deleted file mode 100644 index c3f75a5..0000000 --- a/util-vserver/lib/syscall_rlimit.c +++ /dev/null @@ -1,69 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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 -#endif -#include "compat.h" - -#include "vserver.h" -#include "internal.h" -#include "linuxvirtual.h" - - -#include "vserver-internal.h" - -#if defined(VC_ENABLE_API_V11) || defined(VC_ENABLE_API_V13) -# include "syscall_rlimit-v11.hc" -#endif - -#ifdef VC_ENABLE_API_V13 -# define vc_get_rlimit_v13 vc_get_rlimit_v11 -# define vc_set_rlimit_v13 vc_set_rlimit_v11 -# define vc_get_rlimit_mask_v13 vc_get_rlimit_mask_v11 -#endif - - -#if defined(VC_ENABLE_API_V11) || defined(VC_ENABLE_API_V13) - - // NOTICE: the reverse order of V11 -> V13 is correct here since these are - // the same syscalls - -int -vc_get_rlimit(xid_t ctx, int resource, struct vc_rlimit *lim) -{ - CALL_VC(CALL_VC_V11(vc_get_rlimit, ctx, resource, lim), - CALL_VC_V13(vc_get_rlimit, ctx, resource, lim)); -} - -int -vc_set_rlimit(xid_t ctx, int resource, struct vc_rlimit const *lim) -{ - CALL_VC(CALL_VC_V11(vc_set_rlimit, ctx, resource, lim), - CALL_VC_V13(vc_set_rlimit, ctx, resource, lim)); -} - -int -vc_get_rlimit_mask(xid_t ctx, struct vc_rlimit_mask *lim) -{ - CALL_VC(CALL_VC_V11(vc_get_rlimit_mask, ctx, 0, lim), - CALL_VC_V13(vc_get_rlimit_mask, ctx, 0, lim)); -} - - -#endif diff --git a/util-vserver/lib/syscall_setccaps-v13.hc b/util-vserver/lib/syscall_setccaps-v13.hc deleted file mode 100644 index b318182..0000000 --- a/util-vserver/lib/syscall_setccaps-v13.hc +++ /dev/null @@ -1,33 +0,0 @@ -// $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 -#endif - -static inline ALWAYSINLINE int -vc_set_ccaps_v13(xid_t xid, struct vc_ctx_caps const *caps) -{ - struct vcmd_ctx_caps_v0 k_caps; - - k_caps.bcaps = caps->bcaps & caps->bmask; - k_caps.ccaps = caps->ccaps; - k_caps.cmask = caps->cmask; - - return vserver(VCMD_set_ccaps, CTX_USER2KERNEL(xid), &k_caps); -} diff --git a/util-vserver/lib/syscall_setccaps.c b/util-vserver/lib/syscall_setccaps.c deleted file mode 100644 index f8691df..0000000 --- a/util-vserver/lib/syscall_setccaps.c +++ /dev/null @@ -1,42 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "vserver-internal.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_V13) -# include "syscall_setccaps-v13.hc" -#endif - -#if defined(VC_ENABLE_API_V13) -int -vc_set_ccaps(xid_t xid, struct vc_ctx_caps const *caps) -{ - if (caps==0) { - errno = EFAULT; - return -1; - } - - CALL_VC(CALL_VC_V13A(vc_set_ccaps, xid, caps)); -} -#endif diff --git a/util-vserver/lib/syscall_setcflags-v13.hc b/util-vserver/lib/syscall_setcflags-v13.hc deleted file mode 100644 index 1a79f7f..0000000 --- a/util-vserver/lib/syscall_setcflags-v13.hc +++ /dev/null @@ -1,37 +0,0 @@ -// $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 -#endif - -static inline ALWAYSINLINE int -vc_set_cflags_v13(xid_t xid, struct vc_ctx_flags const *flags) -{ - struct vcmd_ctx_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_cflags, CTX_USER2KERNEL(xid), &k_flags); -} diff --git a/util-vserver/lib/syscall_setcflags.c b/util-vserver/lib/syscall_setcflags.c deleted file mode 100644 index baafcae..0000000 --- a/util-vserver/lib/syscall_setcflags.c +++ /dev/null @@ -1,42 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "vserver-internal.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_V13) -# include "syscall_setcflags-v13.hc" -#endif - -#if defined(VC_ENABLE_API_V13) -int -vc_set_cflags(xid_t xid, struct vc_ctx_flags const *flags) -{ - if (flags==0) { - errno = EFAULT; - return -1; - } - - CALL_VC(CALL_VC_V13A(vc_set_cflags, xid, flags)); -} -#endif diff --git a/util-vserver/lib/syscall_setiattr-fscompat.hc b/util-vserver/lib/syscall_setiattr-fscompat.hc deleted file mode 100644 index 820db95..0000000 --- a/util-vserver/lib/syscall_setiattr-fscompat.hc +++ /dev/null @@ -1,86 +0,0 @@ -// $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 -#endif - -#include "ioctl-setext2flags.hc" -#include "ioctl-setfilecontext.hc" -#include "ioctl-setxflg.hc" -#include "ioctl-getxflg.hc" - -#include - -static inline ALWAYSINLINE int -vc_set_iattr_fscompat(char const *filename, - xid_t xid, - uint32_t flags, uint32_t mask) -{ - int fd; - struct stat st; - int stat_rc; - - fd = open(filename, O_RDONLY); - if (fd==-1) return -1; - - stat_rc = fstat(fd, &st); - if (stat_rc==-1) goto err; - - if ( (mask&VC_IATTR_IUNLINK) ) { - unsigned int const tmp = VC_IMMUTABLE_FILE_FL|VC_IMMUTABLE_LINK_FL; - if (vc_X_set_ext2flags(fd, - (flags&VC_IATTR_IUNLINK) ? tmp : 0, - (flags&VC_IATTR_IUNLINK) ? 0 : tmp)==-1) - goto err; - } - - if ( (mask&VC_IATTR_BARRIER) ) { - mode_t m = ((flags&VC_IATTR_BARRIER) ? 0 : - st.st_mode ? st.st_mode : 0500); - - if (fchmod(fd, m)==-1) - goto err; - } - - if ( (mask&VC_IATTR_XID) && - vc_X_set_filecontext(fd, xid)==-1) - goto err; - - if ( (mask&(VC_IATTR_HIDE|VC_IATTR_WATCH)) ) { - long tmp; - if (vc_X_get_xflg(fd, &tmp)==-1) goto err; - - tmp &= ~( ((mask&VC_IATTR_HIDE) ? 1 : 0) | - ((mask&VC_IATTR_WATCH) ? 2 : 0) ); - tmp |= ( ((flags&VC_IATTR_HIDE) ? 1 : 0) | - ((flags&VC_IATTR_WATCH) ? 2 : 0) ); - - if (vc_X_set_xflg(fd, tmp)==-1) goto err; - } - - close(fd); - return 0; - err: - { - int old_errno = errno; - close(fd); - errno = old_errno; - return -1; - } -} diff --git a/util-vserver/lib/syscall_setiattr-v13.hc b/util-vserver/lib/syscall_setiattr-v13.hc deleted file mode 100644 index bc59643..0000000 --- a/util-vserver/lib/syscall_setiattr-v13.hc +++ /dev/null @@ -1,35 +0,0 @@ -// $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 -#endif - -#include "vserver.h" - -static inline ALWAYSINLINE int -vc_set_iattr_v13(char const *filename, xid_t xid, uint32_t flags, uint32_t mask) -{ - struct vcmd_ctx_iattr_v1 attr; - - attr.name = filename; - attr.xid = CTX_USER2KERNEL(xid); - attr.flags = flags; - attr.mask = mask; - return vserver(VCMD_set_iattr, 0, &attr); -} diff --git a/util-vserver/lib/syscall_setiattr.c b/util-vserver/lib/syscall_setiattr.c deleted file mode 100644 index 5c7a53c..0000000 --- a/util-vserver/lib/syscall_setiattr.c +++ /dev/null @@ -1,44 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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 -#endif - -#include "vserver.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_FSCOMPAT) && defined(VC_ENABLE_API_V13) -# define VC_MULTIVERSION_SYSCALL 1 -#endif -#include "vserver-internal.h" - -#ifdef VC_ENABLE_API_V13 -# include "syscall_setiattr-v13.hc" -#endif - -#ifdef VC_ENABLE_API_FSCOMPAT -# include "syscall_setiattr-fscompat.hc" -#endif - -int -vc_set_iattr(char const *filename, xid_t xid, uint32_t flags, uint32_t mask) -{ - CALL_VC(CALL_VC_V13 (vc_set_iattr, filename, xid, flags, mask), - CALL_VC_FSCOMPAT(vc_set_iattr, filename, xid, flags, mask)); -} diff --git a/util-vserver/lib/syscall_setnamespace-v13.hc b/util-vserver/lib/syscall_setnamespace-v13.hc deleted file mode 100644 index 04fec90..0000000 --- a/util-vserver/lib/syscall_setnamespace-v13.hc +++ /dev/null @@ -1,29 +0,0 @@ -// $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 -#endif - -#include "vserver.h" - -static inline ALWAYSINLINE int -vc_set_namespace_v13(int UNUSED tmp) -{ - return vserver(VCMD_set_namespace, 0, 0); -} diff --git a/util-vserver/lib/syscall_setnamespace.c b/util-vserver/lib/syscall_setnamespace.c deleted file mode 100644 index fc38889..0000000 --- a/util-vserver/lib/syscall_setnamespace.c +++ /dev/null @@ -1,36 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "linuxvirtual.h" - -#include "vserver-internal.h" - -#ifdef VC_ENABLE_API_V13 -# include "syscall_setnamespace-v13.hc" -#endif - -int -vc_set_namespace() -{ - CALL_VC(CALL_VC_V13(vc_set_namespace,0)); -} diff --git a/util-vserver/lib/syscall_setncaps-net.hc b/util-vserver/lib/syscall_setncaps-net.hc deleted file mode 100644 index 70596dc..0000000 --- a/util-vserver/lib/syscall_setncaps-net.hc +++ /dev/null @@ -1,32 +0,0 @@ -// $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 -#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); -} diff --git a/util-vserver/lib/syscall_setncaps.c b/util-vserver/lib/syscall_setncaps.c deleted file mode 100644 index 3b67004..0000000 --- a/util-vserver/lib/syscall_setncaps.c +++ /dev/null @@ -1,42 +0,0 @@ -// $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 -#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 diff --git a/util-vserver/lib/syscall_setnflags-net.hc b/util-vserver/lib/syscall_setnflags-net.hc deleted file mode 100644 index 69f041d..0000000 --- a/util-vserver/lib/syscall_setnflags-net.hc +++ /dev/null @@ -1,37 +0,0 @@ -// $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 -#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); -} diff --git a/util-vserver/lib/syscall_setnflags.c b/util-vserver/lib/syscall_setnflags.c deleted file mode 100644 index df40f0c..0000000 --- a/util-vserver/lib/syscall_setnflags.c +++ /dev/null @@ -1,42 +0,0 @@ -// $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 -#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 diff --git a/util-vserver/lib/syscall_setsched-v13.hc b/util-vserver/lib/syscall_setsched-v13.hc deleted file mode 100644 index 7fa74aa..0000000 --- a/util-vserver/lib/syscall_setsched-v13.hc +++ /dev/null @@ -1,38 +0,0 @@ -// $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 -#endif - -#include "vserver.h" - -static inline ALWAYSINLINE int -vc_set_sched_v13(xid_t xid, struct vc_set_sched const *data) -{ - struct vcmd_set_sched_v2 k_data; - - k_data.fill_rate = data->fill_rate; - k_data.interval = data->interval; - k_data.tokens = data->tokens; - k_data.tokens_min = data->tokens_min; - k_data.tokens_max = data->tokens_max; - k_data.cpu_mask = data->cpu_mask; - - return vserver(VCMD_set_sched, CTX_USER2KERNEL(xid), &k_data); -} diff --git a/util-vserver/lib/syscall_setsched.c b/util-vserver/lib/syscall_setsched.c deleted file mode 100644 index 7149f49..0000000 --- a/util-vserver/lib/syscall_setsched.c +++ /dev/null @@ -1,36 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "linuxvirtual.h" - -#include "vserver-internal.h" - -#ifdef VC_ENABLE_API_V13 -# include "syscall_setsched-v13.hc" -#endif - -int -vc_set_sched(xid_t xid, struct vc_set_sched const *data) -{ - CALL_VC(CALL_VC_V13(vc_set_sched,xid,data)); -} diff --git a/util-vserver/lib/syscall_setvhiname-olduts.hc b/util-vserver/lib/syscall_setvhiname-olduts.hc deleted file mode 100644 index 4dd6821..0000000 --- a/util-vserver/lib/syscall_setvhiname-olduts.hc +++ /dev/null @@ -1,38 +0,0 @@ -// $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 -#endif - -static inline ALWAYSINLINE int -vc_set_vhi_name_olduts(xid_t xid, vc_uts_type type, char const *val, size_t len) -{ - if (xid!=VC_SAMECTX) { - errno = ESRCH; - return -1; - } - - switch (type) { - case vcVHI_NODENAME : return sethostname (val, len); - case vcVHI_DOMAINNAME : return setdomainname(val, len); - default : - errno = ENOENT; - return -1; - } -} diff --git a/util-vserver/lib/syscall_setvhiname-v13.hc b/util-vserver/lib/syscall_setvhiname-v13.hc deleted file mode 100644 index 4bee1ba..0000000 --- a/util-vserver/lib/syscall_setvhiname-v13.hc +++ /dev/null @@ -1,43 +0,0 @@ -// $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 -#endif - -#include - -static inline ALWAYSINLINE int -vc_set_vhi_name_v13(xid_t xid, vc_uts_type type, char const *val, size_t len) -{ - struct vcmd_vx_vhi_name_v0 cmd; - int rc; - - if (len>=sizeof(cmd.name)) { - errno = E2BIG; - return -1; - } - - cmd.field = VHI_USER2KERNEL(type); - strncpy(cmd.name, val, sizeof(cmd.name)); - - rc = vserver(VCMD_vx_set_vhi_name, CTX_USER2KERNEL(xid), &cmd); - ENSC_FIX_IOCTL(rc); - - return rc; -} diff --git a/util-vserver/lib/syscall_setvhiname.c b/util-vserver/lib/syscall_setvhiname.c deleted file mode 100644 index f00f20b..0000000 --- a/util-vserver/lib/syscall_setvhiname.c +++ /dev/null @@ -1,46 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include "linuxvirtual.h" - -#if defined(VC_ENABLE_API_OLDUTS) && defined(VC_ENABLE_API_V13) -# define VC_MULTIVERSION_SYSCALL 1 -#endif -#include "vserver-internal.h" - -#ifdef VC_ENABLE_API_V13 -# include "syscall_setvhiname-v13.hc" -#endif - -#ifdef VC_ENABLE_API_OLDUTS -# include "syscall_setvhiname-olduts.hc" -#endif - -int -vc_set_vhi_name(xid_t xid, vc_uts_type type, char const *val, size_t len) -{ - if (len==(size_t)(-1)) len=strlen(val); - - CALL_VC(CALL_VC_V13 (vc_set_vhi_name, xid, type, val, len), - CALL_VC_OLDUTS(vc_set_vhi_name, xid, type, val, len)); -} diff --git a/util-vserver/lib/testsuite/.cvsignore b/util-vserver/lib/testsuite/.cvsignore deleted file mode 100644 index 252ed5e..0000000 --- a/util-vserver/lib/testsuite/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -.deps -.dirstamp -.gdb_history -.libs -cflags -flags -fmt -parselimit diff --git a/util-vserver/lib/testsuite/Makefile-files b/util-vserver/lib/testsuite/Makefile-files deleted file mode 100644 index 8896e76..0000000 --- a/util-vserver/lib/testsuite/Makefile-files +++ /dev/null @@ -1,41 +0,0 @@ -## $Id$ --*- makefile -*-- - -## 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. - -DIETPROGS += lib/testsuite/cflags \ - lib/testsuite/fmt - -check_PROGRAMS += lib/testsuite/cflags \ - lib/testsuite/fmt \ - lib/testsuite/parselimit -TESTS += lib/testsuite/cflags \ - lib/testsuite/fmt \ - lib/testsuite/parselimit - -lib_testsuite_cflags_SOURCES = lib/testsuite/cflags.c -lib_testsuite_cflags_LDADD = lib/libvserver.la -lib_testsuite_cflags_LDFLAGS = $(VSERVER_LDFLAGS) -lib_testsuite_cflags_CPPFLAGS = $(AM_CPPFLAGS) -DENSC_TESTSUITE - -lib_testsuite_fmt_SOURCES = lib/testsuite/fmt.c -lib_testsuite_fmt_LDADD = lib/libvserver.la -lib_testsuite_fmt_LDFLAGS = $(VSERVER_LDFLAGS) -lib_testsuite_fmt_CPPFLAGS = $(AM_CPPFLAGS) -DENSC_TESTSUITE - -lib_testsuite_parselimit_SOURCES = lib/testsuite/parselimit.c -lib_testsuite_parselimit_LDADD = lib/libvserver.la -lib_testsuite_parselimit_LDFLAGS = $(VSERVER_LDFLAGS) -lib_testsuite_parselimit_CPPFLAGS = $(AM_CPPFLAGS) -DENSC_TESTSUITE diff --git a/util-vserver/lib/testsuite/cflags.c b/util-vserver/lib/testsuite/cflags.c deleted file mode 100644 index 897def8..0000000 --- a/util-vserver/lib/testsuite/cflags.c +++ /dev/null @@ -1,199 +0,0 @@ -// $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 -#endif - -#include "lib_internal/coreassert.h" -#include "vserver.h" - -#include -#include - - -#define TEST_T2F_C(X,Y,Z) assert(vc_text2cflag_compat(X,Y)==Z) -#define TEST_F2T_C(Y,X) { \ - char const *x=vc_hicflag2text_compat(X); \ - assert((x==0 && Y==0) || (x!=0 && Y!=0)); \ - if (x!=0 && Y!=0) assert(strcmp(x, Y)==0); \ - } - -#define TEST_LIST_C(STR,LEN,EXP,ERR_POS,ERR_LEN) { \ - struct vc_err_listparser err; \ - char buf[] = STR; \ - uint32_t res; \ - res = vc_list2cflag_compat(buf, LEN, &err); \ - assert(res==(EXP)); \ - assert(err.len==ERR_LEN); \ - if (ERR_POS==-1) assert(err.ptr==0); \ - else assert(err.ptr==buf+(ERR_POS)); \ - } - -//---- - -#define TEST_T2F(X,Y,Z) assert(vc_text2cflag(X,Y)==Z) -#define TEST_F2T(Y,X) { \ - uint_least64_t x = (X); \ - char const *rc=vc_locflag2text(&x); \ - assert((rc==0 && Y==0) || (rc!=0 && Y!=0)); \ - if (rc!=0 && Y!=0) assert(strcmp(rc, Y)==0); \ - } -#define TEST_LIST(STR,LEN,EXP_RES,EXP_FLAG,EXP_MASK,ERR_POS,ERR_LEN) { \ - struct vc_err_listparser err; \ - char buf[] = STR; \ - volatile int res; \ - struct vc_ctx_flags flags = {0,0}; \ - res = vc_list2cflag(buf, LEN, &err, &flags); \ - assert(res==(EXP_RES)); \ - assert(flags.flagword==(uint_least64_t)(EXP_FLAG)); \ - assert(flags.mask ==(uint_least64_t)(EXP_MASK)); \ - assert(err.len==ERR_LEN); \ - if (ERR_POS==-1) assert(err.ptr==0); \ - else assert(err.ptr==buf+(ERR_POS)); \ - } - -#define ALL64 (~(uint_least64_t)(0)) - -int main() -{ - TEST_T2F_C("lock", 0, S_CTX_INFO_LOCK); - TEST_T2F_C("lockXXXX", 4, S_CTX_INFO_LOCK); - TEST_T2F_C("locXXXXX", 3, 0); - TEST_T2F_C("sched", 0, S_CTX_INFO_SCHED); - TEST_T2F_C("nproc", 0, S_CTX_INFO_NPROC); - TEST_T2F_C("private", 0, S_CTX_INFO_PRIVATE); - TEST_T2F_C("fakeinit", 0, S_CTX_INFO_INIT); - TEST_T2F_C("hideinfo", 0, S_CTX_INFO_HIDEINFO); - TEST_T2F_C("ulimit", 0, S_CTX_INFO_ULIMIT); - TEST_T2F_C("XXX", 0, 0); - TEST_T2F_C("", 0, 0); - - TEST_F2T_C("lock", S_CTX_INFO_LOCK); - TEST_F2T_C("sched", S_CTX_INFO_SCHED); - TEST_F2T_C("nproc", S_CTX_INFO_NPROC); - TEST_F2T_C("private", S_CTX_INFO_PRIVATE); - TEST_F2T_C("fakeinit", S_CTX_INFO_INIT); - TEST_F2T_C("hideinfo", S_CTX_INFO_HIDEINFO); - TEST_F2T_C("ulimit", S_CTX_INFO_ULIMIT); - TEST_F2T_C(0, 0); - TEST_F2T_C("ulimit", 64 | 128 | 23 ); - TEST_F2T_C("fakeinit", 23); - - TEST_LIST_C("lock", 0, S_CTX_INFO_LOCK, -1,0); - TEST_LIST_C("lock,sched,", 0, S_CTX_INFO_LOCK|S_CTX_INFO_SCHED, -1,0); - TEST_LIST_C("lock,XXX", 0, S_CTX_INFO_LOCK, 5,3); - TEST_LIST_C("", 0, 0, -1,0); - TEST_LIST_C("X", 0, 0, 0,1); - TEST_LIST_C("lock,sched,", 10, S_CTX_INFO_LOCK|S_CTX_INFO_SCHED, -1,0); - - //------- - - TEST_T2F("fakeinit", 0, VC_VXF_INFO_INIT); - TEST_T2F("XXX", 0, 0); - TEST_T2F("", 0, 0); - - TEST_F2T("fakeinit", VC_VXF_INFO_INIT); - TEST_F2T(0, 0); - - TEST_LIST("fakeinit", 0, 0, VC_VXF_INFO_INIT, VC_VXF_INFO_INIT,-1,0); - TEST_LIST("FaKeInIt", 0, 0, VC_VXF_INFO_INIT, VC_VXF_INFO_INIT,-1,0); - TEST_LIST("~fakeinit", 0, 0, 0, VC_VXF_INFO_INIT,-1,0); - TEST_LIST("!fakeinit", 0, 0, 0, VC_VXF_INFO_INIT,-1,0); - TEST_LIST("fakeinit,XXX", 0, -1, VC_VXF_INFO_INIT, VC_VXF_INFO_INIT, 9,3); - TEST_LIST("", 0, 0, 0, 0, -1,0); - TEST_LIST("0", 0, 0, 0, 0, -1,0); - TEST_LIST("00", 0, 0, 0, 0, -1,0); - TEST_LIST("X", 0, -1, 0, 0, 0,1); - TEST_LIST("all", 0, 0, ALL64, ALL64, -1,0); - TEST_LIST("ALL", 0, 0, ALL64, ALL64, -1,0); - TEST_LIST("any", 0, 0, ALL64, ALL64, -1,0); - TEST_LIST("ANY", 0, 0, ALL64, ALL64, -1,0); - TEST_LIST("~all", 0, 0, 0, ALL64, -1,0); - TEST_LIST("~ALL", 0, 0, 0, ALL64, -1,0); - TEST_LIST("none", 0, 0, 0, 0, -1,0); - TEST_LIST("NONE", 0, 0, 0, 0, -1,0); - TEST_LIST("~none", 0, 0, 0, 0, -1,0); - TEST_LIST("~NONE", 0, 0, 0, 0, -1,0); - TEST_LIST("all,~fakeinit",0, 0, ~VC_VXF_INFO_INIT,ALL64, -1,0); - TEST_LIST("~all,fakeinit",0, 0, VC_VXF_INFO_INIT, ALL64, -1,0); - TEST_LIST("fakeinit,~all",0, 0, 0, ALL64, -1,0); - TEST_LIST("none,~lock", 0, 0, 0, VC_VXF_INFO_LOCK,-1,0); - TEST_LIST("~none,lock", 0, 0, VC_VXF_INFO_LOCK,VC_VXF_INFO_LOCK,-1,0); - TEST_LIST("lock,none", 0, 0, VC_VXF_INFO_LOCK,VC_VXF_INFO_LOCK,-1,0); - TEST_LIST("lock,~none", 0, 0, VC_VXF_INFO_LOCK,VC_VXF_INFO_LOCK,-1,0); - TEST_LIST("~", 0, -1, 0, 0, 1,0); - TEST_LIST("~~", 0, -1, 0, 0, 2,0); - TEST_LIST("!", 0, -1, 0, 0, 1,0); - TEST_LIST("^", 0, -1, 0, 0, 1,0); - TEST_LIST("fakeinit,~", 0, -1, VC_VXF_INFO_INIT, VC_VXF_INFO_INIT,10,0); - TEST_LIST("1", 0, 0, 1, 1, -1,0); - TEST_LIST("1,23,42", 0, 0, 1|23|42, 1|23|42, -1,0); - TEST_LIST("~1", 0, 0, 0, 1, -1,0); - TEST_LIST("!1", 0, 0, 0, 1, -1,0); - TEST_LIST("~~1", 0, 0, 1, 1, -1,0); - TEST_LIST("~~~1", 0, 0, 0, 1, -1,0); - TEST_LIST("~!~1", 0, 0, 0, 1, -1,0); - TEST_LIST("42,fakeinit", 0, 0, VC_VXF_INFO_INIT|42, VC_VXF_INFO_INIT|42, -1,0); - TEST_LIST("42x,1", 0, -1, 0, 0, 0,3); - - TEST_LIST("^4,~^2", 0, 0, 0x10, 0x14, -1,0); - TEST_LIST("^4,~~^2", 0, 0, 0x14, 0x14, -1,0); - TEST_LIST("^4,~~~^2", 0, 0, 0x10, 0x14, -1,0); - TEST_LIST("~^2,^4", 0, 0, 0x10, 0x14, -1,0); - TEST_LIST("1,^1,~^2,8", 0, 0, 0x0b, 0x0f, -1,0); - - TEST_LIST("lock,nproc,private,fakeinit,hideinfo,ulimit,namespace," - "sched_hard,sched_prio,sched_pause," - "virt_mem,virt_uptime,virt_cpu," - "hide_mount,hide_netif,state_setup,state_init", - 0, 0, - VC_VXF_INFO_LOCK|VC_VXF_INFO_NPROC|VC_VXF_INFO_PRIVATE|VC_VXF_INFO_INIT| - VC_VXF_INFO_HIDEINFO|VC_VXF_INFO_ULIMIT|VC_VXF_INFO_NAMESPACE| - VC_VXF_SCHED_HARD|VC_VXF_SCHED_PRIO|VC_VXF_SCHED_PAUSE| - VC_VXF_VIRT_MEM|VC_VXF_VIRT_UPTIME|VC_VXF_VIRT_CPU| - VC_VXF_HIDE_MOUNT|VC_VXF_HIDE_NETIF| - VC_VXF_STATE_SETUP|VC_VXF_STATE_INIT, - - VC_VXF_INFO_LOCK|VC_VXF_INFO_NPROC|VC_VXF_INFO_PRIVATE|VC_VXF_INFO_INIT| - VC_VXF_INFO_HIDEINFO|VC_VXF_INFO_ULIMIT|VC_VXF_INFO_NAMESPACE| - VC_VXF_SCHED_HARD|VC_VXF_SCHED_PRIO|VC_VXF_SCHED_PAUSE| - VC_VXF_VIRT_MEM|VC_VXF_VIRT_UPTIME|VC_VXF_VIRT_CPU| - VC_VXF_HIDE_MOUNT|VC_VXF_HIDE_NETIF| - VC_VXF_STATE_SETUP|VC_VXF_STATE_INIT, - - -1,0); - - TEST_LIST("~lock,~nproc,~private,~fakeinit,~hideinfo,~ulimit,~namespace," - "~sched_hard,~sched_prio,~sched_pause," - "~virt_mem,~virt_uptime,~virt_cpu," - "~hide_mount,~hide_netif,~state_setup,~state_init", - 0, 0, - 0, - VC_VXF_INFO_LOCK|VC_VXF_INFO_NPROC|VC_VXF_INFO_PRIVATE|VC_VXF_INFO_INIT| - VC_VXF_INFO_HIDEINFO|VC_VXF_INFO_ULIMIT|VC_VXF_INFO_NAMESPACE| - VC_VXF_SCHED_HARD|VC_VXF_SCHED_PRIO|VC_VXF_SCHED_PAUSE| - VC_VXF_VIRT_MEM|VC_VXF_VIRT_UPTIME|VC_VXF_VIRT_CPU| - VC_VXF_HIDE_MOUNT|VC_VXF_HIDE_NETIF| - VC_VXF_STATE_SETUP|VC_VXF_STATE_INIT, - - -1,0); - - - return 0; -} diff --git a/util-vserver/lib/testsuite/fmt.c b/util-vserver/lib/testsuite/fmt.c deleted file mode 100644 index 356067a..0000000 --- a/util-vserver/lib/testsuite/fmt.c +++ /dev/null @@ -1,52 +0,0 @@ -// $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 -#endif - -#include "lib_internal/coreassert.h" - -#include "lib/fmt.h" -#include - -#define TEST(VAL, EXP) { \ - char buf[512]; \ - size_t l; \ - memset(buf, '\23', sizeof buf); \ - l = FUNC(buf+1, VAL); \ - assert(l==sizeof(EXP)-1); \ - assert(memcmp(buf+1, EXP, l)==0); \ - assert(buf[l+1]=='\23'); \ - } - -int main() -{ - #define FUNC utilvserver_fmt_xuint64 - TEST(0, "0"); - TEST(1, "1"); - TEST(15, "f"); - TEST(16, "10"); - TEST(100, "64"); - TEST(1000, "3e8"); - TEST(65535, "ffff"); - TEST(65536, "10000"); - TEST(68719476736ul, "1000000000"); - - return 0; -} diff --git a/util-vserver/lib/testsuite/parselimit.c b/util-vserver/lib/testsuite/parselimit.c deleted file mode 100644 index c6611d9..0000000 --- a/util-vserver/lib/testsuite/parselimit.c +++ /dev/null @@ -1,54 +0,0 @@ -// $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 -#endif - -#include "lib_internal/coreassert.h" -#include "vserver.h" - -#define TEST(BUF, RES, VAL) \ - do { \ - vc_limit_t res = 0xdeadbeaf; \ - assert(vc_parseLimit(BUF, &res)==(RES)); \ - assert(res==(VAL)); \ - } while (0) - -#define TESTT(BUF,VAL) TEST(BUF, true, VAL) -#define TESTF(BUF,VAL) TEST(BUF, false, VAL) - -int main() -{ - TESTT("0", 0); - TESTT("1", 1); - TESTT("1k", 1000); - TESTT("1K", 1024); - TESTT("1m", 1000000); - TESTT("1M", 1048576); - TESTT("1234", 1234); - TESTT("1234\n", 1234); - TESTT("inf", VC_LIM_INFINITY); - - TESTF("x", 0); - TESTF("k", 0); - TESTF("1kX", 1000); - TESTF("", 0); - - return EXIT_SUCCESS; -} diff --git a/util-vserver/lib/util-vserver.pc.subst b/util-vserver/lib/util-vserver.pc.subst deleted file mode 100644 index fcb5ae8..0000000 --- a/util-vserver/lib/util-vserver.pc.subst +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: @PACKAGE@ -Description: vserver libraries -Version: @VERSION@ -Requires: -Libs: @libflags@-lvserver -Cflags: @incflags@ diff --git a/util-vserver/lib/utils-legacy.h b/util-vserver/lib/utils-legacy.h deleted file mode 100644 index f162431..0000000 --- a/util-vserver/lib/utils-legacy.h +++ /dev/null @@ -1,39 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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. - - -#ifndef H_UTIL_VSERVER_LIB_UTILS_COMPAT_H -#define H_UTIL_VSERVER_LIB_UTILS_COMPAT_H - -#include -#include - - // read /proc//status into 'buf' which has the size bufsize. When 'str' - // is non-null, search this string and return a pointer *after* it. When no - // such string could be found, return 0. When 'str' is null return 'buf'. - // - // When this function fails (result==0) and errno is EAGAIN, the buffersize - // was too small and this function should be called again with a larger - // buffer. -char * utilvserver_getProcEntry(pid_t pid, char *str, - char *buf, size_t bufsize); - - // Returns the suggested buffersize for reading a /proc/.../status - // file. Return-value can change when utilvserver_getProcEntry() was called. -size_t utilvserver_getProcEntryBufsize(); - -#endif // H_UTIL_VSERVER_LIB_UTILS_COMPAT_H diff --git a/util-vserver/lib/val2text-t2v-uint32.c b/util-vserver/lib/val2text-t2v-uint32.c deleted file mode 100644 index da72ff5..0000000 --- a/util-vserver/lib/val2text-t2v-uint32.c +++ /dev/null @@ -1,26 +0,0 @@ -// $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 -#endif - -#include "internal.h" -#include "val2text.hc" - -TEXT2VAL(uint_least32_t, uint32) diff --git a/util-vserver/lib/val2text-t2v-uint64.c b/util-vserver/lib/val2text-t2v-uint64.c deleted file mode 100644 index 194fa62..0000000 --- a/util-vserver/lib/val2text-t2v-uint64.c +++ /dev/null @@ -1,26 +0,0 @@ -// $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 -#endif - -#include "internal.h" -#include "val2text.hc" - -TEXT2VAL(uint_least64_t, uint64) diff --git a/util-vserver/lib/val2text-v2t-uint32.c b/util-vserver/lib/val2text-v2t-uint32.c deleted file mode 100644 index 8c206de..0000000 --- a/util-vserver/lib/val2text-v2t-uint32.c +++ /dev/null @@ -1,26 +0,0 @@ -// $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 -#endif - -#include "internal.h" -#include "val2text.hc" - -VAL2TEXT(uint_least32_t, uint32) diff --git a/util-vserver/lib/val2text-v2t-uint64.c b/util-vserver/lib/val2text-v2t-uint64.c deleted file mode 100644 index 5701ba0..0000000 --- a/util-vserver/lib/val2text-v2t-uint64.c +++ /dev/null @@ -1,26 +0,0 @@ -// $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 -#endif - -#include "internal.h" -#include "val2text.hc" - -VAL2TEXT(uint_least64_t, uint64) diff --git a/util-vserver/lib/val2text.hc b/util-vserver/lib/val2text.hc deleted file mode 100644 index ee42bb3..0000000 --- a/util-vserver/lib/val2text.hc +++ /dev/null @@ -1,76 +0,0 @@ -// $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 -#endif - -#include -#include -#include - -#define VAL2TEXT(TYPE,SHORT) \ - ssize_t \ - utilvserver_value2text_##SHORT(char const *str, size_t len, \ - struct Mapping_ ##SHORT const *map, \ - size_t map_len) \ - { \ - size_t i; \ - if (len==0) len=strlen(str); \ - \ - for (i=0; i -// -// 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. - - -#ifndef H_UTIL_VSERVER_LIB_VIRTUAL_H -#define H_UTIL_VSERVER_LIB_VIRTUAL_H - -#include -#include -#include -#include -#include -#include -#include - -#endif // H_UTIL_VSERVER_LIB_VIRTUAL_H diff --git a/util-vserver/lib/vserver-internal.h b/util-vserver/lib/vserver-internal.h deleted file mode 100644 index 02c5349..0000000 --- a/util-vserver/lib/vserver-internal.h +++ /dev/null @@ -1,216 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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 H_VSERVER_SYSCALL_INTERNAL_H -# error vserver-internal.h must not be included more than once -#endif - -#ifndef H_VSERVER_SYSCALL_INTERNAL_H -#define H_VSERVER_SYSCALL_INTERNAL_H - -#include -#include -#include -#include -#include -#include - -#include "internal.h" - -#if !defined(__NR_vserver) && defined(ENSC_SYSCALL__NR_vserver) -# define __NR_vserver ENSC_SYSCALL__NR_vserver -#endif - -#define VC_PREFIX 0) -#define VC_SUFFIX else (void)((void)0 -#define CALL_VC_NOOP (void)0 -#define CALL_VC_GENERAL(ID, SUFFIX, FUNC, ...) \ - VC_PREFIX; VC_SELECT(ID) return FUNC ## _ ## SUFFIX(__VA_ARGS__); VC_SUFFIX - -#ifdef VC_MULTIVERSION_SYSCALL -# define VC_SELECT(ID) if (ver>=(ID)) -# define CALL_VC(...) \ - do { \ - int ver = utilvserver_checkCompatVersion(); \ - if (ver==-1) return -1; \ - VC_SUFFIX, __VA_ARGS__, VC_PREFIX; \ - errno = ENOSYS; \ - return -1; \ - } while (0) -#else -# define VC_SELECT(ID) if (1) -# define CALL_VC(...) \ - do { \ - if (1) {} VC_SUFFIX, __VA_ARGS__, VC_PREFIX; \ - errno = ENOSYS; return -1; \ - } while (0) -#endif - -#ifdef VC_ENABLE_API_COMPAT -# define CALL_VC_COMPAT(F,...) CALL_VC_GENERAL(0x00010000, compat, F, __VA_ARGS__) -#else -# define CALL_VC_COMPAT(F,...) CALL_VC_NOOP -#endif - -#ifdef VC_ENABLE_API_LEGACY -# define CALL_VC_LEGACY(F,...) CALL_VC_GENERAL(0x00000000, legacy, F, __VA_ARGS__) -#else -# define CALL_VC_LEGACY(F,...) CALL_VC_NOOP -#endif - -#ifdef VC_ENABLE_API_V11 -# define CALL_VC_V11(F,...) CALL_VC_GENERAL(0x00010000, v11, F, __VA_ARGS__) -#else -# define CALL_VC_V11(F,...) CALL_VC_NOOP -#endif - -#ifdef VC_ENABLE_API_V13 -# define CALL_VC_V13(F,...) CALL_VC_GENERAL(0x00010011, v13, F, __VA_ARGS__) -#else -# define CALL_VC_V13(F,...) CALL_VC_NOOP -#endif - -#ifdef VC_ENABLE_API_V13 -# define CALL_VC_V13A(F,...) CALL_VC_GENERAL(0x00010012, v13, F, __VA_ARGS__) -#else -# 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 CALL_VC_FSCOMPAT(F,...) CALL_VC_NOOP -#endif - -#ifdef VC_ENABLE_API_OLDPROC -# define CALL_VC_OLDPROC(F,...) CALL_VC_GENERAL(0x00000000, oldproc, F, __VA_ARGS__) -#else -# define CALL_VC_OLDPROC(F,...) CALL_VC_NOOP -#endif - -#ifdef VC_ENABLE_API_OLDUTS -# define CALL_VC_OLDUTS(F,...) CALL_VC_GENERAL(0x00000000, olduts, F, __VA_ARGS__) -#else -# define CALL_VC_OLDUTS(F,...) CALL_VC_NOOP -#endif - - - // Some kernel <-> userspace wrappers; they should be noops in most cases - -#if 1 -# define CTX_KERNEL2USER(X) (((X)==(uint32_t)(-1)) ? VC_NOCTX : \ - ((X)==(uint32_t)(-2)) ? VC_SAMECTX : \ - (xid_t)(X)) - -# define CTX_USER2KERNEL(X) (((X)==VC_DYNAMIC_XID) ? (uint32_t)(-1) : \ - ((X)==VC_SAMECTX) ? (uint32_t)(-2) : \ - (uint32_t)(X)) -#else -# define CTX_USER2KERNEL(X) (X) -# define CTX_KERNEL2USER(X) (X) -#endif - -#if 1 -# define EXT2FLAGS_USER2KERNEL(X) (((X) & ~(VC_IMMUTABLE_FILE_FL|VC_IMMUTABLE_LINK_FL)) | \ - ((X) & VC_IMMUTABLE_FILE_FL ? EXT2_IMMUTABLE_FILE_FL : 0) | \ - ((X) & VC_IMMUTABLE_LINK_FL ? EXT2_IMMUTABLE_LINK_FL : 0)) -# define EXT2FLAGS_KERNEL2USER(X) (((X) & ~(EXT2_IMMUTABLE_FILE_FL|EXT2_IMMUTABLE_LINK_FL)) | \ - ((X) & EXT2_IMMUTABLE_FILE_FL ? VC_IMMUTABLE_FILE_FL : 0) | \ - ((X) & EXT2_IMMUTABLE_LINK_FL ? VC_IMMUTABLE_LINK_FL : 0)) -#else -# define EXT2FLAGS_KERNEL2USER(X) (X) -# define EXT2FLAGS_USER2KERNEL(X) (X) -#endif - -#if 1 -# define VHI_USER2KERNEL(X) ((((X)==vcVHI_CONTEXT) ? VHIN_CONTEXT : \ - ((X)==vcVHI_SYSNAME) ? VHIN_SYSNAME : \ - ((X)==vcVHI_NODENAME) ? VHIN_NODENAME : \ - ((X)==vcVHI_RELEASE) ? VHIN_RELEASE : \ - ((X)==vcVHI_VERSION) ? VHIN_VERSION : \ - ((X)==vcVHI_MACHINE) ? VHIN_MACHINE : \ - ((X)==vcVHI_DOMAINNAME) ? VHIN_DOMAINNAME : \ - (X))) -# define VHI_KERNEL2USER(X) ((((X)==VHIN_CONTEXT) ? vcVHI_CONTEXT : \ - ((X)==VHIN_SYSNAME) ? vcVHI_SYSNAME : \ - ((X)==VHIN_NODENAME) ? vcVHI_NODENAME : \ - ((X)==VHIN_RELEASE) ? vcVHI_RELEASE : \ - ((X)==VHIN_VERSION) ? vcVHI_VERSION : \ - ((X)==VHIN_MACHINE) ? vcVHI_MACHINE : \ - ((X)==VHIN_DOMAINNAME) ? vcVHI_DOMAINNAME : \ - (X))) -#else -# define VHI_USER2KERNEL(X) (X) -# 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) - -#ifndef HAVE_VSERVER -#ifdef ENSC_SYSCALL_TRADITIONAL -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 diff --git a/util-vserver/lib/vserver.h b/util-vserver/lib/vserver.h deleted file mode 100644 index d389fbc..0000000 --- a/util-vserver/lib/vserver.h +++ /dev/null @@ -1,685 +0,0 @@ -/* $Id$ - -* Copyright (C) 2003 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; either version 2, or (at your option) -* any later version. -* -* 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. -*/ - -/** \file vserver.h - * \brief The public interface of the the libvserver library. - */ - -#ifndef H_VSERVER_SYSCALL_H -#define H_VSERVER_SYSCALL_H - -#include -#include -#include -#include - -#ifndef IS_DOXYGEN -#if defined(__GNUC__) -# define VC_ATTR_UNUSED __attribute__((__unused__)) -# define VC_ATTR_NORETURN __attribute__((__noreturn__)) -# define VC_ATTR_CONST __attribute__((__const__)) -# define VC_ATTR_DEPRECATED __attribute__((__deprecated__)) -# if __GNUC__*0x10000 + __GNUC_MINOR__*0x100 + __GNUC_PATCHLEVEL__ >= 0x30300 -# define VC_ATTR_NONNULL(ARGS) __attribute__((__nonnull__ ARGS)) -# define VC_ATTR_ALWAYSINLINE __attribute__((__always_inline__)) -# else -# define VC_ATTR_NONNULL(ARGS) -# define VC_ATTR_ALWAYSINLINE -# endif -# if __GNUC__*0x10000 + __GNUC_MINOR__*0x100 + __GNUC_PATCHLEVEL__ >= 0x30303 -# define VC_ATTR_PURE __attribute__((__pure__)) -# else -# define VC_ATTR_PURE -# endif -#else -# define VC_ATTR_NONNULL(ARGS) -# define VC_ATTR_UNUSED -# define VC_ATTR_NORETURN -# define VC_ATTR_ALWAYSINLINE -# define VC_ATTR_DEPRECATED -# define VC_ATTR_PURE -# define VC_ATTR_CONST -#endif -#endif // IS_DOXYGEN - -/** the value which is returned in error-case (no ctx found) */ -#define VC_NOCTX ((xid_t)(-1)) -#define VC_NOXID ((xid_t)(-1)) -/** the value which means a random (the next free) ctx */ -#define VC_DYNAMIC_XID ((xid_t)(-1)) -/** 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) - - -#ifndef S_CTX_INFO_LOCK -# define S_CTX_INFO_LOCK 1 -#endif - -#ifndef S_CTX_INFO_SCHED -# define S_CTX_INFO_SCHED 2 -#endif - -#ifndef S_CTX_INFO_NPROC -# define S_CTX_INFO_NPROC 4 -#endif - -#ifndef S_CTX_INFO_PRIVATE -# define S_CTX_INFO_PRIVATE 8 -#endif - -#ifndef S_CTX_INFO_INIT -# define S_CTX_INFO_INIT 16 -#endif - -#ifndef S_CTX_INFO_HIDEINFO -# define S_CTX_INFO_HIDEINFO 32 -#endif - -#ifndef S_CTX_INFO_ULIMIT -# define S_CTX_INFO_ULIMIT 64 -#endif - -#ifndef S_CTX_INFO_NAMESPACE -# define S_CTX_INFO_NAMESPACE 128 -#endif - -#define VC_CAP_CHOWN 0 -#define VC_CAP_DAC_OVERRIDE 1 -#define VC_CAP_DAC_READ_SEARCH 2 -#define VC_CAP_FOWNER 3 -#define VC_CAP_FSETID 4 -#define VC_CAP_KILL 5 -#define VC_CAP_SETGID 6 -#define VC_CAP_SETUID 7 -#define VC_CAP_SETPCAP 8 -#define VC_CAP_LINUX_IMMUTABLE 9 -#define VC_CAP_NET_BIND_SERVICE 10 -#define VC_CAP_NET_BROADCAST 11 -#define VC_CAP_NET_ADMIN 12 -#define VC_CAP_NET_RAW 13 -#define VC_CAP_IPC_LOCK 14 -#define VC_CAP_IPC_OWNER 15 -#define VC_CAP_SYS_MODULE 16 -#define VC_CAP_SYS_RAWIO 17 -#define VC_CAP_SYS_CHROOT 18 -#define VC_CAP_SYS_PTRACE 19 -#define VC_CAP_SYS_PACCT 20 -#define VC_CAP_SYS_ADMIN 21 -#define VC_CAP_SYS_BOOT 22 -#define VC_CAP_SYS_NICE 23 -#define VC_CAP_SYS_RESOURCE 24 -#define VC_CAP_SYS_TIME 25 -#define VC_CAP_SYS_TTY_CONFIG 26 -#define VC_CAP_MKNOD 27 -#define VC_CAP_LEASE 28 -#define VC_CAP_QUOTACTL 29 - -#define VC_IMMUTABLE_FILE_FL 0x0000010lu -#define VC_IMMUTABLE_LINK_FL 0x0008000lu -#define VC_IMMUTABLE_ALL (VC_IMMUTABLE_LINK_FL|VC_IMMUTABLE_FILE_FL) - -#define VC_IATTR_XID 0x01000000u - -#define VC_IATTR_ADMIN 0x00000001u -#define VC_IATTR_WATCH 0x00000002u -#define VC_IATTR_HIDE 0x00000004u -#define VC_IATTR_FLAGS 0x00000007u - -#define VC_IATTR_BARRIER 0x00010000u -#define VC_IATTR_IUNLINK 0x00020000u -#define VC_IATTR_IMMUTABLE 0x00040000u - - -// the flags -#define VC_VXF_INFO_LOCK 0x00000001ull -#define VC_VXF_INFO_NPROC 0x00000004ull -#define VC_VXF_INFO_PRIVATE 0x00000008ull -#define VC_VXF_INFO_INIT 0x00000010ull - -#define VC_VXF_INFO_HIDEINFO 0x00000020ull -#define VC_VXF_INFO_ULIMIT 0x00000040ull -#define VC_VXF_INFO_NAMESPACE 0x00000080ull - -#define VC_VXF_SCHED_HARD 0x00000100ull -#define VC_VXF_SCHED_PRIO 0x00000200ull -#define VC_VXF_SCHED_PAUSE 0x00000400ull - -#define VC_VXF_VIRT_MEM 0x00010000ull -#define VC_VXF_VIRT_UPTIME 0x00020000ull -#define VC_VXF_VIRT_CPU 0x00040000ull - -#define VC_VXF_HIDE_MOUNT 0x01000000ull -#define VC_VXF_HIDE_NETIF 0x02000000ull - -#define VC_VXF_STATE_SETUP (1ULL<<32) -#define VC_VXF_STATE_INIT (1ULL<<33) - -// the ccapabilities -#define VC_VXC_SET_UTSNAME 0x00000001ull -#define VC_VXC_SET_RLIMIT 0x00000002ull - -#define VC_VXC_ICMP_PING 0x00000100ull - -#define VC_VXC_SECURE_MOUNT 0x00010000ull - - -/** \defgroup syscalls Syscall wrappers - * Functions which are calling the vserver syscall directly. */ - -/** \defgroup helper Helper functions - * Functions which are doing general helper tasks like parameter parsing. */ - -/** \typedef an_unsigned_integer_type xid_t - * The identifier of a context. */ - -#ifdef IS_DOXYGEN -typedef an_unsigned_integer_type xid_t; -typedef an_unsigned_integer_type nid_t; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - struct vc_ip_mask_pair { - uint32_t ip; - uint32_t mask; - }; - - /** \brief The generic vserver syscall - * \ingroup syscalls - * - * This function executes the generic vserver syscall. It uses the - * correct syscallnumber (which may differ between the different - * architectures). - * - * \params cmd the command to be executed - * \params xid the xid on which the cmd shall be applied - * \params data additional arguments; depends on \c cmd - * \returns depends on \c cmd; usually, -1 stands for an error - */ - int vc_syscall(uint32_t cmd, xid_t xid, void *data); - - /** \brief Returns the version of the current kernel API. - * \ingroup syscalls - * \returns The versionnumber of the kernel API - */ - int vc_get_version(); - - /** \brief Moves current process into a context - * \ingroup syscalls - * - * Puts current process into context \a ctx, removes the capabilities - * given in \a remove_cap and sets \a flags. - * - * \param ctx The new context; special values for are - * - VC_SAMECTX which means the current context (just for changing caps and flags) - * - VC_DYNAMIC_XID which means the next free context; this value can be used by - * ordinary users also - * \param remove_cap The linux capabilities which will be \b removed. - * \param flags Special flags which will be set. - * - * \returns The new context-id, or VC_NOCTX on errors; errno - * will be set appropriately - * - * See http://vserver.13thfloor.at/Stuff/Logic.txt for details */ - xid_t vc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags); - - /** \brief Sets the ipv4root information. - * \ingroup syscalls - * \pre \a nb < NB_IPV4ROOT && \a ips != 0 */ - int vc_set_ipv4root(uint32_t bcast, size_t nb, - struct vc_ip_mask_pair const *ips) VC_ATTR_NONNULL((3)); - - /** \brief Returns the value of NB_IPV4ROOT. - * \ingroup helper - * - * This function returns the value of NB_IPV4ROOT which was used when the - * library was built, but \b not the value which is used by the currently - * running kernel. */ - size_t vc_get_nb_ipv4root() VC_ATTR_CONST VC_ATTR_PURE; - - /** \brief Creates a context without starting it. - * \ingroup syscalls - * - * This functions initializes a new context. When already in a freshly - * created context, this old context will be discarded. - * - * \param xid The new context; special values are: - * - VC_DYNAMIC_XID which means to create a dynamic context - * - * \returns the xid of the created context, or VC_NOCTX on errors. errno - * will be set appropriately. */ - xid_t vc_ctx_create(xid_t xid); - - /** \brief Moves the current process into the specified context. - * \ingroup syscalls - * - * \param xid The new context - * \returns 0 on success, -1 on errors */ - int vc_ctx_migrate(xid_t xid); - - /* rlimit related functions */ - - /** \brief The type which is used for a single limit value. - * - * Special values are - * - VC_LIM_INFINITY ... which is the infinite value - * - VC_LIM_KEEP ... which is used to mark values which shall not be - * modified by the vc_set_rlimit() operation. - * - * Else, the interpretation of the value depends on the corresponding - * resource; it might be bytes, pages, seconds or litres of beer. */ - typedef uint_least64_t vc_limit_t; - - /** \brief The limits of a resources. - * - * This is a triple consisting of a minimum, soft and hardlimit. */ - struct vc_rlimit { - vc_limit_t min; ///< the guaranted minimum of a resources - vc_limit_t soft; ///< the softlimit of a resource - vc_limit_t hard; ///< the absolute hardlimit of a resource - }; - - /** \brief Masks describing the supported limits. */ - struct vc_rlimit_mask { - uint_least32_t min; ///< masks the resources supporting a minimum limit - uint_least32_t soft; ///< masks the resources supporting a soft limit - uint_least32_t hard; ///< masks the resources supporting a hard limit - }; - - /** \brief Returns the limits of \a resource. - * \ingroup syscalls - * - * \param xid The id of the context - * \param resource The resource which will be queried - * \param lim The result which will be filled with the limits - * - * \returns 0 on success, and -1 on errors. */ - int vc_get_rlimit(xid_t xid, int resource, - struct vc_rlimit /*@out@*/ *lim) VC_ATTR_NONNULL((3)); - /** \brief Sets the limits of \a resource. - * \ingroup syscalls - * - * \param xid The id of the context - * \param resource The resource which will be queried - * \param lim The new limits - * - * \returns 0 on success, and -1 on errors. */ - int vc_set_rlimit(xid_t xid, int resource, - struct vc_rlimit const /*@in@*/ *lim) VC_ATTR_NONNULL((3)); - int vc_get_rlimit_mask(xid_t xid, - struct vc_rlimit_mask *lim) VC_ATTR_NONNULL((2)); - /** \brief Parses a string describing a limit - * \ingroup helper - * - * This function parses \a str and interprets special words like \p "inf" - * or suffixes. Valid suffixes are - * - \p k ... 1000 - * - \p m ... 1000000 - * - \p K ... 1024 - * - \p M ... 1048576 - * - * \param str The string which shall be parsed - * \param res Will be filled with the interpreted value; in errorcase, - * this value is undefined. - * - * \returns \a true, iff the string \a str could be parsed. \a res will - * be filled with the interpreted value in this case. - * - * \pre \a str!=0 && \a res!=0 - */ - bool vc_parseLimit(char const /*@in@*/ *str, vc_limit_t /*@out@*/ *res) VC_ATTR_NONNULL((1,2)); - - - /** \brief Sends a signal to a context/pid - * \ingroup syscalls - * - * Special values for \a 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); - - - 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_get_iattr(char const *filename, xid_t * /*@null@*/ xid, - uint_least32_t * /*@null@*/ flags, - uint_least32_t * /*@null@*/ mask) VC_ATTR_NONNULL((1)); - - struct vc_vx_info { - xid_t xid; - pid_t initpid; - }; - - /** \brief Returns the context of the given process. - * - * \params pid the process-id whose xid shall be determined; - * pid==0 means the current process. - * \returns the xid of process \c pid or -1 on errors - */ - xid_t vc_get_task_xid(pid_t pid); - int vc_get_vx_info(xid_t xid, struct vc_vx_info *info) VC_ATTR_NONNULL((2)); - - - typedef enum { vcVHI_CONTEXT, vcVHI_SYSNAME, vcVHI_NODENAME, - vcVHI_RELEASE, vcVHI_VERSION, vcVHI_MACHINE, - vcVHI_DOMAINNAME } vc_uts_type; - - int vc_set_vhi_name(xid_t xid, vc_uts_type type, - char const *val, size_t len) VC_ATTR_NONNULL((3)); - int vc_get_vhi_name(xid_t xid, vc_uts_type type, - char *val, size_t len) VC_ATTR_NONNULL((3)); - - /** Returns true iff \a xid is a dynamic xid */ - bool vc_is_dynamic_xid(xid_t xid); - - int vc_enter_namespace(xid_t xid); - int vc_set_namespace(); - int vc_cleanup_namespace(); - - - /** \brief Flags of process-contexts - */ - struct vc_ctx_flags { - /** \brief Mask of set context flags */ - uint_least64_t flagword; - /** \brief Mask of set and unset context flags when used by set - * operations, or modifiable flags when used by get - * operations */ - uint_least64_t mask; - }; - - /** \brief Capabilities of process-contexts */ - struct vc_ctx_caps { - /** \brief Mask of set common system capabilities */ - uint_least64_t bcaps; - /** \brief Mask of set and unset common system capabilities when used by - * set operations, or the modifiable capabilities when used by - * get operations */ - uint_least64_t bmask; - /** \brief Mask of set process context capabilities */ - uint_least64_t ccaps; - /** \brief Mask of set and unset process context capabilities when used - * by set operations, or the modifiable capabilities when used - * by get operations */ - uint_least64_t cmask; - }; - - /** \brief Information about parsing errors - * \ingroup helper - */ - struct vc_err_listparser { - char const *ptr; ///< Pointer to the first character of an erroneous string - size_t len; ///< Length of the erroneous string - }; - - int vc_get_cflags(xid_t xid, struct vc_ctx_flags *) VC_ATTR_NONNULL((2)); - int vc_set_cflags(xid_t xid, struct vc_ctx_flags const *) VC_ATTR_NONNULL((2)); - - int vc_get_ccaps(xid_t xid, struct vc_ctx_caps *); - int vc_set_ccaps(xid_t xid, struct vc_ctx_caps const *); - - /** \brief Converts a single string into bcapability - * \ingroup helper - * - * \param str The string to be parsed; - * both "CAP_xxx" and "xxx" will be accepted - * \param len The length of the string, or \c 0 for automatic detection - * - * \returns 0 on error; a bitmask on success - * \pre \a str != 0 - */ - uint_least64_t vc_text2bcap(char const *str, size_t len); - - /** \brief Converts the lowest bit of a bcapability or the entire value - * (when possible) to a textual representation - * \ingroup helper - * - * \param val The string to be converted; on success, the detected bit(s) - * will be unset, in errorcase only the lowest set bit - * - * \returns A textual representation of \a val resp. of its lowest set bit; - * or \c NULL in errorcase. - * \pre \a val!=0 - * \post \a *valold \c != 0 \c <--> - * \a *valold > \a *valnew - * \post \a *valold \c == 0 \c ---> \a result == 0 - */ - char const * vc_lobcap2text(uint_least64_t *val) VC_ATTR_NONNULL((1)); - - /** \brief Converts a string into a bcapability-bitmask - * \ingroup helper - * - * Syntax of \a str: \verbinclude list2xxx.syntax - * - * When the \c `~' prefix is used, the bits will be unset and a `~' after - * another `~' will cancel both ones. The \c `^' prefix specifies a - * bitnumber instead of a bitmask. - * - * "literal name" is everything which will be accepted by the - * vc_text2bcap() function. The special values for \c NAME will be - * recognized case insensitively - * - * \param str The string to be parsed - * \param len The length of the string, or \c 0 for automatic detection - * \param err Pointer to a structure for error-information, or \c NULL. - * \param cap Pointer to a vc_ctx_caps structure holding the results; - * only the \a bcaps and \a bmask fields will be changed and - * already set values will not be honored. When an error - * occured, \a cap will have the value of all processed valid - * \c BCAP parts. - * - * \returns 0 on success, -1 on error. In error case, \a err will hold - * position and length of the first not understood BCAP part - * \pre \a str != 0 && \a cap != 0; - * \a cap->bcaps and \a cap->bmask must be initialized - */ - int vc_list2bcap(char const *str, size_t len, - struct vc_err_listparser *err, - struct vc_ctx_caps *cap) VC_ATTR_NONNULL((1,4)); - - uint_least64_t vc_text2ccap(char const *, size_t len); - char const * vc_loccap2text(uint_least64_t *); - int vc_list2ccap(char const *, size_t len, - struct vc_err_listparser *err, - struct vc_ctx_caps *); - - int vc_list2cflag(char const *, size_t len, - struct vc_err_listparser *err, - struct vc_ctx_flags *flags); - uint_least64_t vc_text2cflag(char const *, size_t len); - char const * vc_locflag2text(uint_least64_t *); - - uint_least32_t vc_list2cflag_compat(char const *, size_t len, - struct vc_err_listparser *err); - uint_least32_t vc_text2cflag_compat(char const *, size_t len); - char const * vc_hicflag2text_compat(uint_least32_t); - - 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 *); - - uint_least64_t vc_get_insecurebcaps() VC_ATTR_CONST; - inline static uint_least64_t vc_get_insecureccaps() { - return ~(VC_VXC_SET_UTSNAME|VC_VXC_ICMP_PING); - } - - inline static int vc_setfilecontext(char const *filename, xid_t xid) { - return vc_set_iattr(filename, xid, 0, VC_IATTR_XID); - } - - inline static xid_t vc_getfilecontext(char const *filename) { - xid_t res; - if (vc_get_iattr(filename, &res, 0,0)==-1) return VC_NOCTX; - return res; - } - - - struct vc_set_sched { - int32_t fill_rate; - int32_t interval; - int32_t tokens; - int32_t tokens_min; - int32_t tokens_max; - uint64_t cpu_mask; - }; - - int vc_set_sched(xid_t xid, struct vc_set_sched const *); - - - typedef enum { vcFEATURE_VKILL, vcFEATURE_IATTR, vcFEATURE_RLIMIT, - vcFEATURE_COMPAT, vcFEATURE_MIGRATE, vcFEATURE_NAMESPACE, - vcFEATURE_SCHED, vcFEATURE_VINFO, vcFEATURE_VHI, - vcFEATURE_VSHELPER0, vcFEATURE_VSHELPER } - vcFeatureSet; - - bool vc_isSupported(vcFeatureSet) VC_ATTR_CONST; - bool vc_isSupportedString(char const *); - - /* The management part */ - -#define VC_LIMIT_VSERVER_NAME_LEN 1024 - - typedef enum { vcCFG_NONE, vcCFG_AUTO, - vcCFG_LEGACY, - vcCFG_RECENT_SHORT, - vcCFG_RECENT_FULL } vcCfgStyle; - - - /** Maps an xid given at '--xid' options to an xid_t */ - xid_t vc_xidopt2xid(char const *, bool honor_static, char const **err_info); - - vcCfgStyle vc_getVserverCfgStyle(char const *id); - - /** Resolves the name of the vserver. The result will be allocated and must - be freed by the caller. */ - char * vc_getVserverName(char const *id, vcCfgStyle style); - - /** Returns the path of the vserver configuration directory. When the given - * vserver does not exist, or when it does not have such a directory, NULL - * will be returned. Else, the result will be allocated and must be freed - * by the caller. */ - char * vc_getVserverCfgDir(char const *id, vcCfgStyle style); - - /** Returns the path of the configuration directory for the given - * application. The result will be allocated and must be freed by the - * caller. */ - char * vc_getVserverAppDir(char const *id, vcCfgStyle style, char const *app); - - /** Returns the path to the vserver root-directory. The result will be - * allocated and must be freed by the caller. */ - char * vc_getVserverVdir(char const *id, vcCfgStyle style, bool physical); - - /** Returns the ctx of the given vserver. When vserver is not running and - * 'honor_static' is false, VC_NOCTX will be returned. Else, when - * 'honor_static' is true and a static assignment exists, those value will - * be returned. Else, the result will be VC_NOCTX. - * - * When 'is_running' is not null, the status of the vserver will be - * assigned to this variable. */ - xid_t vc_getVserverCtx(char const *id, vcCfgStyle style, - bool honor_static, bool /*@null@*/ *is_running); - - /** 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(xid_t ctx, /*@null@*/vcCfgStyle *style, - /*@null@*/char const *revdir); - -#define vcSKEL_INTERFACES 1u -#define vcSKEL_PKGMGMT 2u -#define vcSKEL_FILESYSTEM 4u - - /** Create a basic configuration skeleton for a vserver plus toplevel - * directories for pkgmanagemt and filesystem (when requested). */ - int vc_createSkeleton(char const *id, vcCfgStyle style, int flags); - -#ifdef __cplusplus -} -#endif - -#undef VC_ATTR_PURE -#undef VC_ATTR_ALWAYSINLINE -#undef VC_ATTR_NORETURN -#undef VC_ATTR_UNUSED -#undef VC_ATTR_NONNULL - -#endif diff --git a/util-vserver/lib/xidopt2xid.c b/util-vserver/lib/xidopt2xid.c deleted file mode 100644 index 26e8077..0000000 --- a/util-vserver/lib/xidopt2xid.c +++ /dev/null @@ -1,58 +0,0 @@ -// $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 -#endif - -#include "vserver.h" -#include -#include - -static xid_t -getVserverXid(char const *id, bool honor_static, char const **err) -{ - *err = "vc_getVserverCtx"; - return vc_getVserverCtx(id, vcCFG_AUTO, honor_static, 0); -} - -xid_t -vc_xidopt2xid(char const *str, bool honor_static, char const **err_info) -{ - char const * err; - xid_t res = VC_NOCTX; - - err = "vc_get_task_xid()"; - if (strcmp(str,"self")==0) res = vc_get_task_xid(0); - else if (str[0]==':') res = getVserverXid(str+1, honor_static, &err); - else { - char * endptr; - xid_t xid = strtol(str, &endptr, 10); - - if (endptr!=str && (*endptr=='\0' || *endptr=='\n')) - res = xid; - else { - err = "getVserverXid()"; - res = getVserverXid(str, honor_static, &err); - } - } - - if (res==VC_NOCTX && err_info) *err_info = err; - - return res; -} diff --git a/util-vserver/lib_internal/.cvsignore b/util-vserver/lib_internal/.cvsignore deleted file mode 100644 index ec96903..0000000 --- a/util-vserver/lib_internal/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.deps -.dirstamp diff --git a/util-vserver/lib_internal/Makefile-files b/util-vserver/lib_internal/Makefile-files deleted file mode 100644 index 5bf1992..0000000 --- a/util-vserver/lib_internal/Makefile-files +++ /dev/null @@ -1,88 +0,0 @@ -## $Id$ -*- makefile -*- - -## Copyright (C) 2003,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; either version 2, or (at your option) -## any later version. -## -## 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. -## - -command_SRCS = lib_internal/command-appendparameter.c \ - lib_internal/command-exec.c\ - lib_internal/command-free.c \ - lib_internal/command-init.c \ - lib_internal/command-reset.c \ - lib_internal/command-wait.c \ - lib_internal/command.h - -if ENSC_HAVE_C99_COMPILER -filecfg_SRCS = lib_internal/filecfg.h \ - lib_internal/filecfg-readentryflag.c \ - lib_internal/filecfg-readentrystr.c -endif - -noinst_LIBRARIES += lib_internal/libinternal.a -noinst_HEADERS += \ - lib_internal/coreassert.h \ - lib_internal/errinfo.h \ - lib_internal/jail.h \ - lib_internal/matchlist.h \ - lib_internal/pathinfo.h \ - lib_internal/string.h \ - lib_internal/unify.h \ - lib_internal/util.h \ - lib_internal/util-cast.h \ - lib_internal/util-commonstrings.h \ - lib_internal/util-debug.h \ - lib_internal/util-declarecmd.h \ - lib_internal/util-dimof.h \ - lib_internal/util-dotfile.h \ - lib_internal/util-exitlikeprocess.h \ - lib_internal/util-io.h \ - lib_internal/util-lockfile.h \ - lib_internal/util-mem.h \ - lib_internal/util-perror.h \ - lib_internal/util-safechdir.h \ - lib_internal/util-unixsock.h \ - lib_internal/string.hc - -lib_internal_libinternal_a_SOURCES = \ - lib_internal/errinfo-writeerrno.c \ - lib_internal/jailintotempdir.c \ - lib_internal/matchlist-appendfiles.c \ - lib_internal/matchlist-compare.c \ - lib_internal/matchlist-destroy.c \ - lib_internal/matchlist-init.c \ - lib_internal/matchlist-initbyvserver.c \ - lib_internal/matchlist-initmanually.c \ - lib_internal/matchlist-initrefserverlist.c \ - lib_internal/matchlist-printid.c \ - lib_internal/pathinfo-append.c \ - lib_internal/pathinfo-test.c \ - lib_internal/string-destroy.c \ - lib_internal/switchtowatchxid.c \ - lib_internal/unify-copy.c \ - lib_internal/unify-deunify.c \ - lib_internal/unify-settime.c \ - lib_internal/unify-unify.c \ - lib_internal/util-canonify.c \ - lib_internal/util-exitlikeprocess.c \ - lib_internal/util-lockfile.c \ - lib_internal/util-safechdir.c \ - $(command_SRCS) \ - $(filecfg_SRCS) - -DIETPROGS += lib_internal/libinternal.a - - -include $(top_srcdir)/lib_internal/testsuite/Makefile-files diff --git a/util-vserver/lib_internal/command-appendparameter.c b/util-vserver/lib_internal/command-appendparameter.c deleted file mode 100644 index 26c34c5..0000000 --- a/util-vserver/lib_internal/command-appendparameter.c +++ /dev/null @@ -1,30 +0,0 @@ -// $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 -#endif - -#include "command.h" - -void -Command_appendParameter(struct Command *cmd, char const *param) -{ - char const ** p = Vector_pushback(&cmd->params); - *p = param; -} diff --git a/util-vserver/lib_internal/command-exec.c b/util-vserver/lib_internal/command-exec.c deleted file mode 100644 index 9f6b17a..0000000 --- a/util-vserver/lib_internal/command-exec.c +++ /dev/null @@ -1,76 +0,0 @@ -// $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 -#endif - -#include "command.h" - -#include -#include -#include -#include - -static inline bool -initPipes(int p[2]) -{ - return (pipe(p)!=-1 && - fcntl(p[1], F_SETFD, FD_CLOEXEC)!=-1); -} - -bool -Command_exec(struct Command *cmd, bool do_fork) -{ - int p[2]; - - Vector_zeroEnd(&cmd->params); - - if (!do_fork) - cmd->pid = 0; - else if (!initPipes(p) || - (cmd->pid = fork())==-1) { - cmd->err = errno; - return false; - } - - if (cmd->pid==0) { - if (do_fork) close(p[0]); - - execv(cmd->filename ? cmd->filename : ((char **)(Vector_begin(&cmd->params)))[0], - cmd->params.data); - cmd->err = errno; - assert(cmd->err != 0); - - if (do_fork) { - write(p[1], &cmd->err, sizeof(cmd->err)); - _exit(1); // implicates 'close(p[1])' - } - } - else { - close(p[1]); - if (read(p[0], &cmd->err, sizeof(cmd->err))==0) - cmd->err = 0; - else // cleanup zombies - while (wait4(cmd->pid, 0,0,0)==-1 && - (errno==EINTR || errno==EAGAIN)) {}; - close(p[0]); - } - - return cmd->err==0; -} diff --git a/util-vserver/lib_internal/command-free.c b/util-vserver/lib_internal/command-free.c deleted file mode 100644 index 8163503..0000000 --- a/util-vserver/lib_internal/command-free.c +++ /dev/null @@ -1,29 +0,0 @@ -// $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 -#endif - -#include "command.h" - -void -Command_free(struct Command *cmd) -{ - Vector_free(&cmd->params); -} diff --git a/util-vserver/lib_internal/command-init.c b/util-vserver/lib_internal/command-init.c deleted file mode 100644 index 1484766..0000000 --- a/util-vserver/lib_internal/command-init.c +++ /dev/null @@ -1,33 +0,0 @@ -// $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 -#endif - -#include "command.h" - -void -Command_init(struct Command *cmd, size_t UNUSED param_count) -{ - Vector_init(&cmd->params, sizeof(char *)); - cmd->filename = 0; - cmd->pid = -1; - cmd->rc = -1; - cmd->err = 0; -} diff --git a/util-vserver/lib_internal/command-reset.c b/util-vserver/lib_internal/command-reset.c deleted file mode 100644 index 3610176..0000000 --- a/util-vserver/lib_internal/command-reset.c +++ /dev/null @@ -1,31 +0,0 @@ -// $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 -#endif - -#include "command.h" - -void -Command_reset(struct Command *cmd) -{ - cmd->pid = -1; - cmd->rc = -1; - cmd->err = 0; -} diff --git a/util-vserver/lib_internal/command-wait.c b/util-vserver/lib_internal/command-wait.c deleted file mode 100644 index c2d3302..0000000 --- a/util-vserver/lib_internal/command-wait.c +++ /dev/null @@ -1,40 +0,0 @@ -// $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 -#endif - -#include "command.h" -#include - -bool -Command_wait(struct Command *cmd, bool do_block) -{ - int rc; - - if (cmd->rc!=-1) return true; - - switch (wait4(cmd->pid, &rc, (!do_block ? WNOHANG : 0), &cmd->rusage)) { - case 0 : break; - case -1 : cmd->err = errno; break; - default : cmd->rc = rc; return true; - } - - return false; -} diff --git a/util-vserver/lib_internal/command.h b/util-vserver/lib_internal/command.h deleted file mode 100644 index 2ab497a..0000000 --- a/util-vserver/lib_internal/command.h +++ /dev/null @@ -1,50 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_COMMAND_H -#define H_UTIL_VSERVER_LIB_INTERNAL_COMMAND_H - -#include -#include -#include -#include - -struct Command -{ - char const * filename; - struct Vector params; - pid_t pid; - int rc; - int err; - struct rusage rusage; -}; - -void Command_init(struct Command *, size_t param_count); -void Command_free(struct Command *); -void Command_reset(struct Command *); -bool Command_exec(struct Command *, bool do_fork); -void Command_appendParameter(struct Command *, char const *); -/** - * \args do_hang when true, do not return before command exited, or - * an error (e.g. signal) occured - * \returns \c true iff command/processes exited; in this case, - * exitcode is available in the \c rc member - */ -bool Command_wait(struct Command *, bool do_block); - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_COMMAND_H diff --git a/util-vserver/lib_internal/coreassert.h b/util-vserver/lib_internal/coreassert.h deleted file mode 100644 index 1dc7eeb..0000000 --- a/util-vserver/lib_internal/coreassert.h +++ /dev/null @@ -1,40 +0,0 @@ -// $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. - - -#ifndef H_UTILVSERVER_LIB_INTERNAL_COREASSERT_H -#define H_UTILVSERVER_LIB_INTERNAL_COREASSERT_H - -#ifndef ENSC_TESTSUITE -# error Do not use outside of testenvironemnts! -#endif - -#include -#include - -#undef assert -#define ASSERT_STRX(X) #X -#define ASSERT_STR(X) ASSERT_STRX(X) -#define ASSERT_WRITE(X) write(2, (X), sizeof(X)-1) -#define assert(X) \ - (!(X)) ? \ - ASSERT_WRITE(__FILE__ ":" ASSERT_STR(__LINE__) \ - " Assertion: '" #X "' failed\n"), \ - *(char *)(0)=0 : 0 - - -#endif // H_UTILVSERVER_LIB_INTERNAL_COREASSERT_H diff --git a/util-vserver/lib_internal/errinfo-writeerrno.c b/util-vserver/lib_internal/errinfo-writeerrno.c deleted file mode 100644 index ae9d947..0000000 --- a/util-vserver/lib_internal/errinfo-writeerrno.c +++ /dev/null @@ -1,44 +0,0 @@ -// $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 -#endif - -#include "errinfo.h" -#include "util.h" - -void -ErrInfo_writeErrno(struct ErrorInformation const *info) -{ - if (info->app) { - WRITE_STR(2, info->app); - WRITE_MSG(2, ": "); - } - - if (info->pos) { - WRITE_STR(2, info->pos); - if (info->id!=0) WRITE_MSG(2, ": "); - } - - if (info->id!=0) { - WRITE_STR(2, strerror(info->id)); - } - - WRITE_MSG(2, "\n"); -} diff --git a/util-vserver/lib_internal/errinfo.h b/util-vserver/lib_internal/errinfo.h deleted file mode 100644 index 10046a0..0000000 --- a/util-vserver/lib_internal/errinfo.h +++ /dev/null @@ -1,31 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_ERRINFO_H -#define H_UTIL_VSERVER_LIB_INTERNAL_ERRINFO_H - -struct ErrorInformation -{ - char const * app; // the application-name - char const * pos; // the detailed position of the error - int id; // usually errno -}; - -void ErrInfo_writeErrno(struct ErrorInformation const *); - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_ERRINFO_H diff --git a/util-vserver/lib_internal/filecfg-readentryflag.c b/util-vserver/lib_internal/filecfg-readentryflag.c deleted file mode 100644 index 38d7a8d..0000000 --- a/util-vserver/lib_internal/filecfg-readentryflag.c +++ /dev/null @@ -1,39 +0,0 @@ -// $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 -#endif - -#include "filecfg.h" - -#include -#include -#include - -bool -FileCfg_readEntryFlag(PathInfo const *base, char const *file, bool dflt) -{ - PathInfo filepath = { .d = file, .l = strlen(file) }; - PathInfo path = *base; - char path_buf[ENSC_PI_APPSZ(path, filepath)]; - struct stat st; - - PathInfo_append(&path, &filepath, path_buf); - return stat(path.d, &st)!=-1 || dflt; -} diff --git a/util-vserver/lib_internal/filecfg-readentrystr.c b/util-vserver/lib_internal/filecfg-readentrystr.c deleted file mode 100644 index 43627ac..0000000 --- a/util-vserver/lib_internal/filecfg-readentrystr.c +++ /dev/null @@ -1,74 +0,0 @@ -// $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 -#endif - -#include "filecfg.h" -#include -#include -#include - -char * -FileCfg_readEntryStr (PathInfo const *base, char const *file, - bool allow_multiline, char const *dflt) -{ - PathInfo filepath = { .d = file, .l = strlen(file) }; - PathInfo path = *base; - char path_buf[ENSC_PI_APPSZ(path, filepath)]; - int fd = -1; - off_t sz; - char * res = 0; - - PathInfo_append(&path, &filepath, path_buf); - fd = open(path.d, O_RDONLY); - if (fd==-1) goto err; - - sz = lseek(fd, 0, SEEK_END); - if (sz==-1 || - lseek(fd, 0, SEEK_SET)==-1) goto err; - - - if (sz>0 && sz0 && buf[sz-1]=='\n') --sz; - buf[sz] = '\0'; - } - - res = strdup(buf); - } - - err: - if (res==0 && dflt) - res = strdup(dflt); - - if (fd!=-1) close(fd); - return res; -} diff --git a/util-vserver/lib_internal/filecfg.h b/util-vserver/lib_internal/filecfg.h deleted file mode 100644 index 1c7f70b..0000000 --- a/util-vserver/lib_internal/filecfg.h +++ /dev/null @@ -1,31 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_FILECFG_H -#define H_UTIL_VSERVER_LIB_INTERNAL_FILECFG_H - -#include "pathinfo.h" -#include - -// 1MiB should be enough for all applications -#define FILECFG_MAX_FILESIZE 0x100000 - -char * FileCfg_readEntryStr (PathInfo const *base, char const *file, bool allow_multiline, char const *dflt); -bool FileCfg_readEntryFlag(PathInfo const *base, char const *file, bool dflt); - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_FILECFG_H diff --git a/util-vserver/lib_internal/jail.h b/util-vserver/lib_internal/jail.h deleted file mode 100644 index 4851d40..0000000 --- a/util-vserver/lib_internal/jail.h +++ /dev/null @@ -1,26 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_JAIL_H -#define H_UTIL_VSERVER_LIB_INTERNAL_JAIL_H - -#include - -bool jailIntoTempDir(char const **err_pos); - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_JAIL_H diff --git a/util-vserver/lib_internal/jailintotempdir.c b/util-vserver/lib_internal/jailintotempdir.c deleted file mode 100644 index d1ad9a8..0000000 --- a/util-vserver/lib_internal/jailintotempdir.c +++ /dev/null @@ -1,51 +0,0 @@ -// $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 -#endif - -#include "jail.h" - -#include -#include -#include - -bool -jailIntoTempDir(char const **err_pos) -{ - gid_t const id = 1; - char buf[] = "/tmp/jaildir.XXXXXX"; - char const * d = mkdtemp(buf); - char const * err = "mkdtemp()"; - - if (d==0 || - (err="chdir()", chdir(d)==-1) || - (err="rmdir()", rmdir(d)==-1) || - (err="chroot()", chroot(".")==-1) || - (err="setgroups()",setgroups(1, &id)==-1) || - (err="setgid()", setgid(id)==-1) || - (err="setuid()", setuid(id)==-1) || - (err="getgid()", getgid()!=id) || - (err="getuid()", getuid()!=id)) { - if (err_pos!=0) *err_pos = err; - return false; - } - - return true; -} diff --git a/util-vserver/lib_internal/matchlist-appendfiles.c b/util-vserver/lib_internal/matchlist-appendfiles.c deleted file mode 100644 index 73af1a0..0000000 --- a/util-vserver/lib_internal/matchlist-appendfiles.c +++ /dev/null @@ -1,71 +0,0 @@ -// $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 -#endif - -#include "matchlist.h" -#include -#include - -static int -fnmatchWrap(char const *a, char const *b) -{ - return fnmatch(a, b, 0); -} - -static MatchItemCompareFunc -determineCompareFunc(char const UNUSED *fname) -{ - return fnmatchWrap; -} - -void -MatchList_appendFiles(struct MatchList *list, size_t idx, - char **files, size_t count, - bool auto_type) -{ - struct MatchItem *ptr = list->data + idx; - size_t i; - - assert(idx+count <= list->count); - - if (auto_type) { - for (i=0; itype = stINCLUDE; ++file; break; - case '~' : ptr->type = stSKIP; ++file; break; - case '-' : ++file; /*@fallthrough@*/ - default : ptr->type = stEXCLUDE; break; - } - ptr->cmp = determineCompareFunc(file); - ptr->name = file; - ++ptr; - } - } - else { - for (i=0; itype = stEXCLUDE; - ptr->name = files[i]; - ptr->cmp = 0; - ++ptr; - } - } -} diff --git a/util-vserver/lib_internal/matchlist-compare.c b/util-vserver/lib_internal/matchlist-compare.c deleted file mode 100644 index 2cff7e2..0000000 --- a/util-vserver/lib_internal/matchlist-compare.c +++ /dev/null @@ -1,41 +0,0 @@ -// $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 -#endif - -#include "matchlist.h" -#include - -MatchType -MatchList_compare(struct MatchList const *list, char const *path) -{ - struct MatchItem const * ptr = list->data; - struct MatchItem const * const end_ptr = list->data + list->count; - - //write(1, path, strlen(path)); - //write(1, "\n", 1); - for (; ptrcmp==0 && strcmp(ptr->name, path)==0) || - (ptr->cmp!=0 && (ptr->cmp)(ptr->name, path)==0)) - return ptr->type; - } - - return stINCLUDE; -} diff --git a/util-vserver/lib_internal/matchlist-destroy.c b/util-vserver/lib_internal/matchlist-destroy.c deleted file mode 100644 index 626cac2..0000000 --- a/util-vserver/lib_internal/matchlist-destroy.c +++ /dev/null @@ -1,37 +0,0 @@ -// $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 -#endif - -#include "matchlist.h" - -void -MatchList_destroy(struct MatchList *list) -{ - size_t i; - - String_destroy(&list->id); - free(list->data); - - for (i=0; ibuf_count; ++i) - free((void *)(list->buf[i])); - - free(list->buf); -} diff --git a/util-vserver/lib_internal/matchlist-init.c b/util-vserver/lib_internal/matchlist-init.c deleted file mode 100644 index 6fe2455..0000000 --- a/util-vserver/lib_internal/matchlist-init.c +++ /dev/null @@ -1,41 +0,0 @@ -// $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 -#endif - -#include "matchlist.h" -#include -#include - -#define ENSC_WRAPPERS_STDLIB 1 -#include -void -MatchList_init(struct MatchList *list, char const *root, size_t count) -{ - list->skip_depth = 0; - list->root.d = root; - list->root.l = strlen(root); - list->data = Emalloc(sizeof(struct MatchItem) * count); - list->count = count; - list->buf = 0; - list->buf_count = 0; - - String_init(&list->id); -} diff --git a/util-vserver/lib_internal/matchlist-initbyvserver.c b/util-vserver/lib_internal/matchlist-initbyvserver.c deleted file mode 100644 index 13b2828..0000000 --- a/util-vserver/lib_internal/matchlist-initbyvserver.c +++ /dev/null @@ -1,72 +0,0 @@ -// $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 -#endif -#include "pathconfig.h" - -#include "matchlist.h" -#include "util-io.h" - -#include "vserver.h" - - - -bool -MatchList_initByVserver(struct MatchList *list, char const *vserver, - char const **res_appdir) -{ - vcCfgStyle style; - char const *vdir; - char const *appdir; - - style = vc_getVserverCfgStyle(vserver); - vdir = vc_getVserverVdir( vserver, style, true); - appdir = vc_getVserverAppDir(vserver, style, "vunify"); - - if (vdir==0 || appdir==0) { - free((char *)appdir); - free((char *)vdir); - return false; - } - - { - size_t l1 = strlen(appdir); - char tmp[l1 + sizeof("/exclude")]; - char const * excl_list; - - memcpy(tmp, appdir, l1); - memcpy(tmp+l1, "/exclude", 9); - - excl_list = tmp; - if (access(excl_list, R_OK)==-1) excl_list = CONFDIR "/.defaults/apps/vunify/exclude"; - if (access(excl_list, R_OK)==-1) excl_list = PKGLIBDIR "/defaults/vunify-exclude"; - - // 'vdir' is transferred to matchlist and must not be free'ed here - MatchList_initManually(list, vserver, vdir, excl_list); - } - - if (res_appdir!=0) - *res_appdir = appdir; - else - free((char *)appdir); - - return true; -} - diff --git a/util-vserver/lib_internal/matchlist-initmanually.c b/util-vserver/lib_internal/matchlist-initmanually.c deleted file mode 100644 index 02aecd3..0000000 --- a/util-vserver/lib_internal/matchlist-initmanually.c +++ /dev/null @@ -1,196 +0,0 @@ -// $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 -#endif -#include "pathconfig.h" - -#include "matchlist.h" -#include "util-io.h" - -#include -#include -#include -#include -#include -#include - -#define ENSC_WRAPPERS_UNISTD 1 -#define ENSC_WRAPPERS_STDLIB 1 -#define ENSC_WRAPPERS_IO 1 -#include - - -extern int Global_getVerbosity() PURE CONST; -extern bool Global_doRenew() PURE CONST; - -static void -readExcludeListFD(int fd, - char ***files, size_t *size, - char **buf) -{ - off_t len; - size_t lines = 0; - char *ptr; - - if (fd==-1) return; // todo: message on verbose? - - len = Elseek(fd, 0, SEEK_END); - Elseek(fd, 0, SEEK_SET); - - *buf = Emalloc(sizeof(*buf) * (len+1)); - EreadAll(fd, *buf, len); - (*buf)[len] = '\0'; - - ptr = *buf; - while ((ptr=strchr(ptr, '\n'))) { - ++lines; - ++ptr; - } - - ++lines; - *files = Emalloc(sizeof(**files) * lines); - - *size = 0; - ptr = *buf; - while (*ptr) { - char *end_ptr = strchr(ptr, '\n'); - - assert(*sizeptr && *tmp==' '); - - if (tmp>ptr) (*files)[(*size)++] = ptr; - } - - ptr = end_ptr+1; - } -} - -static void -readExcludeList(char const *filename, - char ***files, size_t *size, - char **buf) -{ - int fd = open(filename, O_RDONLY); - if (fd==-1) return; // todo: message on verbose? - - readExcludeListFD(fd, files, size, buf); - Eclose(fd); -} - -static void -getConfigfileList(char const *vserver, - char ***files, size_t *size, - char **buf) -{ - char tmpname[] = "/tmp/vunify.XXXXXX"; - pid_t pid; - int fd = Emkstemp(tmpname); - - Eunlink(tmpname); - pid = Efork(); - - if (pid==0) { - char *args[10]; - char const **ptr = (char const **)(args)+0; - - Edup2(fd, 1); - //Eclose(0); - if (fd!=1) Eclose(fd); - - *ptr++ = VPKG_PROG; - *ptr++ = vserver; - *ptr++ = "get-conffiles"; - *ptr = 0; - - Eexecv(args[0], args); - } - else { - int status; - - if (TEMP_FAILURE_RETRY(wait4(pid, &status, 0,0))==-1) { - perror("wait4()"); - exit(1); - } - - if (!WIFEXITED(status) || WEXITSTATUS(status)!=0) { - WRITE_MSG(2, "failed to determine configfiles\n"); - exit(1); - } - - readExcludeListFD(fd, files, size, buf); - Eclose(fd); - } -} - -void -MatchList_initManually(struct MatchList *list, char const *vserver, - char const *vdir, char const *exclude_file) -{ - char *buf[2] = { 0,0 }; - - char **fixed_files = 0; - size_t fixed_count = 0; - - char **expr_files = 0; - size_t expr_count = 0; - - if (Global_getVerbosity()>=1) { - WRITE_MSG(1, "Initializing exclude-list for "); - WRITE_STR(1, vdir); - if (vserver!=0) { - WRITE_MSG(1, " ("); - WRITE_STR(1, vserver); - WRITE_MSG(1, ")"); - } - WRITE_MSG(1, "\n"); - } - if (vserver && Global_doRenew()) { - if (Global_getVerbosity()>=2) - WRITE_MSG(1, " Fetching configuration-file list from packagemanagement\n"); - getConfigfileList(vserver, &fixed_files, &fixed_count, buf+0); - } - - // abuse special values (NULL, empty string) to skip the next step - if (exclude_file && *exclude_file) { - if (Global_getVerbosity()>=6) WRITE_MSG(1, " Reading exclude file\n"); - readExcludeList(exclude_file, - &expr_files, &expr_count, - buf+1); - } - - MatchList_init(list, vdir, fixed_count + expr_count); - list->buf = Emalloc(sizeof(void *) * 3); - list->buf[0] = buf[0]; - list->buf[1] = buf[1]; - list->buf[2] = vdir; - list->buf_count = 3; - - MatchList_appendFiles(list, 0, fixed_files, fixed_count, false); - MatchList_appendFiles(list, fixed_count, expr_files, expr_count, true); - - free(expr_files); - free(fixed_files); -} diff --git a/util-vserver/lib_internal/matchlist-initrefserverlist.c b/util-vserver/lib_internal/matchlist-initrefserverlist.c deleted file mode 100644 index f39a98b..0000000 --- a/util-vserver/lib_internal/matchlist-initrefserverlist.c +++ /dev/null @@ -1,82 +0,0 @@ -// $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 -#endif - -#include "matchlist.h" -#include "util-io.h" - -#include -#include -#include - -#define ENSC_WRAPPERS_FCNTL 1 -#define ENSC_WRAPPERS_UNISTD 1 -#define ENSC_WRAPPERS_STDLIB 1 -#include - -static int -selectRefserver(struct dirent const *ent) -{ - return strncmp(ent->d_name, "refserver.", 10)==0; -} - -void -MatchList_initRefserverList(struct MatchList **lst, size_t *cnt, - char const *dir) -{ - int cur_dir = Eopen(".", O_RDONLY, 0); - struct dirent **entries; - int count,i; - - Echdir(dir); - count = scandir(".", &entries, selectRefserver, alphasort); - if (count==-1) { - perror("scandir()"); - exit(1); - } - - if (count==0) { - WRITE_MSG(2, "no reference vserver configured\n"); - exit(1); - } - - *lst = Emalloc(sizeof(struct MatchList) * count); - *cnt = count; - for (i=0; id_name; - size_t l = strlen(tmp); - char vname[sizeof("./") + l]; - - memcpy(vname, "./", 2); - memcpy(vname+2, tmp, l+1); - - if (!MatchList_initByVserver((*lst)+i, vname, 0)) { - WRITE_MSG(2, "unification for reference vserver not configured\n"); - exit(1); - } - - free(entries[i]); - } - free(entries); - - Efchdir(cur_dir); - Eclose(cur_dir); -} diff --git a/util-vserver/lib_internal/matchlist-printid.c b/util-vserver/lib_internal/matchlist-printid.c deleted file mode 100644 index 36b0742..0000000 --- a/util-vserver/lib_internal/matchlist-printid.c +++ /dev/null @@ -1,39 +0,0 @@ -// $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 -#endif - -#include "matchlist.h" -#include "util-io.h" - -void -MatchList_printId(struct MatchList const *l, int fd) -{ - if (l->id.l>0) { - WRITE_MSG(fd, "'"); - (void)write(fd, l->id.d, l->id.l); - WRITE_MSG(1, "'"); - } - else if (l->root.l>0) { - write(fd, l->root.d, l->root.l); - } - else - WRITE_MSG(fd, "???"); -} diff --git a/util-vserver/lib_internal/matchlist.h b/util-vserver/lib_internal/matchlist.h deleted file mode 100644 index d06e7bd..0000000 --- a/util-vserver/lib_internal/matchlist.h +++ /dev/null @@ -1,74 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_MATCHLIST_H -#define H_UTIL_VSERVER_LIB_INTERNAL_MATCHLIST_H - -#include "pathinfo.h" -#include "string.h" - -#include -#include - -typedef int (*MatchItemCompareFunc)(char const *, char const *); -typedef enum { stINCLUDE,stEXCLUDE,stSKIP } MatchType; - -struct MatchItem -{ - MatchType type; - char const * name; - MatchItemCompareFunc cmp; -}; - -struct MatchList -{ - size_t skip_depth; - PathInfo root; - String id; - struct MatchItem *data; - size_t count; - - void const **buf; - size_t buf_count; -}; - -void MatchList_init(struct MatchList *, char const *root, - size_t count) NONNULL((1,2)); -bool MatchList_initByVserver(struct MatchList *, - char const *vserver, - char const **res_appdir) NONNULL((1,2)); -void MatchList_initManually(struct MatchList *list, - char const *vserver, - char const *vdir, - char const *exclude_file) NONNULL((1,3,4)); -void MatchList_initRefserverList(struct MatchList **, size_t *cnt, - char const *dir) NONNULL((1,2,3)); -void MatchList_destroy(struct MatchList *) NONNULL((1)); -void MatchList_appendFiles(struct MatchList *, size_t idx, - char **files, size_t count, - bool auto_type) NONNULL((1,3)); - -MatchType MatchList_compare(struct MatchList const *, - char const *path) NONNULL((1,2)); -struct MatchItem -const * MatchList_find(struct MatchList const *, - char const *path) NONNULL((1,2)); - -void MatchList_printId(struct MatchList const *, int fd) NONNULL((1)); - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_MATCHLIST_H diff --git a/util-vserver/lib_internal/pathinfo-append.c b/util-vserver/lib_internal/pathinfo-append.c deleted file mode 100644 index c4cf941..0000000 --- a/util-vserver/lib_internal/pathinfo-append.c +++ /dev/null @@ -1,54 +0,0 @@ -// $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 -#endif - -#include "pathinfo.h" -#include "util-mem.h" - -void -PathInfo_append(PathInfo * restrict lhs, - PathInfo const * restrict rhs, - char *buf) -{ - char * ptr = buf; - char const * rhs_ptr = rhs->d; - size_t rhs_len = rhs->l; - - while (lhs->l>1 && lhs->d[lhs->l-1]=='/') --lhs->l; - - if (lhs->l>0) { - while (rhs->l>0 && *rhs_ptr=='/') { - ++rhs_ptr; - --rhs_len; - } - - ptr = Xmemcpy(ptr, lhs->d, lhs->l); - if (ptr[-1]!='/') - ptr = Xmemcpy(ptr, "/", 1); - } -// else if (*rhs_ptr!='/') -// ptr = Xmemcpy(ptr, "/", 1); - - ptr = Xmemcpy(ptr, rhs_ptr, rhs_len+1); - - lhs->d = buf; - lhs->l = ptr-buf-1; -} diff --git a/util-vserver/lib_internal/pathinfo-test.c b/util-vserver/lib_internal/pathinfo-test.c deleted file mode 100644 index 122d4f6..0000000 --- a/util-vserver/lib_internal/pathinfo-test.c +++ /dev/null @@ -1,55 +0,0 @@ -// $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 -#endif - -#include "pathinfo.h" -#include -#include - -#define CHECK(LHS,RHS, EXP) \ - do { \ - PathInfo lhs = { LHS, sizeof(LHS)-1 }; \ - PathInfo rhs = { RHS, sizeof(RHS)-1 }; \ - char *buf = malloc(ENSC_PI_APPSZ(lhs,rhs)); \ - assert(ENSC_PI_APPSZ(lhs,rhs)>=sizeof(EXP)); \ - PathInfo_append(&lhs, &rhs, buf); \ - assert(memcmp(lhs.d, EXP, sizeof(EXP))==0); \ - assert(lhs.l == sizeof(EXP)-1); \ - free(buf); \ - } while (0) - - -void -PathInfo_test() -{ - CHECK("/var", "/tmp", "/var/tmp"); - CHECK("/var", "tmp", "/var/tmp"); - CHECK("/var/", "/tmp", "/var/tmp"); - CHECK("/var/", "tmp", "/var/tmp"); - - CHECK("/", "tmp", "/tmp"); - CHECK("/", "/tmp", "/tmp"); - - CHECK("", "/tmp", "/tmp"); - - CHECK("", "tmp", "tmp"); - CHECK("", "", ""); -} diff --git a/util-vserver/lib_internal/pathinfo.h b/util-vserver/lib_internal/pathinfo.h deleted file mode 100644 index 9e6c045..0000000 --- a/util-vserver/lib_internal/pathinfo.h +++ /dev/null @@ -1,33 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_PATHINFO_H -#define H_UTIL_VSERVER_LIB_INTERNAL_PATHINFO_H - -#include "string.h" - -#define ENSC_PI_DECLARE(VAR,VAL) PathInfo VAR={.d = VAL,.l = sizeof(VAL)-1} -#define ENSC_PI_APPSZ(P1,P2) ((P1).l + sizeof("/") + (P2).l) - -typedef String PathInfo; - -void PathInfo_append(PathInfo * restrict, - PathInfo const * restrict, - char *buf) NONNULL((1,2,3)); - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_PATHINFO_H diff --git a/util-vserver/lib_internal/string-destroy.c b/util-vserver/lib_internal/string-destroy.c deleted file mode 100644 index 517056f..0000000 --- a/util-vserver/lib_internal/string-destroy.c +++ /dev/null @@ -1,29 +0,0 @@ -// $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 -#endif - -#include "string.h" - -void -String_destroy(String *str) -{ - free((char *)(str->d)); -} diff --git a/util-vserver/lib_internal/string.h b/util-vserver/lib_internal/string.h deleted file mode 100644 index 81b3e73..0000000 --- a/util-vserver/lib_internal/string.h +++ /dev/null @@ -1,35 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_STRING_H -#define H_UTIL_VSERVER_LIB_INTERNAL_STRING_H - -#include - -typedef struct -{ - char const * d; - size_t l; -} String; - -static void String_init(String *); -void String_destroy(String *); - -#include "string.hc" - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_STRING_H diff --git a/util-vserver/lib_internal/string.hc b/util-vserver/lib_internal/string.hc deleted file mode 100644 index 251d597..0000000 --- a/util-vserver/lib_internal/string.hc +++ /dev/null @@ -1,23 +0,0 @@ -// $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. - -static inline UNUSED void -String_init(String *str) -{ - str->d = 0; - str->l = 0; -} diff --git a/util-vserver/lib_internal/switchtowatchxid.c b/util-vserver/lib_internal/switchtowatchxid.c deleted file mode 100644 index f88805d..0000000 --- a/util-vserver/lib_internal/switchtowatchxid.c +++ /dev/null @@ -1,83 +0,0 @@ -// $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 -#endif - -#include -#include -#include - - // try to switch in context 1 -bool -switchToWatchXid(char const **errptr) -{ -#if 0 -# warning Compiling in debug-code - return; -#endif - if (vc_get_task_xid(0)==1) return true; - - if (vc_isSupported(vcFEATURE_MIGRATE)) { - int max_tries = 20; - again: - if (vc_ctx_create(1)==VC_NOCTX) { - if (errno==EBUSY && --max_tries>0) { - usleep(50000); - goto again; - } - - if (errno!=EEXIST) { - if (errptr) *errptr = "vc_create_context()"; - return false; - } - - if (vc_ctx_migrate(1)==-1) { - if (errptr) *errptr = "vc_migrate_context()"; - return false; - } - } - else { - struct vc_ctx_flags flags = { - .flagword = 0, - .mask = VC_VXF_STATE_SETUP, - }; - - if (vc_set_cflags(1, &flags)==-1) { - if (errptr) *errptr = "vc_set_cflags()"; - return false; - } - } - } - else { -#if VC_ENABLE_API_COMPAT - if (vc_new_s_context(1,0,0)==VC_NOCTX) { - if (errptr) *errptr = "vc_new_s_context()"; - return false; - } -#else - if (errptr) *errptr = "can not change context: migrate kernel feature missing and 'compat' API disabled"; - errno = ENOSYS; - return false; -#endif - } - - return true; -} - diff --git a/util-vserver/lib_internal/testsuite/.cvsignore b/util-vserver/lib_internal/testsuite/.cvsignore deleted file mode 100644 index 236eb99..0000000 --- a/util-vserver/lib_internal/testsuite/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.dirstamp -.libs -.libs -command diff --git a/util-vserver/lib_internal/testsuite/Makefile-files b/util-vserver/lib_internal/testsuite/Makefile-files deleted file mode 100644 index a968b68..0000000 --- a/util-vserver/lib_internal/testsuite/Makefile-files +++ /dev/null @@ -1,22 +0,0 @@ -## $Id$ --*- makefile -*-- - -## 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. - -check_PROGRAMS += lib_internal/testsuite/command - -lib_internal_testsuite_command_SOURCES = lib_internal/testsuite/command.c -lib_internal_testsuite_command_LDADD = lib_internal/libinternal.a \ - libensc_vector.a diff --git a/util-vserver/lib_internal/testsuite/command.c b/util-vserver/lib_internal/testsuite/command.c deleted file mode 100644 index 3dd5235..0000000 --- a/util-vserver/lib_internal/testsuite/command.c +++ /dev/null @@ -1,48 +0,0 @@ -// $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 -#endif - -#include -#include - -int wrapper_exit_code = 255; - -int -main(int argc, char *argv[]) -{ - struct Command cmd; - ssize_t i; - - if (argc<3) { - WRITE_MSG(2, "Not enough parameters\n"); - return EXIT_FAILURE; - } - - Command_init(&cmd, 5); - for (i=2; i -// -// 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 -#endif - -#include "unify.h" -#include -#include -#include -#include - -#define ENSC_WRAPPERS_IO 1 -#include - -static inline bool -verifySource(int fd, struct stat const *exp_stat) -{ - struct stat st; - - return (fstat(fd, &st)!=-1 && - st.st_dev==exp_stat->st_dev && - st.st_ino==exp_stat->st_ino); -} - -static inline bool -copyLnk(char const *src, char const *dst) -{ - ssize_t len = 1024; - for (;;) { - char buf[len]; - ssize_t l; - l = readlink(src, buf, len-1); - if (l==-1) return false; - if (l>=len-1) { - len *= 2; - continue; - } - buf[l] = '\0'; - - return (symlink(buf, dst)!=-1); - } -} - -static inline bool -copyReg(char const *src, struct stat const *src_stat, - char const *dst) -{ - int in_fd = open(src, O_RDONLY|O_NOCTTY|O_NONBLOCK|O_NOFOLLOW|O_LARGEFILE); - int out_fd = in_fd==-1 ? -1 : open(dst, O_CREAT|O_EXCL, 0200); - bool res = false; - - if (in_fd==-1 || out_fd==-1 || - !verifySource(in_fd, src_stat)) goto err; - - for (;;) { - char buf[2048]; - ssize_t l = read(in_fd, buf, sizeof buf); - if (l==-1) goto err; - if (l==0) break; - if (!WwriteAll(out_fd, buf, l, 0)) return false; - } - - res = true; - - err: - if (out_fd!=-1 && close(out_fd)==-1) res=false; - if (in_fd!=-1 && close(in_fd)==-1) res=false; - return res; -} - -static inline bool -copyNode(char const UNUSED *src, struct stat const *src_stat, - char const *dst) -{ - return mknod(dst, src_stat->st_mode & (S_IFMT|S_IWUSR), - src_stat->st_rdev)!=-1; -} - -static inline bool -copyDir(char const UNUSED *src, struct stat const UNUSED *src_stat, - char const *dst) -{ - return mkdir(dst, 0700)!=-1; -} - -static inline bool -setModes(char const *path, struct stat const *st) -{ - return (lchown(path, st->st_uid, st->st_gid)!=-1 && - (S_ISLNK(st->st_mode) || chmod(path, st->st_mode)!=-1)); -} - - -bool -Unify_copy(char const *src, struct stat const *src_stat, - char const *dst) -{ - // skip sockets - // TODO: message - if (S_ISSOCK(src_stat->st_mode)) - return true; - - return - (((S_ISLNK (src_stat->st_mode) && copyLnk (src, dst)) || - (S_ISREG (src_stat->st_mode) && copyReg (src, src_stat, dst)) || - (S_ISDIR (src_stat->st_mode) && copyDir (src, src_stat, dst)) || - ((S_ISBLK (src_stat->st_mode) || - S_ISCHR (src_stat->st_mode) || - S_ISFIFO(src_stat->st_mode)) && copyNode(src, src_stat, dst)) - ) && - setModes(dst, src_stat) && - Unify_setTime(dst, src_stat)); -} diff --git a/util-vserver/lib_internal/unify-deunify.c b/util-vserver/lib_internal/unify-deunify.c deleted file mode 100644 index fe4bd1e..0000000 --- a/util-vserver/lib_internal/unify-deunify.c +++ /dev/null @@ -1,125 +0,0 @@ -// $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 -#endif - -#include "unify.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#define ENSC_WRAPPERS_IO 1 -#include - -bool -Unify_deUnify(char const *dst) -{ - size_t l = strlen(dst); - char tmpfile[l + sizeof(";XXXXXX")]; - int fd_src, fd_tmp; - struct stat st; - struct utimbuf utm; - - fd_src = open(dst, O_RDONLY); - if (fd_src==-1) { - perror("open()"); - return false; - } - - if (fstat(fd_src, &st)==-1) { - perror("fstat()"); - close(fd_src); - return false; - } - - memcpy(tmpfile, dst, l); - memcpy(tmpfile+l, ";XXXXXX", 8); - fd_tmp = mkstemp(tmpfile); - - if (fd_tmp==-1) { - perror("mkstemp()"); - tmpfile[0] = '\0'; - goto err; - } - - if (fchown(fd_tmp, st.st_uid, st.st_gid)==-1 || - fchmod(fd_tmp, st.st_mode)==-1) { - perror("fchown()/fchmod()"); - goto err; - } - - // todo: acl? - - for (;;) { - char buf[0x4000]; - ssize_t len = read(fd_src, buf, sizeof buf); - if (len==-1) { - perror("read()"); - goto err; - } - if (len==0) break; - - if (!WwriteAll(fd_tmp, buf, len, 0)) goto err; - } - - if (close(fd_src)==-1) { - perror("close()"); - goto err; - } - if (close(fd_tmp)==-1) { - perror("close()"); - goto err; - } - - utm.actime = st.st_atime; - utm.modtime = st.st_mtime; - - // ALERT: race !!! - if (utime(tmpfile, &utm)==-1) { - perror("utime()"); - goto err1; - } - - if (unlink(dst)==-1) { - perror("unlink()"); - goto err1; - } - - // ALERT: race !!! - if (rename(tmpfile, dst)==-1) { - perror("FATAL error in rename()"); - _exit(1); - } - - return true; - - err: - close(fd_src); - close(fd_tmp); - err1: - if (tmpfile[0]) unlink(tmpfile); - - return false; -} diff --git a/util-vserver/lib_internal/unify-settime.c b/util-vserver/lib_internal/unify-settime.c deleted file mode 100644 index acc07b9..0000000 --- a/util-vserver/lib_internal/unify-settime.c +++ /dev/null @@ -1,39 +0,0 @@ -// $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 -#endif - -#include "unify.h" -#include -#include - -bool -Unify_setTime(char const *dst, struct stat const *st) -{ - struct utimbuf utm; - - // skip symlinks - if (S_ISLNK(st->st_mode)) return true; - - utm.actime = st->st_atime; - utm.modtime = st->st_mtime; - return utime(dst, &utm)!=-1; -} - diff --git a/util-vserver/lib_internal/unify-unify.c b/util-vserver/lib_internal/unify-unify.c deleted file mode 100644 index 8c69cce..0000000 --- a/util-vserver/lib_internal/unify-unify.c +++ /dev/null @@ -1,95 +0,0 @@ -// $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 -#endif - -#include "unify.h" -#include "vserver.h" - -#include -#include -#include -#include -#include - -bool -Unify_unify(char const *src, struct stat const UNUSED *src_stat, - char const *dst) -{ - size_t l = strlen(dst); - char tmpfile[l + sizeof(";XXXXXX")]; - int fd; - bool res = false; - struct stat st; - - // at first, set the ILI flags on 'src' - if (vc_set_iattr(src, - 0, - VC_IATTR_IUNLINK|VC_IATTR_IMMUTABLE, - VC_IATTR_IUNLINK|VC_IATTR_IMMUTABLE)==-1) - return false; - - // check if 'dst' already exists - if (lstat(dst, &st)==0) { - // now, create a temporary filename - memcpy(tmpfile, dst, l); - memcpy(tmpfile+l, ";XXXXXX", 8); - fd = mkstemp(tmpfile); - close(fd); - - if (fd==-1) { - perror("mkstemp()"); - return false; - } - - // and rename the old file to this name - - // NOTE: this rename() is race-free; when an attacker makes 'tmpfile' a - // directory, the operation would fail; when making it a symlink to a file - // or directory, the symlink but not the file/directory would be overridden - if (rename(dst, tmpfile)==-1) { - perror("rename()"); - goto err; - } - } - else - tmpfile[0] = '\0'; - - // now, link the src-file to dst - if (link(src, dst)==-1) { - perror("link()"); - - unlink(dst); - if (tmpfile[0]!='\0' && - rename(tmpfile, dst)==-1) { - perror("FATAL error in rename()"); - _exit(1); - } - goto err; - } - - res = true; - - err: - if (tmpfile[0]!='\0') - unlink(tmpfile); - - return res; -} diff --git a/util-vserver/lib_internal/unify.h b/util-vserver/lib_internal/unify.h deleted file mode 100644 index 8732b30..0000000 --- a/util-vserver/lib_internal/unify.h +++ /dev/null @@ -1,55 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_UNIFY_H -#define H_UTIL_VSERVER_LIB_INTERNAL_UNIFY_H - -#include - -struct stat; - -bool -Unify_unify(char const *src, struct stat const *src_stat, - char const *dst) NONNULL((1,2,3)); - -bool -Unify_copy(char const *src, struct stat const *src_stat, - char const *dst) NONNULL((1,2,3)); - -bool -Unify_deUnify(char const *dst) NONNULL((1)); - -bool -Unify_setTime(char const *dst, struct stat const *stat) NONNULL((1,2)); - - -#define Unify_isUnified(LHS, RHS) \ - ((bool)((LHS)->st_dev ==(RHS)->st_dev && \ - (LHS)->st_ino ==(RHS)->st_ino)) - -#define Unify_isUnifyable(LHS, RHS) \ - ((bool)((LHS)->st_dev ==(RHS)->st_dev && \ - (LHS)->st_ino !=(RHS)->st_ino && \ - (LHS)->st_mode ==(RHS)->st_mode && \ - (LHS)->st_uid ==(RHS)->st_uid && \ - (LHS)->st_gid ==(RHS)->st_gid && \ - (LHS)->st_size ==(RHS)->st_size && \ - (LHS)->st_mtime==(RHS)->st_mtime)) - - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_UNIFY_H diff --git a/util-vserver/lib_internal/util-canonify.c b/util-vserver/lib_internal/util-canonify.c deleted file mode 100644 index 159c70f..0000000 --- a/util-vserver/lib_internal/util-canonify.c +++ /dev/null @@ -1,40 +0,0 @@ -// $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 -#endif - -#include "util.h" - -size_t -canonifyVserverName(char *name) -{ - char *in = name; - char *out = name; - - while (*in) { - if ((*in>='a' && *in<='z') || - (*in>='A' && *in<='Z') || - (*in>='0' && *in<='9')) - *out++ = *in; - ++in; - } - *out = '\0'; - return out-name; -} diff --git a/util-vserver/lib_internal/util-cast.h b/util-vserver/lib_internal/util-cast.h deleted file mode 100644 index e9fa78d..0000000 --- a/util-vserver/lib_internal/util-cast.h +++ /dev/null @@ -1,33 +0,0 @@ -// $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. - - -#ifndef H_UTILVSERVER_LIB_INTERNAL_UTIL_CAST_H -#define H_UTILVSERVER_LIB_INTERNAL_UTIL_CAST_H - -#ifndef __cplusplus -# define cAsT_(X) (X)) -# define reinterpret_cast(X) ((X) cAsT_ -# define static_cast(X) ((X) cAsT_ -# define const_cast(X) ((X) cAsT_ -#else /* __cplusplus */ -# define reinterpret_cast(X) reinterpret_cast -# define static_cast(X) static_cast -# define const_cast(X) const_cast -#endif - -#endif // H_UTILVSERVER_LIB_INTERNAL_UTIL_CAST_H diff --git a/util-vserver/lib_internal/util-commonstrings.h b/util-vserver/lib_internal/util-commonstrings.h deleted file mode 100644 index d7053ab..0000000 --- a/util-vserver/lib_internal/util-commonstrings.h +++ /dev/null @@ -1,32 +0,0 @@ -// $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. - - -#ifndef H_UTILVSERVER_LIB_INTERNAL_UTIL_COMMONSTRINGS_H -#define H_UTILVSERVER_LIB_INTERNAL_UTIL_COMMONSTRINGS_H - -#ifndef PACKAGE_BUGREPORT -# define PACKAGE_BUGREPORT "???" -#endif - -#ifndef VERSION_COPYRIGHT_DISCLAIMER -# define VERSION_COPYRIGHT_DISCLAIMER \ - "This program is free software; you may redistribute it under the terms of\n" \ - "the GNU General Public License. This program has absolutely no warranty.\n" -#endif - -#endif // H_UTILVSERVER_LIB_INTERNAL_UTIL_COMMONSTRINGS_H diff --git a/util-vserver/lib_internal/util-debug.h b/util-vserver/lib_internal/util-debug.h deleted file mode 100644 index 8047816..0000000 --- a/util-vserver/lib_internal/util-debug.h +++ /dev/null @@ -1,30 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_UTIL_DEBUG_H -#define H_UTIL_VSERVER_LIB_INTERNAL_UTIL_DEBUG_H - -#ifdef ENSC_ENABLE_DPRINTF -# include -# define DPRINTF(FMT,...) printf(FMT, __VA_ARGS__) -#else -# define DPRINTF(FMT,...) do {} while(0) -#endif - - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_UTIL_DEBUG_H diff --git a/util-vserver/lib_internal/util-declarecmd.h b/util-vserver/lib_internal/util-declarecmd.h deleted file mode 100644 index 0c253a2..0000000 --- a/util-vserver/lib_internal/util-declarecmd.h +++ /dev/null @@ -1,27 +0,0 @@ -// $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. - - -#ifndef H_UTILVSERVER_LIB_INTERNAL_UTIL_DECLARECMD_H -#define H_UTILVSERVER_LIB_INTERNAL_UTIL_DECLARECMD_H - -#define VSERVER_DECLARE_CMD(CMD) \ - char buf[strlen(CMD)+1]; \ - memcpy(buf, (CMD), strlen(CMD)+1); \ - CMD = basename(buf); - -#endif // H_UTILVSERVER_LIB_INTERNAL_UTIL_DECLARECMD_H diff --git a/util-vserver/lib_internal/util-dimof.h b/util-vserver/lib_internal/util-dimof.h deleted file mode 100644 index 0fbe435..0000000 --- a/util-vserver/lib_internal/util-dimof.h +++ /dev/null @@ -1,24 +0,0 @@ -// $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. - - -#ifndef H_UTILVSERVER_LIB_INTERNAL_UTIL_DIMOF_H -#define H_UTILVSERVER_LIB_INTERNAL_UTIL_DIMOF_H - -#define DIM_OF(X) (sizeof(X)/sizeof((X)[0])) - -#endif // H_UTILVSERVER_LIB_INTERNAL_UTIL_DIMOF_H diff --git a/util-vserver/lib_internal/util-dotfile.h b/util-vserver/lib_internal/util-dotfile.h deleted file mode 100644 index fdf81a1..0000000 --- a/util-vserver/lib_internal/util-dotfile.h +++ /dev/null @@ -1,30 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_UTIL_DOTFILE_H -#define H_UTIL_VSERVER_LIB_INTERNAL_UTIL_DOTFILE_H - -#include - -static inline UNUSED ALWAYSINLINE bool -isDotfile(char const *d) -{ - return d[0]=='.' && (d[1]=='\0' || (d[1]=='.' && d[2]=='\0')); -} - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_UTIL_DOTFILE_H diff --git a/util-vserver/lib_internal/util-exitlikeprocess.c b/util-vserver/lib_internal/util-exitlikeprocess.c deleted file mode 100644 index 4a94eb1..0000000 --- a/util-vserver/lib_internal/util-exitlikeprocess.c +++ /dev/null @@ -1,90 +0,0 @@ -// $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 -#endif - -#include "util.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -void -exitLikeProcess(int pid, char const *cmd, int ret) -{ - int status; - - if (wait4(pid, &status, 0,0)==-1) { - - perror("wait()"); - exit(ret); - } - - if (WIFEXITED(status)) - exit(WEXITSTATUS(status)); - - if (WIFSIGNALED(status)) { - struct rlimit lim = { 0,0 }; - - if (cmd) { - char buf[sizeof(int)*3 + 2]; - size_t l = utilvserver_fmt_uint(buf, pid); - - WRITE_MSG(2, "command '"); - WRITE_STR(2, cmd); - WRITE_MSG(2, "' (pid "); - write (2, buf, l); - WRITE_MSG(2, ") exited with signal "); - l = utilvserver_fmt_uint(buf, WTERMSIG(status)); - write (2, buf, l); - WRITE_MSG(2, "; following it...\n"); - } - - // prevent coredumps which might override the real ones - setrlimit(RLIMIT_CORE, &lim); - - kill(getpid(), WTERMSIG(status)); - exit(1); - } - else { - char buf[sizeof(int)*3 + 2]; - size_t l = utilvserver_fmt_uint(buf, WTERMSIG(status)); - - WRITE_MSG(2, "Unexpected status "); - write (2, buf, l); - WRITE_MSG(2, " from '"); - if (cmd) { - WRITE_STR(2, cmd); - WRITE_MSG(2, " (pid "); - } - l = utilvserver_fmt_uint(buf, pid); - write (2, buf, l); - if (cmd) WRITE_MSG(2, ")\n"); - else WRITE_MSG(2, "\n"); - - exit(ret); - } -} diff --git a/util-vserver/lib_internal/util-exitlikeprocess.h b/util-vserver/lib_internal/util-exitlikeprocess.h deleted file mode 100644 index d31a804..0000000 --- a/util-vserver/lib_internal/util-exitlikeprocess.h +++ /dev/null @@ -1,25 +0,0 @@ -// $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. - - -#ifndef H_UTILVSERVER_LIB_INTERNAL_UTIL_EXITLIKEPROCESS_H -#define H_UTILVSERVER_LIB_INTERNAL_UTIL_EXITLIKEPROCESS_H - -#include -void exitLikeProcess(pid_t pid, char const /*@null@*/ *cmd, int ret) NORETURN; - -#endif // H_UTILVSERVER_LIB_INTERNAL_UTIL_EXITLIKEPROCESS_H diff --git a/util-vserver/lib_internal/util-io.h b/util-vserver/lib_internal/util-io.h deleted file mode 100644 index d4519e7..0000000 --- a/util-vserver/lib_internal/util-io.h +++ /dev/null @@ -1,35 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_UTIL_IO_H -#define H_UTIL_VSERVER_LIB_INTERNAL_UTIL_IO_H - -#include -#include - -inline static void UNUSED -writeStr(int fd, char const *cmd) -{ - (void)write(fd, cmd, strlen(cmd)); -} - -#define WRITE_MSG(FD,X) (void)(write(FD,X,sizeof(X)-1)) -#define WRITE_STR(FD,X) writeStr(FD,X) - - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_UTIL_IO_H diff --git a/util-vserver/lib_internal/util-lockfile.c b/util-vserver/lib_internal/util-lockfile.c deleted file mode 100644 index b08f5a3..0000000 --- a/util-vserver/lib_internal/util-lockfile.c +++ /dev/null @@ -1,86 +0,0 @@ -// $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 -#endif - -#include "util-lockfile.h" -#include "errinfo.h" - -#include -#include -#include -#include -#include -#include - -static volatile sig_atomic_t alarm_flag = 0; - -static void -alarmFunc(int UNUSED sig) -{ - alarm_flag = 1; - signal(SIGALRM, alarmFunc); -} - -bool -lockfile(int *fd, char const *filename, int op, long timeout, - struct ErrorInformation *err) -{ - char const *errstr = 0; - void (*old_sighandler)(int) = 0; - - errstr = "open()"; - *fd = open(filename, O_CREAT|O_RDONLY|O_NOFOLLOW|O_NONBLOCK, 0644); - if (*fd==-1) goto err; - - if (timeout!=-1) { - errstr = "siginterrupt()"; - if (siginterrupt(SIGALRM, 1)==-1) goto err; - - errstr = "signal()"; - old_sighandler = signal(SIGALRM, alarmFunc); - if (old_sighandler==SIG_ERR) goto err; - - alarm(timeout); - } - - errstr = "flock()"; - while (flock(*fd, op)==-1) { - if ((errno!=EINTR && errno!=EINTR) || alarm_flag) goto err; - } - - if (timeout!=-1 && old_sighandler!=0) - signal(SIGALRM, old_sighandler); - - errstr = "fcntl()"; - if (fcntl(*fd, F_SETFD, FD_CLOEXEC)==-1) goto err; - - return true; - - err: - if (err) { - err->pos = errstr; - err->id = errno; - } - if (timeout!=-1 && old_sighandler!=0) - signal(SIGALRM, old_sighandler); - if (*fd!=-1) close(*fd); - return false; -} diff --git a/util-vserver/lib_internal/util-lockfile.h b/util-vserver/lib_internal/util-lockfile.h deleted file mode 100644 index d8ac09c..0000000 --- a/util-vserver/lib_internal/util-lockfile.h +++ /dev/null @@ -1,30 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_UTIL_LOCKFILE_H -#define H_UTIL_VSERVER_LIB_INTERNAL_UTIL_LOCKFILE_H - -#include - -struct ErrorInformation; - -bool lockfile(int *fd, char const *filename, int op, - long timeout, - struct ErrorInformation *err); - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_UTIL_LOCKFILE_H diff --git a/util-vserver/lib_internal/util-mem.h b/util-vserver/lib_internal/util-mem.h deleted file mode 100644 index 4427a14..0000000 --- a/util-vserver/lib_internal/util-mem.h +++ /dev/null @@ -1,31 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_UTIL_MEM_H -#define H_UTIL_VSERVER_LIB_INTERNAL_UTIL_MEM_H - -#include -#include - -inline static void * -Xmemcpy(void * restrict dst, void const * restrict src, size_t len) -{ - return (char *)(memcpy(dst, src, len))+len; -} - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_UTIL_MEM_H diff --git a/util-vserver/lib_internal/util-perror.h b/util-vserver/lib_internal/util-perror.h deleted file mode 100644 index 4f516f5..0000000 --- a/util-vserver/lib_internal/util-perror.h +++ /dev/null @@ -1,44 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_UTIL_PERROR_H -#define H_UTIL_VSERVER_LIB_INTERNAL_UTIL_PERROR_H - -#define PERROR_U(MSG, ARG0) do { \ - size_t pu_l1 = strlen(MSG); \ - size_t pu_l2 = strlen(ARG0); \ - char pu_buf[pu_l1 + pu_l2 + sizeof("()")]; \ - memcpy(pu_buf, MSG, pu_l1); \ - pu_buf[pu_l1] = '('; \ - memcpy(pu_buf+1+pu_l1, ARG0, pu_l2); \ - pu_buf[pu_l1+1+pu_l2] = ')'; \ - pu_buf[pu_l1+2+pu_l2] = '\0'; \ - perror(pu_buf); \ - } while (0) - -#define PERROR_Q(MSG, ARG0) do { \ - size_t pq_l = strlen(ARG0); \ - char pq_buf[pq_l + 3]; \ - pq_buf[0] = '"'; \ - memcpy(pq_buf+1, ARG0, pq_l); \ - pq_buf[pq_l+1] = '"'; \ - pq_buf[pq_l+2] = '\0'; \ - PERROR_U(MSG, pq_buf); \ - } while (0) - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_UTIL_PERROR_H diff --git a/util-vserver/lib_internal/util-safechdir.c b/util-vserver/lib_internal/util-safechdir.c deleted file mode 100644 index 8526ddf..0000000 --- a/util-vserver/lib_internal/util-safechdir.c +++ /dev/null @@ -1,50 +0,0 @@ -// $Id$ --*- c -*-- - -// Copyright (C) 2003 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 -#endif - -#include -#include -#include -#include -#include - -int -safeChdir(char const *path, struct stat const *exp_stat) -{ - if (strchr(path, '/')!=0) { - errno = EINVAL; - return -1; - } - - { - struct stat now_stat; - if (chdir(path)==-1 || - stat(".", &now_stat)==-1) return -1; - if (exp_stat->st_dev != now_stat.st_dev || - exp_stat->st_ino != now_stat.st_ino) { - // TODO: warning/logging - errno = EINVAL; - return -1; - } - } - - return 0; -} diff --git a/util-vserver/lib_internal/util-safechdir.h b/util-vserver/lib_internal/util-safechdir.h deleted file mode 100644 index 656953d..0000000 --- a/util-vserver/lib_internal/util-safechdir.h +++ /dev/null @@ -1,28 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_UTIL_SAFECHDIR_H -#define H_UTIL_VSERVER_LIB_INTERNAL_UTIL_SAFECHDIR_H - -struct stat; -int safeChdir(char const *, struct stat const *exp_stat) NONNULL((1,2)); - -#define EsafeChdir(PATH,EXP_STAT) \ - FatalErrnoError(safeChdir(PATH,EXP_STAT)==-1, "safeChdir()") - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_UTIL_SAFECHDIR_H diff --git a/util-vserver/lib_internal/util-unixsock.h b/util-vserver/lib_internal/util-unixsock.h deleted file mode 100644 index 5de918c..0000000 --- a/util-vserver/lib_internal/util-unixsock.h +++ /dev/null @@ -1,27 +0,0 @@ -// $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. - - -#ifndef H_UTIL_VSERVER_LIB_INTERNAL_UTIL_UNIXSOCK_H -#define H_UTIL_VSERVER_LIB_INTERNAL_UTIL_UNIXSOCK_H - -#define ENSC_INIT_UNIX_SOCK(ADDR, FILENAME) \ - (ADDR).sun_family = AF_UNIX; \ - strncpy((ADDR).sun_path, FILENAME, sizeof((ADDR).sun_path)); \ - (ADDR).sun_path[sizeof((ADDR).sun_path)-1] = '\0'; - -#endif // H_UTIL_VSERVER_LIB_INTERNAL_UTIL_UNIXSOCK_H diff --git a/util-vserver/lib_internal/util.h b/util-vserver/lib_internal/util.h deleted file mode 100644 index 3d43c12..0000000 --- a/util-vserver/lib_internal/util.h +++ /dev/null @@ -1,39 +0,0 @@ -// $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. - - -#ifndef H_UTILVSERVER_LIB_INTERNAL_UTIL_H -#define H_UTILVSERVER_LIB_INTERNAL_UTIL_H - -#include "util-cast.h" -#include "util-commonstrings.h" -#include "util-debug.h" -#include "util-declarecmd.h" -#include "util-dimof.h" -#include "util-dotfile.h" -#include "util-exitlikeprocess.h" -#include "util-io.h" -#include "util-lockfile.h" -#include "util-mem.h" -#include "util-perror.h" -#include "util-safechdir.h" -#include "util-unixsock.h" - -bool switchToWatchXid(char const **); -size_t canonifyVserverName(char *); - -#endif // H_UTILVSERVER_LIB_INTERNAL_UTIL_H diff --git a/util-vserver/m4/changelog.am b/util-vserver/m4/changelog.am deleted file mode 100644 index 9afdf54..0000000 --- a/util-vserver/m4/changelog.am +++ /dev/null @@ -1,36 +0,0 @@ -## $Id$ ---*- makefile -*--- - -## Copyright (C) 2002 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. -## - -ChangeLog.sed: - test "$(srcdir)" != "." - -if HAVE_CVS2CL -ChangeLog: Makefile - if test "$(srcdir)" = "." -a -d CVS; then \ - $(CVS2CL) $(CVS2CL_ALLFLAGS) -f $@; \ - fi -else -if HAVE_RCS2LOG -ChangeLog: ChangeLog.sed Makefile - if test "$(srcdir)" = "." -a -d CVS; then \ - $(RCS2LOG) -l 0 -c /dev/stdout | sed -f $< >$@; \ - fi -endif -endif - -.PHONY: ChangeLog diff --git a/util-vserver/m4/ensc_cflags.m4 b/util-vserver/m4/ensc_cflags.m4 deleted file mode 100644 index 92f546f..0000000 --- a/util-vserver/m4/ensc_cflags.m4 +++ /dev/null @@ -1,112 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2002 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -AC_DEFUN([__ENSC_CHECK_WARNFLAGS], -[ - warn_flags="-Werror -W" - AC_MSG_CHECKING([whether the $1-compiler accepts ${warn_flags}]) - AC_LANG_PUSH($1) - __ensc_check_warnflags_old_CFLAGS="${$3}" - $3="$warn_flags" - AC_TRY_COMPILE([inline static void f(){}], - [], - [ensc_sys_compilerwarnflags_$2=${warn_flags}], - [ensc_sys_compilerwarnflags_$2=]) - AC_LANG_POP($1) - $3="$__ensc_check_warnflags_old_CFLAGS" - - if test x"${ensc_sys_compilerwarnflags_$2}" = x; then - AC_MSG_RESULT([no]) - else - AC_MSG_RESULT([yes]) - fi -]) - -AC_DEFUN([__ENSC_CHECK_WARNFLAGS_C], -[ - __ENSC_CHECK_WARNFLAGS(C, C, CFLAGS) -]) - -AC_DEFUN([__ENSC_CHECK_WARNFLAGS_CXX], -[ - __ENSC_CHECK_WARNFLAGS(C++, CXX, CXXFLAGS) -]) - - -# -------------------------------------------------------------------------- -# Check whether the C++ compiler accepts a certain flag -# If it does it adds the flag to CXXFLAGS -# If it does not then it returns an error to lf_ok -# Usage: -# ENSC_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...) -# ------------------------------------------------------------------------- - -AC_DEFUN([ENSC_CHECK_CXX_FLAG], -[ - AC_REQUIRE([__ENSC_CHECK_WARNFLAGS_CXX]) - - echo 'void f(){}' > conftest.cc - for i in $1 - do - AC_MSG_CHECKING([whether $CXX accepts $i]) - if test -z "`${CXX} ${ensc_sys_compilerwarnflags_CXX} $i -c conftest.cc 2>&1`" - then - CXXFLAGS="${CXXFLAGS} $i" - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - done - rm -f conftest.cc conftest.o -]) - -# -------------------------------------------------------------------------- -# Check whether the C compiler accepts a certain flag -# If it does it adds the flag to CFLAGS -# If it does not then it returns an error to lf_ok -# Usage: -# ENSC_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...) -# ------------------------------------------------------------------------- - -AC_DEFUN([ENSC_CHECK_CC_FLAG], -[ - AC_REQUIRE([__ENSC_CHECK_WARNFLAGS_C]) - -echo 'void f(){}' > conftest.c - for i in $1 - do - AC_MSG_CHECKING([whether $CC accepts $i]) - if test -z "`${CC} ${ensc_sys_compilerwarnflags_C} $i -c conftest.c 2>&1`" - then - CFLAGS="${CFLAGS} $i" - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - done - rm -f conftest.c conftest.o -]) - -AC_DEFUN([ENSC_CHECK_DEFAULT_FLAG], -[ - if test x"${ensc_sys_default_flag}" = x; then - ENSC_CHECK_CC_FLAG([-fmessage-length=0]) - ENSC_CHECK_CXX_FLAG([-fmessage-length=0]) - - ensc_sys_default_flag=set - fi -]) diff --git a/util-vserver/m4/ensc_changelog.m4 b/util-vserver/m4/ensc_changelog.m4 deleted file mode 100644 index 6944781..0000000 --- a/util-vserver/m4/ensc_changelog.m4 +++ /dev/null @@ -1,31 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2002 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -dnl Usage: ENSC_CHANGELOG() - -AC_DEFUN([ENSC_CHANGELOG], -[ - if test x"$1" != x; then - AC_SUBST(CVS2CL_TAG, ['-F $1']) - fi - - AC_CHECK_PROGS(CVS2CL, [cvs2cl]) - AM_CONDITIONAL(HAVE_CVS2CL, [test x"$CVS2CL" != x]) - - AC_CHECK_PROGS(RCS2LOG, [rcs2log]) - AM_CONDITIONAL(HAVE_RCS2LOG, [test x"$RCS2LOG" != x]) -]) diff --git a/util-vserver/m4/ensc_cxxcompiler.m4 b/util-vserver/m4/ensc_cxxcompiler.m4 deleted file mode 100644 index ac92dbc..0000000 --- a/util-vserver/m4/ensc_cxxcompiler.m4 +++ /dev/null @@ -1,66 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2002 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -AC_DEFUN([ENSC_CXXCOMPILER], -[ - AC_REQUIRE([AC_PROG_CXX]) - - AC_CACHE_CHECK([whether $CXX is a C++ compiler], [ensc_cv_cxx_cxxcompiler], - [ - AC_LANG_PUSH(C++) - AC_COMPILE_IFELSE([ - #include - ], - [ensc_cv_cxx_cxxcompiler=yes], - [ensc_cv_cxx_cxxcompiler=no]) - AC_LANG_POP(C++) - ]) - - AM_CONDITIONAL(ENSC_HAVE_CXX_COMPILER, - [test x"$ensc_cv_cxx_cxxcompiler" = xyes]) - - if test x"$ensc_cv_cxx_cxxcompiler" = xno; then - AC_MSG_WARN([*** some programs will not be built because a C++ compiler is lacking]) - fi -]) - -AC_DEFUN([ENSC_C99COMPILER], -[ - AC_REQUIRE([AC_PROG_CC]) - - AC_CACHE_CHECK([whether $CC is a C99 compiler], [ensc_cv_c99_c99compiler], - [ - AC_LANG_PUSH(C) - AC_COMPILE_IFELSE([ -int main(int argc, char *argv[]) { - struct { int x; } a = { .x = argc }; - if (0) return 0; - int b; -} - ], - [ensc_cv_c99_c99compiler=yes], - [ensc_cv_c99_c99compiler=no]) - AC_LANG_POP(C) - ]) - - AM_CONDITIONAL(ENSC_HAVE_C99_COMPILER, - [test x"$ensc_cv_c99_c99compiler" = xyes]) - - if test x"$ensc_cv_c99_c99compiler" = xno; then - AC_MSG_WARN([*** some programs will not be built because a C99 compiler is lacking]) - fi -]) diff --git a/util-vserver/m4/ensc_dietlibc.m4 b/util-vserver/m4/ensc_dietlibc.m4 deleted file mode 100644 index 0481eb8..0000000 --- a/util-vserver/m4/ensc_dietlibc.m4 +++ /dev/null @@ -1,119 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2002 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -AC_DEFUN([_ENSC_DIETLIBC_C99], -[ - AH_TEMPLATE([ENSC_DIETLIBC_C99], [Define to 1 if dietlibc supports C99]) - - AC_CACHE_CHECK([whether dietlibc supports C99], [ensc_cv_c_dietlibc_c99], - [ - _ensc_dietlibc_c99_old_CFLAGS=$CFLAGS - _ensc_dietlibc_c99_old_CC=$CC - - CFLAGS="-std=c99" - CC="${DIET:-diet} $CC" - - AC_LANG_PUSH(C) - AC_COMPILE_IFELSE([/* */],[ - AC_COMPILE_IFELSE([ - #include - #include - #if defined(inline) - # error 'inline' badly defined - #endif - volatile uint64_t a; - ], - [ensc_cv_c_dietlibc_c99=yes], - [ensc_cv_c_dietlibc_c99=no])], - [ensc_cv_c_dietlibc_c99='skipped (compiler does not support C99)']) - AC_LANG_POP - - CC=$_ensc_dietlibc_c99_old_CC - CFLAGS=$_ensc_dietlibc_c99_old_CFLAGS - ]) - - if test x"$ensc_cv_c_dietlibc_c99" = xyes; then - AC_DEFINE(ENSC_DIETLIBC_C99,1) - fi -]) - -dnl Usage: ENSC_ENABLE_DIETLIBC([,]) -dnl ... automake-conditional which will be set when -dnl dietlibc shall be enabled - -AC_DEFUN([ENSC_ENABLE_DIETLIBC], -[ - AC_MSG_CHECKING([whether to enable dietlibc]) - AC_ARG_ENABLE([dietlibc], - [AC_HELP_STRING([--disable-dietlibc], - [do not use dietlibc (default: use dietlibc)])], - [case "$enableval" in - yes) use_dietlibc=forced;; - no) use_dietlibc=forced_no;; - *) AC_MSG_ERROR(['$enableval' is not a valid value for --enable-dietlibc]);; - esac], - [: ${DIET:=diet} - which "$DIET" >/dev/null 2>/dev/null && use_dietlibc=detected || use_dietlibc=detected_no]) - - if test "$use_dietlibc" = detected -a '$2'; then - _dietlibc_ver=$(${DIET:-diet} -v 2>&1 | sed '1p;d') - _dietlibc_ver=${_dietlibc_ver##*dietlibc-} - _dietlibc_ver_maj=${_dietlibc_ver%%.*} - _dietlibc_ver_min=${_dietlibc_ver##*.} - _dietlibc_cmp=$2 - _dietlibc_cmp_maj=${_dietlibc_cmp%%.*} - _dietlibc_cmp_min=${_dietlibc_cmp##*.} - - let _dietlibc_ver=_dietlibc_ver_maj*1000+_dietlibc_ver_min 2>/dev/null || _dietlibc_ver=0 - let _dietlibc_cmp=_dietlibc_cmp_maj*1000+_dietlibc_cmp_min - - test $_dietlibc_ver -ge $_dietlibc_cmp || use_dietlibc=detected_old - fi - - ensc_have_dietlibc=no - case x"$use_dietlibc" in - xdetected) - AM_CONDITIONAL($1, true) - AC_MSG_RESULT([yes (autodetected)]) - ensc_have_dietlibc=yes - ;; - xforced) - AM_CONDITIONAL($1, true) - AC_MSG_RESULT([yes (forced)]) - ensc_have_dietlibc=yes - ;; - xdetected_no) - AM_CONDITIONAL($1, false) - AC_MSG_RESULT([no (detected)]) - ;; - xdetected_old) - AM_CONDITIONAL($1, false) - AC_MSG_RESULT([no (too old; $2+ required)]) - ;; - xforced_no) - AM_CONDITIONAL($1, false) - AC_MSG_RESULT([no (forced)]) - ;; - *) - AC_MSG_ERROR([internal error, use_dietlibc was "$use_dietlibc"]) - ;; - esac - - if test x"$ensc_have_dietlibc" != xno; then - _ENSC_DIETLIBC_C99 - fi -]) diff --git a/util-vserver/m4/ensc_dietlibc_compat.m4 b/util-vserver/m4/ensc_dietlibc_compat.m4 deleted file mode 100644 index fb7735f..0000000 --- a/util-vserver/m4/ensc_dietlibc_compat.m4 +++ /dev/null @@ -1,45 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2004 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -AC_DEFUN([ENSC_DIETLIBC_NEED_COMPAT], -[ - AC_REQUIRE([ENSC_ENABLE_DIETLIBC]) - AC_CACHE_CHECK([whether dietlibc needs '-lcompat'], [ensc_cv_c_dietlibc_compat], - [ - AC_LANG_PUSH(C) - ensc_dietlibc_need_compat_old_CC=$CC - CC="${DIET:-diet} $CC" - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([ -#include -#include -#include - -#define __NR_foo 0 -inline static _syscall0(int, foo) -], - [foo()])], - [ensc_cv_c_dietlibc_compat=no], - [ensc_cv_c_dietlibc_compat=yes]) - CC=$ensc_dietlibc_need_compat_old_CC - AC_LANG_POP - ]) - - if test x"$1" != x; then - AM_CONDITIONAL($1, test x"$ensc_cv_c_dietlibc_compat" = xyes) - fi -]) diff --git a/util-vserver/m4/ensc_e2fscheck.m4 b/util-vserver/m4/ensc_e2fscheck.m4 deleted file mode 100644 index 14ebfd4..0000000 --- a/util-vserver/m4/ensc_e2fscheck.m4 +++ /dev/null @@ -1,72 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2004 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -AC_DEFUN([ENSC_CHECK_EXT2FS_HEADER], -[ - AC_LANG_PUSH(C++) - AC_CACHE_CHECK([for ext2fs-headers], [ensc_cv_test_ext2fs_header],[ - AC_COMPILE_IFELSE(AC_LANG_SOURCE([#include - int main() { return 0; }]), - [ensc_cv_test_ext2fs_header=e2fsprogs],[ - AC_COMPILE_IFELSE(AC_LANG_SOURCE([#include - int main() { return 0; }]), - [ensc_cv_test_ext2fs_header=kernel],[ - ensc_cv_test_ext2fs_header=none])])]) - - case x"$ensc_cv_test_ext2fs_header" in - (xe2fsprogs) - AC_CHECK_HEADER([ext2fs/ext2_fs.h], - [AC_DEFINE(ENSC_HAVE_EXT2FS_EXT2_FS_H, 1, [define when is usable])], - [AC_MSG_FAILURE([unexpected error while checkin for ])]) - ;; - (xkernel) - AC_CHECK_HEADER([linux/ext2_fs.h], - [AC_DEFINE(ENSC_HAVE_LINUX_EXT2_FS_H, 1, [define when is usable])], - [AC_MSG_FAILURE([unexpected error while checkin for ])]) - ;; - (*) - AC_MSG_FAILURE([ -ext2fs headers were not found, or they are not usable. This can have -the following reasons: - -* you have neither the e2fsprogs nor the kernel headers installed - -* kernel headers are broken (e.g. these of linux 2.6 are known to be) - and you do not have e2fsprogs headers installed; please try to install - - e2fsprogs-devel (for Red Hat), or - - libext2fs2-devel (for Mandrake), or - - e2fslibs-dev (for Debian) - in this case. - -* kernel headers are broken and your e2fsprogs headers are too old; - until version 1.27 (inclusive), they are using reserved C++ keywords - -* kernel headers are broken and your e2fsprogs headers are too new; - recent (January 2004) BK snapshots of e2fsprogs are unusable for - C++, for details and a solution see - https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=112448 - - -In the latter two cases you have the following options: -* fix the headers manually, or -* install a stable version of e2fsprogs (e.g. 1.34), or -* use good kernel headers (from linux 2.4.x) -]) - ;; - esac - AC_LANG_POP -]) diff --git a/util-vserver/m4/ensc_fpicsyscall.m4 b/util-vserver/m4/ensc_fpicsyscall.m4 deleted file mode 100644 index 4cb11e3..0000000 --- a/util-vserver/m4/ensc_fpicsyscall.m4 +++ /dev/null @@ -1,41 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2002 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -AC_DEFUN([ENSC_FPIC_SYSCALL], -[ - AC_CACHE_CHECK([whether syscall() allows -fpic], [ensc_cv_c_fpic_syscall], - [ - ensc_fpic_syscall_old_CFLAGS=$CFLAGS - CFLAGS="-fPIC -DPIC" - - AC_LANG_PUSH(C) - AC_COMPILE_IFELSE([ - #include - #include - #include - #include - - #define __NR_dummy 42 - _syscall3(int, dummy, int, a, int, b, int, c)], - [ensc_cv_c_fpic_syscall=yes], [ensc_cv_c_fpic_syscall=no]) - AC_LANG_POP - - CFLAGS=$ensc_fpic_syscall_old_CFLAGS - ]) - - AM_CONDITIONAL(ENSC_ALLOW_FPIC_WITH_SYSCALL, [test x"$ensc_cv_c_fpic_syscall" = xyes]) -]) diff --git a/util-vserver/m4/ensc_initrddir.m4 b/util-vserver/m4/ensc_initrddir.m4 deleted file mode 100644 index 9697c64..0000000 --- a/util-vserver/m4/ensc_initrddir.m4 +++ /dev/null @@ -1,39 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2002 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -dnl Usage: ENSC_INITRDDIR() - -AC_DEFUN([ENSC_INITRDDIR], -[ - AC_MSG_CHECKING([for initrddir]) - AC_ARG_WITH([initrddir], - [AC_HELP_STRING([--with-initrddir ], - [use as directory for SysV init-files (default: $sysconfdir/rc.d)])], - [case "$withval" in - yes|no) AC_MSG_ERROR(['$withval' is not a valid value for '--with-initrddir']);; - *) ensc_initrddir=$withval;; - esac], - [ensc_initrddir='$(sysconfdir)/init.d']) - - if test "$1"; then - $1=$ensc_initrddir - AC_SUBST($1) - fi - - AC_MSG_RESULT($ensc_initrddir) -]) - diff --git a/util-vserver/m4/ensc_kerneldir.m4 b/util-vserver/m4/ensc_kerneldir.m4 deleted file mode 100644 index 8555e67..0000000 --- a/util-vserver/m4/ensc_kerneldir.m4 +++ /dev/null @@ -1,57 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2002 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -dnl Usage: ENSC_KERNEL_HEADERS() -dnl ... basedir of kernel-headers (without the '/linux'); -dnl this value will be AC_SUBST'ed - -AC_DEFUN([_ENSC_KERNEL_DIR], -[ - AC_CACHE_CHECK([for linux kernel dir], [ensc_cv_path_kerneldir], - [ -AC_ARG_WITH([kerneldir], - [AC_HELP_STRING([--with-kerneldir=DIR], - [assume kernelsources in DIR (default: /lib/modules//build)])], - [case "$withval" in - yes|no) AC_MSG_ERROR(['$withval' is not a valid value for kerneldir]);; - *) ensc_cv_path_kerneldir=$withval;; - esac], - [ensc_cv_path_kerneldir= - for i in /lib/modules/$(uname -r)/build /usr/src/linux /usr; do - test -e $i/include/linux/version.h && { ensc_cv_path_kerneldir=$i; break; } - done]) - ]) - - test "$ensc_cv_path_kerneldir" -a -e "$ensc_cv_path_kerneldir"/include/linux/version.h || { - AC_MSG_ERROR([Can not find kernelsources]) - } -]) - -AC_DEFUN([ENSC_KERNEL_HEADERS], -[ - AC_REQUIRE([_ENSC_KERNEL_DIR]) - - AC_CACHE_CHECK([for linux kernel headers], [ensc_cv_path_kernelheaders], - [ - ensc_cv_path_kernelheaders=$ensc_cv_path_kerneldir/include - ]) - - if test x"$1" != x; then - $1=$ensc_cv_path_kernelheaders - AC_SUBST($1) - fi -]) diff --git a/util-vserver/m4/ensc_release.m4 b/util-vserver/m4/ensc_release.m4 deleted file mode 100644 index e755bec..0000000 --- a/util-vserver/m4/ensc_release.m4 +++ /dev/null @@ -1,43 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2002 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -dnl Usage: ENSC_RELEASE() -dnl ... name of variable which will get the preprocessor -dnl flags and which will be AC_SUBST'ed - -AC_DEFUN([ENSC_RELEASE], -[ - AC_MSG_CHECKING([whether to enable release-mode]) - AC_ARG_ENABLE([release], - [AC_HELP_STRING([--enable-release], - [enable release mode (default: no)])], - [case "$enableval" in - yes) ensc_release_mode=yes;; - no) ensc_release_mode=no;; - *) AC_MSG_ERROR(['$enableval' is not a valid value for '--enable-release']);; - esac], - [ ensc_release_mode=no ]) - - if test x"$ensc_release_mode" = xno; then - $1= - else - $1='-DNDEBUG' - fi - - AC_SUBST($1) - AC_MSG_RESULT($ensc_release_mode) -]) diff --git a/util-vserver/m4/ensc_syscall.m4 b/util-vserver/m4/ensc_syscall.m4 deleted file mode 100644 index a8026ce..0000000 --- a/util-vserver/m4/ensc_syscall.m4 +++ /dev/null @@ -1,84 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2004 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -dnl Usage: ENSC_SYSCALL - -AC_DEFUN([ENSC_SYSCALL], -[ - AC_REQUIRE([ENSC_KERNEL_HEADERS]) - AC_MSG_CHECKING([for syscall(2) invocation method]) - AC_ARG_WITH([syscall], - [AC_HELP_STRING([--with-syscall=METHOD], - [call syscall(2) with the specified METHOD; valid values are 'fast', 'traditional' and 'auto' (default: auto)])], - [], - [with_syscall=auto]) - AC_MSG_RESULT([$with_syscall]) - - case x"$with_syscall" in - xauto) - AC_CACHE_CHECK([which syscall(2) invocation works], [ensc_cv_test_syscall], - [ - AC_LANG_PUSH(C) - AC_COMPILE_IFELSE([ -#include -#include -#include -#define __NR_foo0 300 -#define __NR_foo1 301 -#define __NR_foo2 302 -#define __NR_foo3 303 -#define __NR_foo4 304 -#define __NR_foo5 305 -inline static _syscall0(int, foo0) -inline static _syscall1(int, foo1, int, a) -inline static _syscall2(int, foo2, int, a, int, b) -inline static _syscall3(int, foo3, int, a, int, b, int, c) -inline static _syscall4(int, foo4, int, a, int, b, int, c, int, d) -inline static _syscall5(int, foo5, int, a, int, b, int, c, int, d, int, e) - -int main() { - return foo0() || \ - foo1(1) || \ - foo2(1,2) || \ - foo3(1,2,3) || \ - foo4(1,2,3,4) || \ - foo5(1,2,3,4,5); -} - ], - [ensc_cv_test_syscall=fast], - [ensc_cv_test_syscall=traditional]) - - AC_LANG_POP - ]) - with_syscall=$ensc_cv_test_syscall - ;; - xfast|xtraditional) - ;; - *) - AC_MSG_ERROR(['$with_syscall' is not a valid value for '--with-syscall']) - ;; - esac - - if test x"$with_syscall" = xtraditional; then - AC_DEFINE(ENSC_SYSCALL_TRADITIONAL, 1, [Define to 1 when the fast syscall(2) invocation does not work]) - fi - - AH_BOTTOM([ -#if defined(__pic__) && defined(__i386) && !defined(ENSC_SYSCALL_TRADITIONAL) -# define ENSC_SYSCALL_TRADITIONAL 1 -#endif]) -]) diff --git a/util-vserver/m4/ensc_syscallnr.m4 b/util-vserver/m4/ensc_syscallnr.m4 deleted file mode 100644 index aaa1959..0000000 --- a/util-vserver/m4/ensc_syscallnr.m4 +++ /dev/null @@ -1,62 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2004 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -dnl Usage: ENSC_SYSCALLNR(,) - -AC_DEFUN([ENSC_SYSCALLNR], -[ - AC_REQUIRE([AC_PROG_CPP]) - AC_REQUIRE([AC_PROG_EGREP]) - AC_REQUIRE([ENSC_KERNEL_HEADERS]) - - AC_CACHE_CHECK([for number of syscall '$1'], [ensc_cv_value_syscall_$1], - [ - AC_LANG_PUSH(C) - AC_LANG_CONFTEST([ -#include -#ifdef __NR_$1 -ensc_syscall_tmp_nr=__NR_$1; -ensc_syscall_tmp_src=ENSC_MARK -#endif -]) - ensc_syscall_tmp_nr= - ensc_syscall_tmp_src= - test "$ensc_syscall_tmp_nr" || \ - eval $($CPP $CPPFLAGS -D ENSC_MARK='glibc' conftest.c | $EGREP '^ensc_syscall_tmp_(nr=[[1-9]][[0-9]]*;|src=.*)$') - test "$ensc_syscall_tmp_nr" || \ - eval $($CPP $CPPFLAGS -D ENSC_MARK='kernel' -I $ensc_cv_path_kernelheaders conftest.c | $EGREP '^ensc_syscall_tmp_(nr=[[1-9]][[0-9]]*;|src=.*)$') - test "$ensc_syscall_tmp_nr" || { - ensc_syscall_tmp_nr=$2 - ensc_syscall_tmp_src=default - } - - if test x"$ensc_syscall_tmp_nr" = x; then - AC_MSG_ERROR( -[Can not determine value of __NR_$1; please verify your glibc/kernelheaders, and/or set CPPFLAGS='-D__NR_$1=' environment when calling configure.]) - fi - AC_LANG_POP - - ensc_cv_value_syscall_$1="$ensc_syscall_tmp_nr/$ensc_syscall_tmp_src" - ]) - - ensc_syscall_tmp_nr=${ensc_cv_value_syscall_$1%/*} - ensc_syscall_tmp_src=${ensc_cv_value_syscall_$1#*/} - - if test x"$ensc_syscall_tmp_src" != x'glibc'; then - AC_DEFINE_UNQUOTED(ENSC_SYSCALL__NR_$1, $ensc_syscall_tmp_nr, [The number of the $1 syscall]) - fi -]) diff --git a/util-vserver/m4/ensc_uv_vrootdir.m4 b/util-vserver/m4/ensc_uv_vrootdir.m4 deleted file mode 100644 index 4430881..0000000 --- a/util-vserver/m4/ensc_uv_vrootdir.m4 +++ /dev/null @@ -1,39 +0,0 @@ -dnl $Id$ - -dnl Copyright (C) 2002 Enrico Scholz -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; version 2 of the License. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -dnl Usage: ENSC_UV_VROOTDIR[()] -dnl ... name of variable which will get assigned -dnl the dirname of the vserver-topdir - -AC_DEFUN([ENSC_UV_VROOTDIR], -[ - AC_MSG_CHECKING([which vserver-rootdir is to use]) - AC_ARG_WITH([vrootdir], - [AC_HELP_STRING([--with-vrootdir=DIR], - [place vservers under DIR (default: /vservers)])], - [case "$withval" in - yes|no) AC_MSG_ERROR(['$withval' is not a valid value for vrootdir]);; - *) ensc_uv_path_vrootdir=$withval;; - esac], - [ensc_uv_path_vrootdir=/vservers]) - AC_MSG_RESULT([$ensc_uv_path_vrootdir]) - - if test x"$1" != x; then - $1=$ensc_uv_path_vrootdir - AC_SUBST($1) - fi -]) diff --git a/util-vserver/m4/gpgsig.am b/util-vserver/m4/gpgsig.am deleted file mode 100644 index 49b2e8b..0000000 --- a/util-vserver/m4/gpgsig.am +++ /dev/null @@ -1,20 +0,0 @@ -## $Id$ - -## Copyright (C) 2002 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. - -gpgsig: - gpgkey=$(GPG_KEY); \ - gpg $${gpgkey:+--default-key "$$gpgkey"} --armor --detach-sign $(distdir).tar.bz2 diff --git a/util-vserver/m4/pkgconfig.am b/util-vserver/m4/pkgconfig.am deleted file mode 100644 index c864288..0000000 --- a/util-vserver/m4/pkgconfig.am +++ /dev/null @@ -1,55 +0,0 @@ -## $Id$ ---*- makefile -*--- - -## Copyright (C) 2002 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. -## - -BAD_INC_PATHS = /usr/include|/usr/local/include -BAD_LIB_PATHS = /usr/lib - -pkgconfdir = $(libdir)/pkgconfig -pkgconf_DATA = $(addsuffix .pc, $(PKGCONFIG_FILES)) - -CLEANFILES += $(addsuffix .pc, $(PKGCONFIG_FILES)) -EXTRA_DIST += $(addsuffix .pc.subst, $(PKGCONFIG_FILES)) - - -%.pc: %.pc.subst Makefile - rm -f $@ - @case '$(libdir)' in \ - $(BAD_LIB_PATHS)) libflags=;; \ - *) libflags='-L$${libdir} ';; \ - esac; \ - case '$(pkgincludedir)' in \ - $(BAD_INC_PATHS)) pkgincflags=;; \ - *) pkgincflags='-I$${pkgincludedir} ';; \ - esac; \ - case '$(includedir)' in \ - $(BAD_INC_PATHS)) incflags=;; \ - *) incflags='-I$${includedir} ';; \ - esac; \ - sed -e 's!@'PACKAGE'@!$(PACKAGE)!g; \ - s!@'VERSION'@!$(VERSION)!g; \ - s!@'prefix'@!$(prefix)!g; \ - s!@'exec_prefix'@!$(exec_prefix)!g; \ - s!@'libdir'@!$(libdir)!g; \ - s!@'includedir'@!$(includedir)!g; \ - s!@'libflags"@!$${libflags}$(pkgconf_LIBFLAGS)!g;"' \ - s!@'incflags"@!$${incflags}$(pkgconf_INCFLAGS)!g;"' \ - s!@'pkgincflags"@!$${pkgincflags}$(pkgconf_PKGINCFLAGS)!g;"' \ - s!@'pkgincludedir'@!$(pkgincludedir)!g' \ - $< >$@ - test -z "$(CHMOD_REFERENCE)" || $(CHMOD_REFERENCE) '$<' '$@' - chmod a-w $@ diff --git a/util-vserver/m4/validate.am b/util-vserver/m4/validate.am deleted file mode 100644 index e99028a..0000000 --- a/util-vserver/m4/validate.am +++ /dev/null @@ -1,30 +0,0 @@ -## $Id$ ---*- makefile -*--- - -## Copyright (C) 2002 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. -## - -$(BUILT_SOURCES) config.h: .X$(subst /,_,$(sysconfdir))-up-to-date - -distclean-local: distclean-uptodate - -distclean-uptodate: - @rm -f .*-up-to-date - -.%-up-to-date: - @rm -f .*-up-to-date - @$(MAKE) -s clean - @touch -t 197001020000 '$@' - @$(MAKE) -s $(BUILT_SOURCES) diff --git a/util-vserver/man/Makefile-files b/util-vserver/man/Makefile-files deleted file mode 100644 index d2216d3..0000000 --- a/util-vserver/man/Makefile-files +++ /dev/null @@ -1,33 +0,0 @@ -## $Id$ -*- makefile -*- - -## Copyright (C) 2003 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; either version 2, or (at your option) -## any later version. -## -## 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. -## - -man_pages = man/chbind.8 \ - man/chcontext.8 \ - man/distrib-info.8 \ - man/rebootmgr.8 \ - man/reducecap.8 \ - man/vps.8 \ - man/vpstree.8 \ - man/vserver-copy.8 \ - man/vserver-stat.8 \ - man/vserver.8 \ - man/vtop.8 - -man_MANS += $(man_pages) -EXTRA_DIST += $(man_pages) diff --git a/util-vserver/man/chbind.8 b/util-vserver/man/chbind.8 deleted file mode 100644 index ca7783a..0000000 --- a/util-vserver/man/chbind.8 +++ /dev/null @@ -1,43 +0,0 @@ -.TH "chbind" "8" "0.1.0" "Klavs Klavsen " "System Administration" -.SH "NAME" -.LP -chbind \- The chbind utility is used to lock a process and its children into using a specific IP number/Interface. -.SH "SYNTAX" -.LP -chbind [\fI\-\-silent\fP] [\fI\-\-ip ip_number/interface\fP] <\fIcommand arguments\fP> -.SH "DESCRIPTION" -.LP -The chbind utility executes a command, and locks the resulting process and its children into using a specific IP number/Interface, no matter what it is told in it's configuration. This applies to services and client connection as well. -.SH "OPTIONS" -.LP -.TP -\fB\-\-ip\fR ip_number/interface -Binds the process to the given IP number or Interface. If an interface -is supplied (for example eth0), both the IP number and broadcast address -are extracted. -.TP -\fB\-\-bcast\fR broadcast address -Binds the process to the given broadcast IP number. -.TP -\fB\-\-silent\fR -Do not complain. - -.SH "FILES" -.LP -\fI/usr/sbin/chbind\fP - - -.SH "EXAMPLES" -.LP -If I wanted to ensure my httpd listened only on my eth0 interface, I could do: -chbind \-\-ip eth0 /etc/rc.d/init.d/httpd start -.LP -Please contribute some, if you feel it's important. -.SH "AUTHORS" -.LP -This Man page was written by Klavs Klavsen and based upon the helpful output from the program itself and the documentation on the Virtual Server site -.SH "SEE ALSO" -.LP -chcontext(8) rebootmgr(8) reducecap(8) -vps(8) vpstree(8) vrpm(8) vserver(8) -vserver\-stat(8) vtop(8) diff --git a/util-vserver/man/chcontext.8 b/util-vserver/man/chcontext.8 deleted file mode 100644 index 63bd721..0000000 --- a/util-vserver/man/chcontext.8 +++ /dev/null @@ -1,103 +0,0 @@ -.TH "chcontext" "1" "0.1.0" "Klavs Klavsen " "System Administration" -.SH "NAME" -.LP -chcontext \- chcontext allocates a new security context and executes a command in that context. -.SH "SYNTAX" -.LP -chcontext [\fIoptions\fP] <\fIcommand arguments\fP> -.SH "DESCRIPTION" -.LP -chcontext allocates a new security context and executes a command in that context. -By default, a new/unused context is allocated -.SH "OPTIONS" -.LP -.TP -\fB\-\-cap\fR CAP_NAME -Add a capability from the command. This option may be repeated several time. See /usr/include/linux/capability.h In general, this option is used with the \-\-secure option. \-\-secure removes most critical capabilities and \-\-cap adds specific ones. -.TP -\fB\-\-cap\fR !CAP_NAME -Remove a capability from the command. This option may be repeated several time. See /usr/include/linux/capability.h -.TP -\fB\-\-ctx\fR num -Select the context. Only root in context 0 is allowed to select a specific context. -Context number 1 is special. It can see all processes in any contexts, but can't kill them though. -.TP -\fB\-\-disconnect\fR -Start the command in background and make the process a child of process 1. -.TP -\fB\-\-domainname\fR new_domainname -Set the domainname (NIS) in the new security context. -Use "none" to unset the domainname. -.TP -\fB\-\-flag\fR -Set one flag in the new or current security context. The following flags are supported. The option may be used several time. - lock: The new process is trapped and can't use - chcontext anymore. - sched: The new process and its children will - share a common execution priority. - nproc: Limit the number of process in the - vserver according to ulimit setting. - Normally, ulimit is a per user thing. - With this flag, it becomes a per vserver - thing. - private: No one can join this security context - once created. -.TP -\fB\-\-hostname\fR new_hostname -Set the hostname in the new security context. -This is needed because if you create a less privileged security context, it may be unable to change its hostname. -.TP -\fB\-\-secure\fR -Remove all the capabilities to make a virtual server trustable. -.TP -\fB\-\-silent\fR -Do not print the allocated context number. -.LP -Information about context is found in /proc/self/status -.SH "FILES" -.LP -\fI/usr/sbin/chcontext\fP - - -.SH "EXAMPLES" -.LP -# You must be root, running X. -# We start an xterm in another security context -/usr/sbin/chcontext xterm & - -# We check, there is no xterm running, yet we can -# see it. -ps ax | grep xterm - -# Are we running in security context 0 -# We check the s_context line in /proc/self/status -cat /proc/self/status - -# Ok we in security context 0 -# Try the security context 1 -/usr/sbin/chcontext \-\-ctx 1 ps ax | grep xterm - -# Ok, we see the xterm, we try to kill it -/usr/sbin/chcontext \-\-ctx 1 killall xterm - -# No, security context 1 can see, but can't kill -# let's find out in which security context this -# xterm is running -/usr/sbin/chcontext \-\-ctx 1 ps ax | grep xterm - -# Ok, this is PID XX. We need the security context -/usr/sbin/chcontext \-\-ctx 1 cat /proc/XX/status - -# We see the s_context, this is SS. -# We want to kill this process -/usr/sbin/chcontext \-\-ctx SS killall xterm -.LP -Please contribute some, if you feel it's important. -.SH "AUTHORS" -.LP -This Man page was written by Klavs Klavsen and based upon the helpful output from the program itself and the documentation on the Virtual Server site -.SH "SEE ALSO" -.LP -chbind(8) rebootmgr(8) reducecap(8) -vps(8) vpstree(8) vrpm(8) vserver(8) -vserver\-stat(8) vtop(8) diff --git a/util-vserver/man/distrib-info.8 b/util-vserver/man/distrib-info.8 deleted file mode 100644 index 5a7d867..0000000 --- a/util-vserver/man/distrib-info.8 +++ /dev/null @@ -1,50 +0,0 @@ -.TH "distrib-info" "8" "0.1.0" "Jacques Gelinas " "System Administration" -.SH "NAME" -.LP -distrib-info \- A distribution independant utility to retrieve package information. -.SH "SYNTAX" -.LP -distrib-info vserver-name command [options] - -.SH "DESCRIPTION" -.LP -distrib-info \- This utility provides a solution to hide some differences -between Linux distributions. The various utilities (vunify, vbuild, ...) -need package information to perform their task. They call distrib-info -to retrieve this information. distrib-info is the only one understanding -the various distribution out there. -.TP -This utility is only used as a back-end for other utilities such as -vunify and vbuild. -.SH "OPTIONS" -.LP -.TP -\fBdumpfiles\fR reports all files owned by a package. -.TP -\fBpkgversion\fR reports all packages and version. -.TP -\fBunifiles\fR reports the files of a package which may be shared by -several virtual servers. Generally, this excludes all configuration files. - -.SH "EXAMPLES" -.LP -The following command will report all packages in the vserver ref80. -The package will be presented with the version/release. - - distrib-info ref80 pkgversion - -To get the list of unify-able (sharable) file in package sendmail -of the vserver ref80, we do - - distrib-info ref80 unifiles sendmail -.SH "FILES" -.LP - /usr/lib/vservers/distrib-info -.SH "AUTHORS" -.LP -This Man page was written by Jacques Gelinas . -.SH "SEE ALSO" -.LP -vbuild(8) vfiles(8) vunify(8) -newvserver(8) - diff --git a/util-vserver/man/rebootmgr.8 b/util-vserver/man/rebootmgr.8 deleted file mode 100644 index 4ccfe5b..0000000 --- a/util-vserver/man/rebootmgr.8 +++ /dev/null @@ -1,38 +0,0 @@ -.TH "rebootmgr" "8" "0.1.0" "Klavs Klavsen " "System Administration" -.SH "NAME" -.LP -rebootmgr \- rebootmgr stops and starts one or more vservers at your command. -.SH "SYNTAX" -.LP -rebootmgr \fIvserver\-name\fP [\fIvserver\-name\fP ...] \fICommand\fP -.SH "DESCRIPTION" -.LP -The chbind utility executes a command, and locks the resulting process and its children into using a specific IP number/Interface, no matter what it is told in it's configuration. This applies to services and client connection as well. -.SH "OPTIONS" -.LP -.TP -\fB\-\-ip\fR ip_number/interface -Binds the process to the given IP number or Interface. -.TP -\fB\-\-silent\fR -Do not complain. - -.SH "FILES" -.LP -\fI/usr/sbin/rebootmgr\fP - - -.SH "EXAMPLES" -.LP -If I wanted to ensure my httpd listened only on my eth0 interface, I could do: -chbind \-\-ip eth0 /etc/rc.d/init.d/httpd start -.LP -Please contribute some, if you feel it's important. -.SH "AUTHORS" -.LP -This Man page was written by Klavs Klavsen and based upon the helpful output from the program itself and the documentation on the Virtual Server site -.SH "SEE ALSO" -.LP -chcontext(8) chbind(8) reducecap(8) -vps(8) vpstree(8) vrpm(8) vserver(8) -vserver\-stat(8) vtop(8) diff --git a/util-vserver/man/reducecap.8 b/util-vserver/man/reducecap.8 deleted file mode 100644 index bb16a4d..0000000 --- a/util-vserver/man/reducecap.8 +++ /dev/null @@ -1,124 +0,0 @@ -.TH "reducecap" "8" "0.1.0" "Klavs Klavsen " "System Administration" -.SH "NAME" -.LP -reducecap \- The reducecap utility is used to lower the capability ceiling of a process and child process. -.SH "SYNTAX" -.LP -reducecap [\fIoptions\fP] <\fIcommand arguments\fP> -.SH "DESCRIPTION" -.LP -The reducecap utility is used to lower the capability ceiling of a process and child process. Even setuid program won't be able to grab more capabilities. -.SH "OPTIONS" -.LP -.TP -\fB\-\-secure\fR Removes all dangerous capabilities from the process executed.Specificly it removes: -CAP_LINUX_IMMUTABLE CAP_NET_BROADCAST CAP_NET_ADMIN, CAP_NET_RAW CAP_IPC_LOCK CAP_IPC_OWNER CAP_SYS_MODULE CAP_SYS_RAWIO CAP_SYS_PACCT CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_NICE CAP_SYS_RESOURCE CAP_SYS_TIME CAP_MKNOD. - -Leaving the following capabilities: -CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH CAP_FOWNER CAP_FSETID CAP_KILL CAP_SETGID CAP_SETUID CAP_NET_BIND_SERVICE CAP_SYS_CHROOT CAP_SYS_PTRACE CAP_SYS_TTY_CONFIG CAP_LEASE CAP_QUOTACTL -.TP -\fB\-\-show\fR Shows the current process capabilities. -.TP -\fB\-\-flag\fR -sets the security context flags. The option may be repeated -several times. Here are the values: - -lock: The security context can't be changed. The process is trapped - in this context. This is generally used for vservers because yoy - do not want them to hide in new security context. - -sched: Each process in a security context contribute (lower) to the general - priority of every processes in the context. Mostly, all processes - in a security context take as much CPU together as one process - not bound to this flag. Said again differently, a vserver having - 100 active processes won't get more CPU than another vserver - with a single active process. - - -nproc: The "ulimit -u N" setting becomes global to the security context. It means - the security context is not allowed to have more than N processes. - -private: No other processes, even root in security context 0, is allowed to - enter this security context. Once a security context is setup - with this flag, it is on its own. This also means that root - in security context 0 won't be able to kill or interact with those - processes. - -hideinfo: Hides various information in /proc. - -.TP -\fB--LINUX_IMMUTABLE\fR -.TP -\fB--NET_BIND_SERVICE\fR -.TP -\fB--NET_BROADCAST\fR -.TP -\fB--NET_ADMIN\fR -.TP -\fB--NET_RAW\fR -.TP -\fB--IPC_LOCK\fR -.TP -\fB--IPC_OWNER\fR -.TP -\fB--SYS_MODULE\fR -.TP -\fB--SYS_RAWIO\fR -.TP -\fB--SYS_PACCT\fR -.TP -\fB--SYS_ADMIN\fR -.TP -\fB--SYS_BOOT\fR -.TP -\fB--SYS_NICE\fR -.TP -\fB--SYS_RESOURCE\fR -.TP -\fB--SYS_TIME\fR -.TP -\fB--MKNOD\fR - -All these options remove one capability. These options may be used -after the -\fB--secure\fR -option to remove more capabilities. - - -.SH "FILES" -.LP -\fI/usr/sbin/reducecap\fP - - -.SH "EXAMPLES" -.LP -# You are not root now -# What is the current capability ceiling -cat /proc/self/status -# The capBset line presents mostly 1s. -/usr/sbin/reducecap \-\-secure /bin/sh -cat /proc/self/status -# The capBset now shows many more 0s. -# The capEff shows all 0s, you have no privilege now -# We su to root -su -cat /proc/self/status -# capEff is much better now, but there are still many 0s -# Now we try to see if we are really root -tail /var/log/messages -# So far so good, we see the content -/sbin/ifconfig eth0 -/sbin/ifconfig eth0 down -# No way, we can't configure the interface. In fact -# we have lost most privilege normally assigned to root -exit -.LP -Please contribute some more, if you feel it's important. -.SH "AUTHORS" -.LP -This Man page was written by Klavs Klavsen and based upon the helpful output from the program itself and the documentation on the Virtual Server site -.SH "SEE ALSO" -.LP -chcontext(8) rebootmgr(8) chbind(8) -vps(8) vpstree(8) vrpm(8) vserver(8) -vserver\-stat(8) vtop(8) diff --git a/util-vserver/man/vps.8 b/util-vserver/man/vps.8 deleted file mode 100644 index 4b653f0..0000000 --- a/util-vserver/man/vps.8 +++ /dev/null @@ -1,31 +0,0 @@ -.TH "vps" "8" "0.1.0" "Klavs Klavsen " "System Administration" -.SH "NAME" -.LP -vps \- The vps utility is simply a wrapper for the ps program. -.SH "SYNTAX" -.LP -vps [\fIoptions\fP] - -.SH "DESCRIPTION" -.LP -vps \- The vps utility is simply a wrapper for the ps program, that enables ps to show you the all the processes on the system, instead of only the ones in the current s_context (see cat /proc/self/status). -.SH "OPTIONS" -.LP -.TP -See man ps. -.SH "FILES" -.LP -\fI/usr/sbin/vps\fP - - -.SH "EXAMPLES" -.LP -Please contribute some, if you feel it's important. -.SH "AUTHORS" -.LP -This Man page was written by Klavs Klavsen and based upon the helpful output from the program itself and the documentation on the Virtual Server site -.SH "SEE ALSO" -.LP -chcontext(8) rebootmgr(8) reducecap(8) -chbind(8) vpstree(8) vrpm(8) vserver(8) -vserver\-stat(8) vtop(8) diff --git a/util-vserver/man/vpstree.8 b/util-vserver/man/vpstree.8 deleted file mode 100644 index 27c1b24..0000000 --- a/util-vserver/man/vpstree.8 +++ /dev/null @@ -1,31 +0,0 @@ -.TH "vpstree" "8" "0.1.0" "Klavs Klavsen " "System Administration" -.SH "NAME" -.LP -vpstree \- The vpstree utility is simply a wrapper for the pstree program. -.SH "SYNTAX" -.LP -vpstree [\fIoptions\fP] - -.SH "DESCRIPTION" -.LP -vpstree \- The vpstree utility is simply a wrapper for the pstree program, that enables pstree to show you the all the processes on the system, instead of only the ones in the current s_context (see cat /proc/self/status). -.SH "OPTIONS" -.LP -.TP -See man pstree. -.SH "FILES" -.LP -\fI/usr/sbin/vpstree\fP - - -.SH "EXAMPLES" -.LP -Please contribute some, if you feel it's important. -.SH "AUTHORS" -.LP -This Man page was written by Klavs Klavsen and based upon the helpful output from the program itself and the documentation on the Virtual Server site -.SH "SEE ALSO" -.LP -chcontext(8) rebootmgr(8) reducecap(8) -chbind(8) vps(8) vrpm(8) vserver(8) -vserver\-stat(8) vtop(8) diff --git a/util-vserver/man/vrpm.8 b/util-vserver/man/vrpm.8 deleted file mode 100644 index e6eb456..0000000 --- a/util-vserver/man/vrpm.8 +++ /dev/null @@ -1,48 +0,0 @@ -.TH "vrpm" "8" "0.1.0" "Klavs Klavsen " "System Administration" -.SH "NAME" -.LP -vrpm \- is simply a wrapper for the rpm utility. -.SH "SYNTAX" -.LP -vrpm [--unify] [ALL | vserver1 vserver2 ...] \-\- [rpm options] - -.SH "DESCRIPTION" -.LP -vrpm \- is simply a wrapper for the rpm utility. It enables rpm to manage a specific, several or all virtual server(s) with one command. -vrpm is executed in the root server. -.SH "OPTIONS" -.LP -.TP -\fB\-\-\fR All commands after this, is given to the rpm utility (see man rpm). -.TP -The -\fB--unify\fR option triggers the vunify utility on the vservers and the -supplied packages. -.SH "FILES" -.LP -\fI/usr/sbin/vrpm\fP - - -.SH "EXAMPLES" -.TP -verifies the gcc package on all vservers. -.LP -vrpm ALL \-\- \-\-verify gcc -.TP -Updates package.rpm on vserver1 and vserver2 if -the package exists in a earlier version -(the F flag for rpm). -.LP -vrpm vserver1 vserver2 \-\- \-Fvh package.rpm -.TP -vrpm is executed in the root server -.LP -Please contribute some more, if you feel it's important. -.SH "AUTHORS" -.LP -This Man page was written by Klavs Klavsen and based upon the helpful output from the program itself and the documentation on the Virtual Server site -.SH "SEE ALSO" -.LP -chcontext(8) rebootmgr(8) reducecap(8) -chbind(8) vps(8) vtop(8) vserver(8) -vserver\-stat(8) vpstree(8) diff --git a/util-vserver/man/vserver-copy.8 b/util-vserver/man/vserver-copy.8 deleted file mode 100644 index 9481c49..0000000 --- a/util-vserver/man/vserver-copy.8 +++ /dev/null @@ -1,93 +0,0 @@ -.TH "vserver-copy" "8" "0.3" "Mark Lawrence " "System Administration" -.SH "NAME" -.LP -vserver-copy \- copy/move a virtual server. -.SH "SYNTAX" -.LP -vserver-copy [\fIoptions\fP] \fIvserver\fP \fInewname\fP -.LP -vserver-copy [\fIoptions\fP] \fIvserver\fP \fIhost\fP:[\fInewname\fP] -.SH "DESCRIPTION" -.LP -vserver-copy makes a copy of a virtual server using rsync. It will -rewrite the vserver.conf configuration file with the new hostname and -IP information when given. If the destination name contains a host -specification then ssh/rsh will be used for the data transfer. - -vserver-copy can used on a running vserver, although naturally the -consistency of open database files and the like cannot be guaranteed. -A running vserver can however be safely moved from one root host to another -using the \-s flag. - -If downtime is an issue when moving a virtual server across hosts you -should first run vserver without the \-s flag. This will pre\-populate the -destination filesystem requiring only updates to be made on the next -invocation. -.SH "OPTIONS" -.LP -.TP -\fB\-h\fR,\fB-\-help\fR -output usage information and exit -.TP -\fB\-V\fR,\fB-\-version\fR -output version information and exit -.TP -\fB\-v\fR,\fB-\-verbose\fR -show all output (normally only informational messages and warnings) -.TP -\fB\-q\fR,\fB-\-quiet\fR -suppress all output -.TP -\fB\-d\fR,\fB-\-domain\fR domain -the new DNS domain when changing name. Overwrites /etc/hosts. Must be -used with \-i -.TP -\fB\-i\fR,\fB-\-ip\fR address -the new IP address when changing name. Overwrites /etc/hosts. Must be -used with \-d -.TP -\fB\-r\fR,\fB-\-vsroot\fR -directory containing virtual servers. Defaults to "/vserver" -.TP -\fB\-R\fR,\fB-\-rsh\fR -use rsh instead of the default ssh for network transfer -.TP -\fB\-s\fR,\fB-\-stopstart\fR -stop the virtual server before copying and start the new vserver afterwards. -This really only makes sense if you are copying across root hosts and not -changing names or IP addresses. -.SH "FILES" -.LP -\fI/etc/vservers/vserver.conf\fP -.SH "EXAMPLES" -.LP -# Copy a template vserver (same IP addresses etc) - -/usr/sbin/vserver-copy template web01 - -# Copy webserver with change in configuration - -/usr/sbin/vserver-copy -i 192.168.5.62 -d example.com template web62 - -# Move a running vserver to another roothost - -/usr/sbin/vserver-copy -s web62 roothost02: - -.SH "BUGS" -.LP -If a virtual server is moved from one root host to another a gratuitious -ping should be sent to inform other devices on the local area network -of the change in MAC address. - -Without this ping the devices will continue to attempt to reach the old -MAC address for the length of their arp-cache timeout (10 minute default -on Suns!). - -This functionality should probably be implmemented during the -"vserver start" process. -.SH "AUTHOR" -.LP -Mark Lawrence -.SH "SEE ALSO" -.LP -vserver(8) diff --git a/util-vserver/man/vserver-stat.8 b/util-vserver/man/vserver-stat.8 deleted file mode 100644 index 4c1ac2d..0000000 --- a/util-vserver/man/vserver-stat.8 +++ /dev/null @@ -1,40 +0,0 @@ -.TH "vserver-stat" "8" "0.1.0" "Klavs Klavsen " "System Administration" -.SH "NAME" -.LP -vserver\-stat -.SH "SYNTAX" -.LP -vserver\-stat - -.SH "DESCRIPTION" -.LP -vserver\-stat \- The vserver\-stat utility shows informations about all the active contexts. - - CTX# Context number - #0 = root context - #1 = monitoring context - PROC QTY Quantity of processes in each - context - VSZ Number of pages of virtual - memory - RSS Resident set size - utime User\-mode CPU time - accumulated - ctime Kernel\-mode CPU time - accumulated -.SH "FILES" -.LP -\fI/usr/sbin/vserver\-stat\fP - - -.SH "EXAMPLES" -.LP -Please contribute some, if you feel it's important. -.SH "AUTHORS" -.LP -This Man page was written by Klavs Klavsen and based upon the helpful output from the program itself and the documentation on the Virtual Server site -.SH "SEE ALSO" -.LP -chcontext(8) rebootmgr(8) reducecap(8) -chbind(8) vps(8) vrpm(8) vserver(8) -vtop(8) vpstree(8) diff --git a/util-vserver/man/vserver.8 b/util-vserver/man/vserver.8 deleted file mode 100644 index 6ea2052..0000000 --- a/util-vserver/man/vserver.8 +++ /dev/null @@ -1,74 +0,0 @@ -.TH "vserver" "8" "0.1.0" "Klavs Klavsen " "System Administration" -.SH "NAME" -.LP -vserver \- The vserver utility enables you to control different aspects of your vservers. -.SH "SYNTAX" -.LP -vserver [ options ] [vserver name] [options] - -.SH "DESCRIPTION" -.LP -vserver \- The vserver utility enables you to control different aspects of your vservers, such as stopping and starting them, and services within them. -.SH "OPTIONS" -.LP -.TP -\fBbuild\fR Create a virtual server by copying the packages of the root server -.TP -\fBenter\fR Enter in the virtual server context and starts a shell. Same as "vserver name exec /bin/sh\". -.TP -\fBexec\fR Exec a command in the virtual server context as root. -syntax: vserver name exec command ... -.TP -\fBsuexec\fR Exec a command in the virtual server context under some user id. -syntax: vserver name suexec userid command ... -.TP -\fBservice\fR Control a service inside a vserver. -syntax: vserver name service service\-name (start/stop/restart etc.) -.TP -\fBstart\fR Starts the various services in the vserver. -It uses the default runlevel found in the -.B /etc/inittab -file of the vserver. -.TP -\fBstop\fR Ends all services and kills the remaining processes. -.TP -\fBrunning\fR Tells if a virtual server is running. It returns proper exit code, so you can use it as a test. -.TP -\fBstatus\fR Tells various information about the state of a virtual server: -running status, number of running processes and uptime. -.TP -.I --nodev -do not configure the IP devices associated with the vserver. This -is useful to execute some commands on the vserver (or enter it) -without making it active on the network. Especially useful if you -have an active copy of the vserver moved to another server on the -network. -.TP -.I --silent -cuts most informative messages. - -.SH "FILES" -.LP -\fI/usr/sbin/vserver\fP -.P -\fI/etc/vservers/*.conf\fP -.P -\fI/etc/vservers/*.sh\fP -.P -\fI/vservers/*\fP - -.SH "EXAMPLES" -.LP -Please contribute some, if you feel it's important. -.SH "AUTHORS" -.LP -This Man page was written by Klavs Klavsen and based upon the helpful output from the program itself and the documentation on the Virtual Server site -.SH "SEE ALSO" -.LP -chbind(8) chcontext(8) -newvserver(8) -rebootmgr(8) reducecap(8) -vps(8) vpstree(8) -vrpm(8) -vserver\-stat(8) -vtop(8) diff --git a/util-vserver/man/vtop.8 b/util-vserver/man/vtop.8 deleted file mode 100644 index 440bc27..0000000 --- a/util-vserver/man/vtop.8 +++ /dev/null @@ -1,31 +0,0 @@ -.TH "vtop" "8" "0.1.0" "Klavs Klavsen " "System Administration" -.SH "NAME" -.LP -vtop \- The vtop utility is simply a wrapper for the top program. -.SH "SYNTAX" -.LP -vtop [\fIoptions\fP] - -.SH "DESCRIPTION" -.LP -vtop \- The vtop utility is simply a wrapper for the top program, that enables top to show you the all the processes on the system, instead of only the ones in the current s_context (see cat /proc/self/status). -.SH "OPTIONS" -.LP -.TP -See man top. -.SH "FILES" -.LP -\fI/usr/sbin/vtop\fP - - -.SH "EXAMPLES" -.LP -Please contribute some, if you feel it's important. -.SH "AUTHORS" -.LP -This Man page was written by Klavs Klavsen and based upon the helpful output from the program itself and the documentation on the Virtual Server site -.SH "SEE ALSO" -.LP -chcontext(8) rebootmgr(8) reducecap(8) -chbind(8) vps(8) vrpm(8) vserver(8) -vserver\-stat(8) vpstree(8) diff --git a/util-vserver/pathconfig.h.pathsubst b/util-vserver/pathconfig.h.pathsubst deleted file mode 100644 index 9a17203..0000000 --- a/util-vserver/pathconfig.h.pathsubst +++ /dev/null @@ -1,49 +0,0 @@ -// $Id$ --*- c++ -*-- - -// Copyright (C) 2003 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. - - -#ifndef H_UTIL_VSERVER_PATHCONFIG_H -#define H_UTIL_VSERVER_PATHCONFIG_H - -#define PKGLIBDIR "@PKGLIBDIR@" -#define SBINDIR "@SBINDIR@" -#define CONFDIR "@CONFDIR@" -#define SYSCONFDIR "@SYSCONFDIR@" -#define LOCKDIR "/var/lock" - -#define DEFAULT_VSERVERDIR "@VSERVERDIR@" -#define DEFAULT_VSERVERPKGDIR "@VSERVERPKGDIR@" -#define DEFAULT_PKGSTATEDIR "@PKGSTATEDIR@" -#define DEFAULT_PKGSTATEREVDIR "@PKGSTATEREVDIR@" - -#define MOUNT_PROG "@MOUNT@" -#define UMOUNT_PROG "@UMOUNT@" -#define PS_PROG "@PS@" - -#define VPKG_PROG PKGLIBDIR "/vpkg" -#define RESOLVER_PROG PKGLIBDIR "/rpm-fake-resolver" - -#define PROG_IP "@IP@" -#define PROG_MODPROBE "@MODPROBE@" -#define PROG_NAMEIF "@NAMEIF@" -#define PROG_VCONFIG "@VCONFIG@" - -#define PATH_VSERVER_START PKGLIBDIR "/vserver.start" -#define PATH_FUNCTIONS PKGLIBDIR "/functions" -#define PATH_UTILVSERVER_VARS PKGLIBDIR "/util-vserver-vars" - -#endif // H_UTIL_VSERVER_PATHCONFIG_H diff --git a/util-vserver/scripts/.cvsignore b/util-vserver/scripts/.cvsignore deleted file mode 100644 index 75cb4ff..0000000 --- a/util-vserver/scripts/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -.gdb_history -.*.stamp -util-vserver-vars -vps diff --git a/util-vserver/scripts/Makefile-files b/util-vserver/scripts/Makefile-files deleted file mode 100644 index 3609719..0000000 --- a/util-vserver/scripts/Makefile-files +++ /dev/null @@ -1,108 +0,0 @@ -## $Id$ -*- makefile -*- - -## Copyright (C) 2003 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; either version 2, or (at your option) -## any later version. -## -## 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. -## - -AM_INSTALLCHECK_STD_OPTIONS_EXEMPT += \ - scripts/vapt-get-worker \ - scripts/vrpm-worker \ - scripts/vrpm-preload \ - scripts/save_s_context \ - scripts/vservers.grabinfo.sh \ - scripts/vpstree \ - scripts/vserver-copy \ - scripts/vserver-wrapper \ - scripts/vsysvwrapper \ - scripts/vtop \ - scripts/legacy/distrib-info \ - scripts/legacy/vps \ - scripts/legacy/save_s_context \ - scripts/legacy/vserver \ - scripts/legacy/vserverkillall - - -scripts_pkglib_src_DTA = scripts/functions \ - scripts/vserver-build.apt-rpm \ - scripts/vserver-build.skeleton \ - scripts/vserver-build.debootstrap \ - scripts/vserver-build.functions \ - scripts/vserver-build.functions.apt \ - scripts/vserver-build.functions.rpm \ - scripts/vserver-build.functions.pkgmgmt \ - scripts/vserver-setup.functions \ - scripts/vserver.functions \ - scripts/vserver.start \ - scripts/vserver.stop \ - scripts/vserver.suexec - -scripts_pkglib_gen_DTA = scripts/util-vserver-vars - -scripts_pkglib_src_SCRPTS = scripts/pkgmgmt \ - scripts/vapt-get-worker \ - scripts/vpkg \ - scripts/vrpm-worker \ - scripts/vrpm-preload \ - scripts/rootshell \ - scripts/start-vservers \ - scripts/vprocunhide \ - scripts/vserver-build \ - scripts/vserver-wrapper \ - scripts/vservers.grabinfo.sh \ - scripts/vshelper \ - scripts/vsysvwrapper - -scripts_legacy_src_SCRPTS = scripts/legacy/save_s_context \ - scripts/legacy/vserver \ - scripts/legacy/distrib-info \ - scripts/legacy/vserverkillall -scripts_legacy_gen_SCRPTS = scripts/legacy/vps - -scripts_sbin_src_PRGS = scripts/chcontext \ - scripts/vapt-get \ - scripts/vpstree \ - scripts/vrpm \ - scripts/vserver \ - scripts/vserver-copy \ - scripts/vtop - -scripts_sbin_gen_PRGS = -scripts_sbincfg_gen_DTA = - -scripts_subst_SRCS = scripts/util-vserver-vars.pathsubst \ - scripts/legacy/vps.pathsubst - - - -sbin_SCRIPTS += $(scripts_sbin_src_PRGS) $(scripts_sbin_gen_PRGS) -scripts_sbincfg_DTA = $(scripts_sbincfg_gen_DTA) -pkglib_SCRIPTS += $(scripts_pkglib_src_SCRPTS) -legacy_SCRIPTS += $(scripts_legacy_src_SCRPTS) $(scripts_legacy_gen_SCRPTS) -pkglib_DATA += $(scripts_pkglib_src_DTA) $(scripts_pkglib_gen_DTA) - -CLEANFILES += $(scripts_pkglib_gen_DTA) \ - $(scripts_sbin_gen_PRGS) \ - $(scripts_sbincfg_gen_DTA) \ - $(scripts_legacy_gen_SCRPTS) - -EXTRA_DIST += $(scripts_pkglib_src_DTA) \ - $(scripts_pkglib_src_SCRPTS) \ - $(scripts_legacy_src_SCRPTS) \ - $(scripts_sbin_src_PRGS) \ - $(scripts_subst_SRCS) - -scripts/util-vserver-vars: scripts/.util-vserver-vars.pathsubst.stamp -scripts/legacy/vps: scripts/legacy/.vps.pathsubst.stamp diff --git a/util-vserver/scripts/chcontext b/util-vserver/scripts/chcontext deleted file mode 100755 index a217646..0000000 --- a/util-vserver/scripts/chcontext +++ /dev/null @@ -1,167 +0,0 @@ -#! /bin/bash -# $Id$ - -# 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. - -: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars} -test -e "$UTIL_VSERVER_VARS" || { - echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2 - exit 1 -} -. "$UTIL_VSERVER_VARS" -. "$_LIB_FUNCTIONS" - -function showHelp() -{ - echo \ -$"Usage: /usr/sbin/chcontext [--cap [!]] [--secure] [--xid ] [--disconnect] - [--domainname ] [--hostname ] [--flag +] - [--silent] [--] command arguments ... - -chcontext allocate a new security context and executes -a command in that context. -By default, a new/unused context is allocated - ---cap CAP_NAME - Add a capability from the command. This option may be - repeated several time. - See /usr/include/linux/capability.h - In general, this option is used with the --secure option - --secure removes most critical capabilities and --cap - adds specific ones. - ---cap !CAP_NAME - Remove a capability from the command. This option may be - repeated several time. - See /usr/include/linux/capability.h - ---xid num - Select the context. On root in context 0 is allowed to - select a specific context. - Context number 1 is special. It can see all processes - in any contexts, but can't kill them though. - Option --xid may be repeated several times to specify up to 16 contexts. ---disconnect - Start the command in background and make the process - a child of process 1. ---domainname new_domainname - Set the domainname (NIS) in the new security context. - Use "none" to unset the domain name. ---flag - Set one flag in the new or current security context. The following - flags are supported. The option may be used several time. - - fakeinit: The new process will believe it is process number 1. - Useful to run a real /sbin/init in a vserver. - lock: The new process is trapped and can't use chcontext anymore. - sched: The new process and its children will share a common - execution priority. - nproc: Limit the number of process in the vserver according to - ulimit setting. Normally, ulimit is a per user thing. - With this flag, it becomes a per vserver thing. - private: No one can join this security context once created. - ulimit: Apply the current ulimit to the whole context ---hostname new_hostname - Set the hostname in the new security context - This is need because if you create a less privileged - security context, it may be unable to change its hostname ---secure - Remove all the capabilities to make a virtual server trustable ---silent - Do not print the allocated context number. - -Report bugs to <$PACKAGE_BUGREPORT>." - exit $1 -} - -function showVersion() -{ - echo \ -$"chcontext $PACKAGE_VERSION -- allocates/enters a security context -This program is part of $PACKAGE_STRING - -Copyright (C) 2004 Enrico Scholz -This program is free software; you may redistribute it under the terms of -the GNU General Public License. This program has absolutely no warranty." - exit $1 -} - -$_VSERVER_INFO - FEATURE migrate || exec $_CHCONTEXT_COMPAT "$@" - -tmp=$(getopt -o + --long cap:,ctx:,xid:,disconnect,domainname:,flag:,hostname:,secure,silent,help,version -n "$0" -- "$@") || exit 1 -eval set -- "$tmp" - -OPT_CAPS=() -OPT_CTX= -OPT_DISCONNECT= -OPT_FLAGS=() -OPT_SECURE= -OPT_SILENT= -OPT_INITPID= - -while true; do - case "$1" in - --help) showHelp $0 ;; - --version) showVersion ;; - --cap) OPT_CAPS=( "${OPT_CAPS[@]}" "$2" ); shift;; - --ctx|--xid) OPT_CTX=$2; shift;; - --disconnect) OPT_DISCONNECT=1;; - --domainname) OPT_DOMAINNAME=$2; shift;; - --hostname) OPT_HOSTNAME=$2; shift;; - --flag) - test "$2" != "fakeinit" || OPT_INITPID=--initpid - OPT_FLAGS=( "${OPT_FLAGS[@]}" "$2" ) - shift - ;; - --secure) OPT_SECURE=1;; - --silent) OPT_SILENT=1;; - --) shift; break;; - *) echo $"chcontext: internal error; arg=='$1'" >&2; exit 1;; - esac - shift -done - -create_cmd=( $_VCONTEXT --create --silentexist - ${OPT_SILENT:+--silent} - ${OPT_CTX:+--xid "$OPT_CTX"} ) - -chain_cmd=() - -test -z "$OPT_DOMAINNAME$OPT_HOSTNAME" || \ - chain_cmd=( "${chain_cmd[@]}" - -- - $_VUNAME --set --xid self - ${OPT_DOMAINNAME:+-t domainname="$OPT_DOMAINNAME"} - ${OPT_HOSTNAME:+ -t nodename="$OPT_HOSTNAME"} ) - -chain_cmd=( "${chain_cmd[@]}" - -- - $_VATTRIBUTE --set - ${OPT_CAPS:+--bcap "${OPT_CAPS[@]}"} - ${OPT_FLAGS:+--flag "${OPT_FLAGS[@]}"} - ${OPT_SECURE:+--secure} ) - -migrate_cmd=( $_VCONTEXT - ${OPT_SILENT:+--silent} - ${OPT_DISCONNECT:+--disconnect} - $OPT_INITPID ) - -"${create_cmd[@]}" "${chain_cmd[@]}" -- \ - "${migrate_cmd[@]}" --endsetup --migrate-self -- "$@" -rc=$? - -test "$rc" -ne 254 || exec "${migrate_cmd[@]}" --xid "$OPT_CTX" --migrate -- "$@" -exit $rc diff --git a/util-vserver/scripts/functions b/util-vserver/scripts/functions deleted file mode 100644 index 8808372..0000000 --- a/util-vserver/scripts/functions +++ /dev/null @@ -1,775 +0,0 @@ -# $Id$ --*- sh -*-- - -# Copyright (C) 2003 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. - -_VS_LOGFILE= -_VS_ERRFILE= - -_VS_NEWLINE=' -' -declare -r _VS_NEWLINE=${_VS_NEWLINE:0-1} - -function findObject -{ - local mod=$1 - local var=$2 - local file= - local i=X - shift 2 - - for i; do - test "$i" || continue - test ! $mod "$i" || { file=$i; break; } - done - - test -z "$i" -o "$file" || { - echo "Can not find file for '$var'; aborting" - exit 1 - } >&2 - - eval "$var=\"$file\"" -} - -function findFile -{ - findObject -f "$@" -} - -function findDir -{ - findObject -d "$@" -} - -function findAndCopy -{ - local dst=$1 - test ! -s "$dst" || return 0 - - local tmp - shift - findFile tmp "$@" - - test "$tmp" -a -s "$tmp" || return 0 - cp -af "$tmp" "$dst" -} - -function getPhysicalDir -{ - ( set -P && cd "$1" && pwd ) -} - -## Usage: logging -function logging -{ - if test "$_VS_LOGFILE"; then - echo "$@" >>"$_VS_LOGFILE" - else - echo "$@" - fi -} - -## Usage: warning -function warning -{ - if test "$_VS_ERRFILE"; then - echo "$@" >>"$_VS_ERRFILE" - else - echo "$@" >&2 - fi -} - -## Usage: panic -function panic -{ - if test "$_VS_ERRFILE"; then - echo "$@" >>"$_VS_ERRFILE" - else - echo "$@" >&2 - fi - - exit 1 -} - -## Usage: execute -function execute -{ - test -z "${DEBUG_EXEC:-}" || echo "$@" - test "${DEBUG_EXEC:-}" = noexec || exec "$@" - exit 0 -} - -## Usage: isNumber -function isNumber -{ - local tmp - let tmp=$1+0 2>/dev/null || test -z "${1//0/}" -a "$1" || return 1 - return 0 -} - -## Usage: colorize