All of lore.kernel.org
 help / color / mirror / Atom feed
From: md@Linux.IT (Marco d'Itri)
To: linux-hotplug@vger.kernel.org
Subject: temporarily disabling udev
Date: Sun, 19 Dec 2004 14:56:16 +0000	[thread overview]
Message-ID: <20041219145616.GA8975@wonderland.linux.it> (raw)

[-- 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 --]

             reply	other threads:[~2004-12-19 14:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-19 14:56 Marco d'Itri [this message]
2004-12-19 15:32 ` temporarily disabling udev 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041219145616.GA8975@wonderland.linux.it \
    --to=md@linux.it \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.