chiark / gitweb /
remove UDEV_RUN environment variable
authorKay Sievers <kay.sievers@vrfy.org>
Fri, 25 Dec 2009 14:23:45 +0000 (15:23 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Fri, 25 Dec 2009 14:23:45 +0000 (15:23 +0100)
It handles only RUN but not IMPORT and PROGRAM. There is no sane way
to suppress program execution. Most important programs run with IMPORT
these days. Also events can no longer suppressed with the libudev
netlink messages, so UDEV_RUN does nothing useful and is just
inconsistent.

Makefile.am
libudev/libudev-private.h
libudev/libudev.c
udev/test-udev.c
udev/udevadm-test.c
udev/udevd.c

index 126064b..e037e60 100644 (file)
@@ -28,9 +28,9 @@ CLEANFILES =
 # ------------------------------------------------------------------------------
 # libudev
 # ------------------------------------------------------------------------------
-LIBUDEV_CURRENT=5
-LIBUDEV_REVISION=2
-LIBUDEV_AGE=5
+LIBUDEV_CURRENT=6
+LIBUDEV_REVISION=0
+LIBUDEV_AGE=6
 
 SUBDIRS += libudev/docs
 
index fe1575d..c2fff00 100644 (file)
@@ -59,7 +59,6 @@ void udev_log(struct udev *udev,
              const char *format, ...)
              __attribute__((format(printf, 6, 7)));
 const char *udev_get_rules_path(struct udev *udev);
-int udev_get_run(struct udev *udev);
 struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value);
 struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev);
 
index 1909138..411e9ae 100644 (file)
@@ -45,7 +45,6 @@ struct udev {
        char *rules_path;
        struct udev_list_node properties_list;
        int log_priority;
-       int run;
 };
 
 void udev_log(struct udev *udev,
@@ -122,7 +121,6 @@ struct udev *udev_new(void)
        udev->log_fn = log_stderr;
        udev->log_priority = LOG_ERR;
        udev_list_init(&udev->properties_list);
-       udev->run = 1;
        udev->dev_path = strdup("/dev");
        udev->sys_path = strdup("/sys");
        config_file = strdup(SYSCONFDIR "/udev/udev.conf");
@@ -140,10 +138,6 @@ struct udev *udev_new(void)
                udev_add_property(udev, "SYSFS_PATH", udev->sys_path);
        }
 
-       env = getenv("UDEV_RUN");
-       if (env != NULL && strcmp(env, "0") == 0)
-               udev->run = 0;
-
        env = getenv("UDEV_CONFIG_FILE");
        if (env != NULL) {
                free(config_file);
@@ -359,11 +353,6 @@ const char *udev_get_rules_path(struct udev *udev)
        return udev->rules_path;
 }
 
-int udev_get_run(struct udev *udev)
-{
-       return udev->run;
-}
-
 /**
  * udev_get_sys_path:
  * @udev: udev library context
index 75518f6..28c833a 100644 (file)
@@ -108,7 +108,7 @@ int main(int argc, char *argv[])
        if (udev_device_get_event_timeout(dev) >= 0)
                alarm(udev_device_get_event_timeout(dev));
 
-       if (err == 0 && udev_get_run(udev))
+       if (err == 0)
                udev_event_execute_run(event, NULL);
 
        udev_event_unref(event);
index 5dd515b..8946200 100644 (file)
@@ -119,14 +119,13 @@ int udevadm_test(struct udev *udev, int argc, char *argv[])
        udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev))
                info(udev, "%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry));
 
-       if (err == 0 && udev_get_run(udev)) {
+       if (err == 0)
                udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) {
                        char program[UTIL_PATH_SIZE];
 
                        udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program));
                        info(udev, "run: '%s'\n", program);
                }
-       }
        udev_event_unref(event);
        udev_device_unref(dev);
 exit:
index 99647c6..170225d 100644 (file)
@@ -292,12 +292,9 @@ static void worker_new(struct event *event)
                        if (udev_device_get_event_timeout(dev) >= 0)
                                alarm(udev_device_get_event_timeout(dev));
 
-                       /* execute RUN= */
-                       if (err == 0 && udev_get_run(udev_event->udev))
-                               failed = udev_event_execute_run(udev_event,
-                                                               &orig_sigmask);
+                       if (err == 0)
+                               failed = udev_event_execute_run(udev_event, &orig_sigmask);
 
-                       /* reset alarm */
                        alarm(0);
 
                        /* apply/restore inotify watch */
@@ -309,7 +306,7 @@ static void worker_new(struct event *event)
                        /* send processed event back to libudev listeners */
                        udev_monitor_send_device(worker_monitor, NULL, dev);
 
-                       /* send back the result of the event execution */
+                       /* send udevd the result of the event execution */
                        if (err != 0)
                                msg.exitcode = err;
                        else if (failed != 0)