summaryrefslogtreecommitdiff
path: root/udev/udevd.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-04-19 03:25:04 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-04-19 03:25:04 +0200
commit540f46698dd5a3bed767fa1c761ead1c9e41ed2e (patch)
tree24d3b7893b3d87aed9fa222fa68427421365ad36 /udev/udevd.c
parentccc87b0e992063df81d07fc2581d7ca2d9c87c0a (diff)
udevd: at startup create /dev/null, /dev/console, /dev/kmsg
Diffstat (limited to 'udev/udevd.c')
-rw-r--r--udev/udevd.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/udev/udevd.c b/udev/udevd.c
index 1aa50eb74c..d1a226673e 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -708,6 +708,28 @@ static void export_initial_seqnum(struct udev *udev)
}
}
+/* create the nodes the we depend on to properly start up */
+static void setup_initial_nodes(struct udev *udev)
+{
+ struct udev_device *dev;
+
+ dev = udev_device_new_from_subsystem_sysname(udev, "mem", "null");
+ if (dev != NULL) {
+ udev_node_mknod(dev, "null", makedev(0,0), 0666, 0, 0);
+ udev_device_unref(dev);
+ }
+ dev = udev_device_new_from_subsystem_sysname(udev, "mem", "kmsg");
+ if (dev != NULL) {
+ udev_node_mknod(dev, "kmsg", makedev(0,0), 0660, 0, 0);
+ udev_device_unref(dev);
+ }
+ dev = udev_device_new_from_subsystem_sysname(udev, "tty", "console");
+ if (dev != NULL) {
+ udev_node_mknod(dev, "console", makedev(0,0), 0600, 0, 0);
+ udev_device_unref(dev);
+ }
+}
+
static void startup_log(struct udev *udev)
{
FILE *f;
@@ -814,6 +836,8 @@ int main(int argc, char *argv[])
goto exit;
}
+ setup_initial_nodes(udev);
+
/* make sure std{in,out,err} fd's are in a sane state */
fd = open("/dev/null", O_RDWR);
if (fd < 0) {