]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: add debugging logs in spawn_wait()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 21 Jan 2021 05:06:43 +0000 (14:06 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 1 Feb 2021 14:37:27 +0000 (23:37 +0900)
src/udev/udev-event.c

index 9fb5e4ae6231e301b28451811fcfd579208d124c..009a48020e3e406057adb8e621c6d565e4882595 100644 (file)
@@ -661,7 +661,7 @@ static int spawn_wait(Spawn *spawn) {
 
         r = sd_event_new(&e);
         if (r < 0)
-                return r;
+                return log_device_debug_errno(spawn->device, r, "Failed to allocate sd-event object: %m");
 
         if (spawn->timeout_usec > 0) {
                 usec_t usec, age_usec;
@@ -678,7 +678,7 @@ static int spawn_wait(Spawn *spawn) {
                                                       usec + spawn->timeout_warn_usec, USEC_PER_SEC,
                                                       on_spawn_timeout_warning, spawn);
                                 if (r < 0)
-                                        return r;
+                                        return log_device_debug_errno(spawn->device, r, "Failed to create timeout warning event source: %m");
                         }
 
                         spawn->timeout_usec -= age_usec;
@@ -686,35 +686,35 @@ static int spawn_wait(Spawn *spawn) {
                         r = sd_event_add_time(e, NULL, CLOCK_MONOTONIC,
                                               usec + spawn->timeout_usec, USEC_PER_SEC, on_spawn_timeout, spawn);
                         if (r < 0)
-                                return r;
+                                return log_device_debug_errno(spawn->device, r, "Failed to create timeout event source: %m");
                 }
         }
 
         if (spawn->fd_stdout >= 0) {
                 r = sd_event_add_io(e, &stdout_source, spawn->fd_stdout, EPOLLIN, on_spawn_io, spawn);
                 if (r < 0)
-                        return r;
+                        return log_device_debug_errno(spawn->device, r, "Failed to create stdio event source: %m");
                 r = sd_event_source_set_enabled(stdout_source, SD_EVENT_ONESHOT);
                 if (r < 0)
-                        return r;
+                        return log_device_debug_errno(spawn->device, r, "Failed to enable stdio event source: %m");
         }
 
         if (spawn->fd_stderr >= 0) {
                 r = sd_event_add_io(e, &stderr_source, spawn->fd_stderr, EPOLLIN, on_spawn_io, spawn);
                 if (r < 0)
-                        return r;
+                        return log_device_debug_errno(spawn->device, r, "Failed to create stderr event source: %m");
                 r = sd_event_source_set_enabled(stderr_source, SD_EVENT_ONESHOT);
                 if (r < 0)
-                        return r;
+                        return log_device_debug_errno(spawn->device, r, "Failed to enable stderr event source: %m");
         }
 
         r = sd_event_add_child(e, &sigchld_source, spawn->pid, WEXITED, on_spawn_sigchld, spawn);
         if (r < 0)
-                return r;
+                return log_device_debug_errno(spawn->device, r, "Failed to create sigchild event source: %m");
         /* SIGCHLD should be processed after IO is complete */
         r = sd_event_source_set_priority(sigchld_source, SD_EVENT_PRIORITY_NORMAL + 1);
         if (r < 0)
-                return r;
+                return log_device_debug_errno(spawn->device, r, "Failed to set priority to sigchild event source: %m");
 
         return sd_event_loop(e);
 }