From 328eac61cdea025b747a5299f5741175fcb64927 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 8 May 2009 10:22:46 +0000 Subject: [PATCH] Fix /dev/ population to use char devices (Ryota Ozaki) --- AUTHORS | 1 - ChangeLog | 7 +++++++ src/lxc_container.c | 4 ++-- src/lxc_controller.c | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 35b96ebf0f..228a44c9fb 100644 --- a/AUTHORS +++ b/AUTHORS @@ -63,7 +63,6 @@ Patches have also been contributed by: James Morris Daniel J Walsh Maximilian Wilhelm - Ryota Ozaki Pritesh Kothari Amit Shah Florian Vichot diff --git a/ChangeLog b/ChangeLog index e835dfc573..e71d1663ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri May 8 11:22:22 BST 2009 Daniel P. Berrange + + Fix /dev/ population to use char devices (Ryota Ozaki) + * src/lxc_controller.c: Add /dev/ptmx to allow cgroup resources + * src/lxc_container.c: Create dev nodes as char devices, not + plain files + Fri May 8 12:15:05 CEST 2009 Guido Günther * src/vbox/vbox_tmpl.c (virDrvOpen): return VIR_DRV_OPEN_DECLINED diff --git a/src/lxc_container.c b/src/lxc_container.c index 3946b84f06..c30daecd9f 100644 --- a/src/lxc_container.c +++ b/src/lxc_container.c @@ -440,7 +440,7 @@ static int lxcContainerPopulateDevices(void) /* Populate /dev/ with a few important bits */ for (i = 0 ; i < ARRAY_CARDINALITY(devs) ; i++) { dev_t dev = makedev(devs[i].maj, devs[i].min); - if (mknod(devs[i].path, 0, dev) < 0 || + if (mknod(devs[i].path, S_IFCHR, dev) < 0 || chmod(devs[i].path, devs[i].mode)) { virReportSystemError(NULL, errno, _("failed to make device %s"), @@ -457,7 +457,7 @@ static int lxcContainerPopulateDevices(void) } } else { dev_t dev = makedev(LXC_DEV_MAJ_TTY, LXC_DEV_MIN_PTMX); - if (mknod("/dev/ptmx", 0, dev) < 0 || + if (mknod("/dev/ptmx", S_IFCHR, dev) < 0 || chmod("/dev/ptmx", 0666)) { virReportSystemError(NULL, errno, "%s", _("failed to make device /dev/ptmx")); diff --git a/src/lxc_controller.c b/src/lxc_controller.c index e0fb05d038..356ecb80b4 100644 --- a/src/lxc_controller.c +++ b/src/lxc_controller.c @@ -75,6 +75,7 @@ static int lxcSetContainerResources(virDomainDefPtr def) {'c', LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_RANDOM}, {'c', LXC_DEV_MAJ_MEMORY, LXC_DEV_MIN_URANDOM}, {'c', LXC_DEV_MAJ_TTY, LXC_DEV_MIN_CONSOLE}, + {'c', LXC_DEV_MAJ_TTY, LXC_DEV_MIN_PTMX}, {0, 0, 0}}; if (virCgroupHaveSupport() != 0)