summaryrefslogtreecommitdiffstats
path: root/coldplug.c
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2013-11-14 13:41:13 +0100
committerJohn Crispin <blogic@openwrt.org>2013-11-15 17:05:20 +0100
commit916f95cb58604038695347ee41a430d8ca1f0556 (patch)
tree5dbb52a6adaf28c6c6989ea37e6975aa52075160 /coldplug.c
parentf9d31edb8938341b9217ee4c14eb58111414eb97 (diff)
downloadunitd-916f95cb58604038695347ee41a430d8ca1f0556.tar
unitd-916f95cb58604038695347ee41a430d8ca1f0556.zip
debloat and reorganize code
split app into procd and init binaries remove log support, this is an external service now Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'coldplug.c')
-rw-r--r--coldplug.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/coldplug.c b/coldplug.c
deleted file mode 100644
index 71b09f0..0000000
--- a/coldplug.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org>
- * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation
- *
- * 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.
- */
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/mount.h>
-
-#include <unistd.h>
-
-#include "procd.h"
-#include "hotplug.h"
-
-static struct uloop_process udevtrigger;
-
-static void coldplug_complete(struct uloop_timeout *t)
-{
- DEBUG(2, "Coldplug complete\n");
- hotplug_last_event(NULL);
- procd_state_next();
-}
-
-static void udevtrigger_complete(struct uloop_process *proc, int ret)
-{
- DEBUG(2, "Finished udevtrigger\n");
- hotplug_last_event(coldplug_complete);
-}
-
-void procd_coldplug(void)
-{
- char *argv[] = { "udevtrigger", NULL };
-
- umount2("/dev/pts", MNT_DETACH);
- umount2("/dev/", MNT_DETACH);
- mount("tmpfs", "/dev", "tmpfs", 0, "mode=0755,size=512K");
- mkdir("/dev/shm", 0755);
- mkdir("/dev/pts", 0755);
- mount("devpts", "/dev/pts", "devpts", 0, 0);
- udevtrigger.cb = udevtrigger_complete;
- udevtrigger.pid = fork();
- if (!udevtrigger.pid) {
- execvp(argv[0], argv);
- ERROR("Failed to start coldplug\n");
- exit(-1);
- }
-
- if (udevtrigger.pid <= 0) {
- ERROR("Failed to start new coldplug instance\n");
- return;
- }
-
- uloop_process_add(&udevtrigger);
-
- DEBUG(2, "Launched coldplug instance, pid=%d\n", (int) udevtrigger.pid);
-}