linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* temporarily disabling udev
@ 2004-12-19 14:56 Marco d'Itri
  2004-12-19 15:32 ` Kay Sievers
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Marco d'Itri @ 2004-12-19 14:56 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]

I need to patch udev to be sure that it will not modify /dev if
udevstart has been not been run (e.g. because root disabled the
init script, or it failed for some reason).
Would this work?

diff -ruNp udev-048.orig/udev.c udev-048/udev.c
--- udev-048.orig/udev.c	2004-12-08 20:43:16.000000000 +0100
+++ udev-048/udev.c	2004-12-19 15:09:51.000000000 +0100
@@ -83,6 +83,15 @@ exit:
 	return 0;
 }
 
+/* return true if the udev database exists */
+static int udev_active(void) {
+	struct stat stats;
+
+	if (stat (udev_db_path, &stats) == 0)
+		return 1;
+	return 0;
+}
+
 static void asmlinkage sig_handler(int signum)
 {
 	switch (signum) {
@@ -161,6 +170,9 @@ int main(int argc, char *argv[], char *e
 	if (udev_log)
 		setenv("UDEV_LOG", "1", 1);
 
+	if (!udev_active())
+		goto hotplug;
+
 	if ((strncmp(devpath, "/block/", 7) == 0) || (strncmp(devpath, "/class/", 7) == 0)) {
 		if (strcmp(action, "add") == 0) {
 			/* wait for sysfs and possibly add node */


-- 
ciao, |
Marco | [9919 peXnx6UiWKdTk]

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-12-19 16:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-19 14:56 temporarily disabling udev Marco d'Itri
2004-12-19 15:32 ` Kay Sievers
2004-12-19 15:43 ` Marco d'Itri
2004-12-19 16:09 ` Kay Sievers
2004-12-19 16:58 ` Marco d'Itri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).