lib/val2text-v2t-uint32.c \
lib/val2text-v2t-uint64.c \
lib/parselimit.c \
+ lib/getkernel.c \
$(lib_legacy_SRCS) \
$(lib_compat_SRCS) \
$(lib_management_SRCS) \
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2011 Daniel Hokka Zakrisson <daniel@hozac.com>
+//
+// 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 <sys/utsname.h>
+#include <ctype.h>
+
+int
+vc_get_kernel()
+{
+ static int linux_ver = -1;
+ if (linux_ver == -1) {
+ struct utsname uts;
+ char *p;
+ int part, n;
+ if (uname(&uts) == -1)
+ return -1;
+ part = 0;
+ n = 0;
+ linux_ver = 0;
+ for (p = uts.release; *p && part < 3; p++) {
+ if (*p == '.') {
+ if (part < 3) {
+ linux_ver |= n << (8 * (2 - part));
+ n = 0;
+ part++;
+ }
+ }
+ else if (isdigit(*p)) {
+ n *= 10;
+ n += *p - '0';
+ }
+ else
+ break;
+ }
+ if (n > 0 && part < 3)
+ linux_ver |= n << (8 * (2 - part));
+ }
+ return linux_ver;
+}
{
int ver = vc_get_version();
vc_vci_t conf = vc_get_vci();
+ int linux_ver = vc_get_kernel();
if (ver==-1) return false;
if (conf==(vc_vci_t)-1) conf = 0;
case vcFEATURE_PIDSPACE : return false;
case vcFEATURE_MEMCG : return ver >= 0x00020306 && conf & VC_VCI_MEMCG;
case vcFEATURE_DYNAMIC : return ver < 0x00020300 || !(conf & VC_VCI_NO_DYNAMIC);
+ case vcFEATURE_BME : return linux_ver < 0x0002061a;
default : assert(false);
}
DECL(VHI), DECL(VSHELPER0), DECL(VSHELPER), DECL(VWAIT),
DECL(VNET), DECL(VSTAT), DECL(PPTAG), DECL(PIDSPACE),
DECL(SPACES), DECL(PERSISTENT),DECL(PIVOT_ROOT),DECL(MEMCG),
- DECL(DYNAMIC),
+ DECL(DYNAMIC), DECL(BME),
};
bool
*/
vc_vci_t vc_get_vci();
+ int vc_get_kernel();
+
/** \brief Moves current process into a context
* \ingroup syscalls
*
vcFEATURE_VNET, vcFEATURE_VSTAT, vcFEATURE_PPTAG,
vcFEATURE_PIDSPACE, vcFEATURE_SPACES, vcFEATURE_PERSISTENT,
vcFEATURE_PIVOT_ROOT, vcFEATURE_MEMCG, vcFEATURE_DYNAMIC,
+ vcFEATURE_BME,
}
vcFeatureSet;
opt->cur_dir_fd = Eopen(".", O_RDONLY|O_DIRECTORY, 0);
Efcntl(opt->cur_dir_fd, F_SETFD, FD_CLOEXEC);
}
- if ((mnt->flag & MS_BIND) &&
+ if (!vc_isSupported(vcFEATURE_BME) &&
+ (mnt->flag & MS_BIND) &&
(mnt->mask & ~(MS_BIND|MS_REC))) {
/* This is needed to put us in the new mountpoint */
if (!secureChdir(mnt->dst, opt))