chiark / gitweb /
udevd: at startup write message including version number to kernel log
[elogind.git] / udevd.c
diff --git a/udevd.c b/udevd.c
index 7f32a2aa7926b5f58ea0a6b0b7fb27cf0baa9c50..530fc59a369a111e5465ec6a23b5bdc2bcf9df6b 100644 (file)
--- a/udevd.c
+++ b/udevd.c
@@ -479,12 +479,20 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit)
                        return 3;
                }
 
+               /* check for our major:minor number */
+               if (msg->devt && loop_msg->devt == msg->devt &&
+                   strcmp(msg->subsystem, loop_msg->subsystem) == 0) {
+                       dbg("%llu, device event still pending %llu (%d:%d)", msg->seqnum,
+                           loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt));
+                       return 4;
+               }
+
                /* check physical device event (special case of parent) */
                if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0)
                        if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) {
                                dbg("%llu, physical device event still pending %llu (%s)",
                                    msg->seqnum, loop_msg->seqnum, loop_msg->devpath);
-                               return 4;
+                               return 5;
                        }
        }
 
@@ -507,12 +515,20 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit)
                        return 3;
                }
 
+               /* check for our major:minor number */
+               if (msg->devt && loop_msg->devt == msg->devt &&
+                   strcmp(msg->subsystem, loop_msg->subsystem) == 0) {
+                       dbg("%llu, device event still running %llu (%d:%d)", msg->seqnum,
+                           loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt));
+                       return 4;
+               }
+
                /* check physical device event (special case of parent) */
                if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0)
                        if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) {
                                dbg("%llu, physical device event still running %llu (%s)",
                                    msg->seqnum, loop_msg->seqnum, loop_msg->devpath);
-                               return 4;
+                               return 5;
                        }
        }
        return 0;
@@ -846,7 +862,7 @@ static int init_udevd_socket(void)
        saddr.sun_family = AF_LOCAL;
        /* use abstract namespace for socket path */
        strcpy(&saddr.sun_path[1], UDEVD_CTRL_SOCK_PATH);
-       addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1;
+       addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]);
 
        udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0);
        if (udevd_sock == -1) {
@@ -1100,6 +1116,14 @@ int main(int argc, char *argv[], char *envp[])
                close(fd);
        }
 
+       fd = open("/dev/kmsg", O_WRONLY);
+       if (fd > 0) {
+               const char *str = "<6>udevd version " UDEV_VERSION " started\n";
+
+               write(fd, str, strlen(str));
+               close(fd);
+       }
+
        /* set signal handlers */
        memset(&act, 0x00, sizeof(struct sigaction));
        act.sa_handler = (void (*)(int)) sig_handler;