This commit was manufactured by cvs2svn to create branch
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Mon, 13 Oct 2003 23:53:05 +0000 (23:53 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Mon, 13 Oct 2003 23:53:05 +0000 (23:53 +0000)
'SYSCALL_SWITCH'.

git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/branches/SYSCALL_SWITCH@110 94cd875c-1c1d-0410-91d2-eb244daf1a30

12 files changed:
util-vserver/.cvsignore
util-vserver/NEWS
util-vserver/compat.h [new file with mode: 0644]
util-vserver/configure.ac
util-vserver/lib/.cvsignore [new file with mode: 0644]
util-vserver/lib/getctx.c [new file with mode: 0644]
util-vserver/scripts/.cvsignore [new file with mode: 0644]
util-vserver/scripts/vserver
util-vserver/src/.cvsignore [new file with mode: 0644]
util-vserver/src/rebootmgr.c
util-vserver/sysv/.cvsignore [new file with mode: 0644]
util-vserver/tests/.cvsignore [new file with mode: 0644]

index ffa3457..8671522 100644 (file)
@@ -1,8 +1,9 @@
-.X_usr_local_etc-up-to-date
+.*-up-to-date
 .deps
 COPYING
 ChangeLog
 INSTALL
+Makefile
 aclocal.m4
 autom4te.cache
 compile
index e69de29..6e8c93c 100644 (file)
@@ -0,0 +1,4 @@
+version 0.23.6
+==============
+
+       - fixed '--level' option on 'vserver ... chkconfig'
diff --git a/util-vserver/compat.h b/util-vserver/compat.h
new file mode 100644 (file)
index 0000000..e66ed1b
--- /dev/null
@@ -0,0 +1,45 @@
+// $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(__GNUC__)
+#  define UNUSED                __attribute__((__unused__))
+#  define NORETURN              __attribute__((__noreturn__))
+#  if __GNUC__ >= 3
+#    define ALWAYSINLINE        __attribute__((__always_inline__))
+#  else
+#    define ALWAYSINLINE
+#  endif
+#else
+#  define UNUSED
+#  define NORETURN
+#  define ALWAYSINLINE
+#endif
+
+#if !defined(HAVE_DECL_MS_MOVE) || !(HAVE_DECL_MS_MOVE)
+  // from <linux/fs.h>
+#  define MS_MOVE              8192
+#endif
+
+#ifndef HAVE_CTX_T
+typedef short int              ctx_t;
+#endif
+
+#endif //  H_UTIL_VSERVER_COMPAT_H
index 5e7b319..e9b6ed5 100644 (file)
@@ -24,7 +24,7 @@ dnl distribution terms that you use for the rest of that program.
 dnl  
 
 AC_PREREQ(2.57)
-AC_INIT(util-vserver, 0.23.5, enrico.scholz@informatik.tu-chemnitz.de)
+AC_INIT(util-vserver, 0.23.6, enrico.scholz@informatik.tu-chemnitz.de)
 AC_CONFIG_SRCDIR([src/capchroot.c])
 AC_CONFIG_HEADER([config.h])
 
diff --git a/util-vserver/lib/.cvsignore b/util-vserver/lib/.cvsignore
new file mode 100644 (file)
index 0000000..ec96903
--- /dev/null
@@ -0,0 +1,2 @@
+.deps
+.dirstamp
diff --git a/util-vserver/lib/getctx.c b/util-vserver/lib/getctx.c
new file mode 100644 (file)
index 0000000..211ca41
--- /dev/null
@@ -0,0 +1,74 @@
+// $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.
+
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include "compat.h"
+#include "vserver.h"
+#include "internal.h"
+#include <string.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#define CTX_TAG                "\ns_context: "
+
+ctx_t
+getctx(pid_t pid)
+{
+  static volatile size_t       bufsize=4097;
+    // TODO: is this really race-free?
+  size_t                       cur_bufsize = bufsize;
+  int                          fd;
+  char                         status_name[ sizeof("/proc/01234/status") ];
+  char                         buf[cur_bufsize];
+  size_t                       len;
+  char                         *pos = 0;
+
+  strcpy(status_name, "/proc/");
+  len = utilvserver_uint2str(status_name+sizeof("/proc/")-1,
+                            sizeof(status_name)-sizeof("/proc//status")+1,
+                            pid, 10);
+  strcpy(status_name+sizeof("/proc/")+len-1, "/status");
+
+  fd = open(status_name, O_RDONLY);
+  if (fd==-1) return CTX_NOCTX;
+
+  len = read(fd, buf, cur_bufsize);
+  close(fd);
+
+  if (len<cur_bufsize)
+    pos      = strstr(buf, CTX_TAG);
+  else if (len!=(size_t)-1) {
+    bufsize  = cur_bufsize * 2 - 1;
+    errno    = EAGAIN;
+  }
+
+  if (pos!=0) return atoi(pos+sizeof(CTX_TAG)-1);
+  else        return CTX_NOCTX;
+}
+
+#if 0
+ctx_t
+getcctx()
+{
+  return getctx(getpid());
+}
+#endif
diff --git a/util-vserver/scripts/.cvsignore b/util-vserver/scripts/.cvsignore
new file mode 100644 (file)
index 0000000..61478f9
--- /dev/null
@@ -0,0 +1 @@
+util-vserver-vars
index c40eaf1..1a80cda 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
 # based on vserver by Jacques Gelinas
@@ -737,17 +737,17 @@ elif [ "$2" = "service" ] ; then
        exec $0 $NODEV $SILENT $VSERVER exec /sbin/service "$@"
 elif [ "$2" = "chkconfig" ] ; then
        VSERVER=$1
+       LEVELS=()
        shift
        shift
        if [ "$1" = "--level" ] ; then
-               shift
-               LEVELS=$1
-               shift
+               LEVELS=( --level "$2" )
+               shift 2
        fi
        if [ $# != 2 -a ! -x /vservers/$VSERVER/sbin/chkconfig ] ; then
                echo Invalid argument, expected vserver name chkconfig [ --level nnn ] service on\|off
        elif [ -x /vservers/$VSERVER/sbin/chkconfig ] ; then
-               exec $0 --silent $VSERVER exec /sbin/chkconfig "$@"
+               exec $0 --silent $VSERVER exec /sbin/chkconfig "${LEVELS[@]}" "$@"
        elif [ -x /vservers/$VSERVER/usr/sbin/update-rc.d ] ; then
                if [ "$2" = "on" -o "$2" = "start" ] ; then
                        $0 --silent $VSERVER exec /usr/sbin/update-rc.d -f $1 remove >/dev/null
diff --git a/util-vserver/src/.cvsignore b/util-vserver/src/.cvsignore
new file mode 100644 (file)
index 0000000..63d3635
--- /dev/null
@@ -0,0 +1,23 @@
+.deps
+.dirstamp
+capchroot
+chbind
+chcontext
+fakerunlevel
+filetime
+ifspec
+listdevip
+parserpmdump
+readlink
+rebootmgr
+reducecap
+setctxlimit
+showattr
+showperm
+vbuild
+vcheck
+vdu
+vfiles
+vreboot
+vserver-stat
+vunify
index 8e9570e..47420b5 100644 (file)
@@ -197,7 +197,7 @@ int main (int argc, char *argv[])
                                                int fd = sockets[i];
                                                if (FD_ISSET(fd,&fdin)){
                                                        struct sockaddr_un unc;
-                                                       size_t len = sizeof(unc);
+                                                       socklen_t len = sizeof(unc);
                                                        unc.sun_family = AF_UNIX;
                                                        fd = accept (fd,(struct sockaddr*)&unc,&len);
                                                        if (fd != -1){
diff --git a/util-vserver/sysv/.cvsignore b/util-vserver/sysv/.cvsignore
new file mode 100644 (file)
index 0000000..80bab4b
--- /dev/null
@@ -0,0 +1,10 @@
+rebootmgr
+v_gated
+v_httpd
+v_named
+v_portmap
+v_sendmail
+v_smb
+v_sshd
+v_xinetd
+vservers
diff --git a/util-vserver/tests/.cvsignore b/util-vserver/tests/.cvsignore
new file mode 100644 (file)
index 0000000..0667ff3
--- /dev/null
@@ -0,0 +1,8 @@
+.deps
+.dirstamp
+chrootsafe
+escaperoot
+forkbomb
+testipc
+testlimit
+testopenf