Fix /dev/ population to use char devices (Ryota Ozaki)

This commit is contained in:
Daniel P. Berrange 2009-05-08 10:22:46 +00:00
parent 6059354da6
commit 328eac61cd
4 changed files with 10 additions and 3 deletions

View File

@ -63,7 +63,6 @@ Patches have also been contributed by:
James Morris <jmorris@namei.org>
Daniel J Walsh <dwalsh@redhat.com>
Maximilian Wilhelm <max@rfc2324.org>
Ryota Ozaki <ozaki.ryota@gmail.com>
Pritesh Kothari <Pritesh.Kothari@Sun.COM>
Amit Shah <amit.shah@redhat.com>
Florian Vichot <florian.vichot@diateam.net>

View File

@ -1,3 +1,10 @@
Fri May 8 11:22:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
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 <agx@sigxcpu.org>
* src/vbox/vbox_tmpl.c (virDrvOpen): return VIR_DRV_OPEN_DECLINED

View File

@ -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"));

View File

@ -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)