From: Enrico Scholz Date: Mon, 13 Oct 2003 23:53:05 +0000 (+0000) Subject: This commit was manufactured by cvs2svn to create branch X-Git-Tag: version_0_23_96~61 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10d5dfbce0061478737f211188e5c4f7db72b6f8;p=util-vserver.git This commit was manufactured by cvs2svn to create branch 'SYSCALL_SWITCH'. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/branches/SYSCALL_SWITCH@110 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/.cvsignore b/util-vserver/.cvsignore index ffa3457..8671522 100644 --- a/util-vserver/.cvsignore +++ b/util-vserver/.cvsignore @@ -1,8 +1,9 @@ -.X_usr_local_etc-up-to-date +.*-up-to-date .deps COPYING ChangeLog INSTALL +Makefile aclocal.m4 autom4te.cache compile diff --git a/util-vserver/NEWS b/util-vserver/NEWS index e69de29..6e8c93c 100644 --- a/util-vserver/NEWS +++ b/util-vserver/NEWS @@ -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 index 0000000..e66ed1b --- /dev/null +++ b/util-vserver/compat.h @@ -0,0 +1,45 @@ +// $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_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 +# define MS_MOVE 8192 +#endif + +#ifndef HAVE_CTX_T +typedef short int ctx_t; +#endif + +#endif // H_UTIL_VSERVER_COMPAT_H diff --git a/util-vserver/configure.ac b/util-vserver/configure.ac index 5e7b319..e9b6ed5 100644 --- a/util-vserver/configure.ac +++ b/util-vserver/configure.ac @@ -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 index 0000000..ec96903 --- /dev/null +++ b/util-vserver/lib/.cvsignore @@ -0,0 +1,2 @@ +.deps +.dirstamp diff --git a/util-vserver/lib/getctx.c b/util-vserver/lib/getctx.c new file mode 100644 index 0000000..211ca41 --- /dev/null +++ b/util-vserver/lib/getctx.c @@ -0,0 +1,74 @@ +// $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 +#include +#include +#include + +#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 # 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 index 0000000..63d3635 --- /dev/null +++ b/util-vserver/src/.cvsignore @@ -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 diff --git a/util-vserver/src/rebootmgr.c b/util-vserver/src/rebootmgr.c index 8e9570e..47420b5 100644 --- a/util-vserver/src/rebootmgr.c +++ b/util-vserver/src/rebootmgr.c @@ -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 index 0000000..80bab4b --- /dev/null +++ b/util-vserver/sysv/.cvsignore @@ -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 index 0000000..0667ff3 --- /dev/null +++ b/util-vserver/tests/.cvsignore @@ -0,0 +1,8 @@ +.deps +.dirstamp +chrootsafe +escaperoot +forkbomb +testipc +testlimit +testopenf