Skip to contentSkip to conversation

udevd: help to debug timouts of RUN+=""

PATCH In review [email protected] 1 participant 2 messages Apr 18, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udevd: help to debug timouts of RUN+=""

From: Harald Hoyer <[email protected]>

Store pointer of command to RUN in the event, to aid debugging of timed out events.

---
 udev/udev-event.c |    2 ++
 udev/udevd.c      |    8 +++++++-
 2 files changed, 9 insertions(+), 1 deletions(-)
udev/udev-event.c +2 -0
index 60d06aa..6ac6ff5 100644
@@ -688,10 +688,12 @@ int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask)
 				info(event->udev, "delay execution of '%s'\n", program);
 				sleep(event->exec_delay);
 			}
+			event->program = program;
 			if (util_run_program(event->udev, program, envp, NULL, 0, NULL, sigmask) != 0) {
 				if (udev_list_entry_get_flags(list_entry))
 					err = -1;
 			}
+			event->program = NULL;
 		}
 	}
 	return err;
udev/udevd.c +7 -1
index f730cab..47bc2f4 100644
@@ -106,6 +106,7 @@ struct event {
 	dev_t devnum;
 	bool is_block;
 	int ifindex;
+	char *program;
 };
 
 static struct event *node_to_event(struct udev_list_node *node)
@@ -807,9 +808,14 @@ static void handle_signal(struct udev *udev, int signo)
 
 				info(udev, "worker [%u] exit\n", pid);
 				if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
-					err(udev, "worker [%u] unexpectedly returned with status 0x%04x\n", pid, status);
+					if (WIFSIGNALED(status))
+						err(udev, "worker [%u] killed by signal %d\n", pid, WTERMSIG(status));
+					if (WEXITSTATUS(status))
+						err(udev, "worker [%u] unexpectedly returned with status %d\n", pid, WEXITSTATUS(status));
 					if (worker->event != NULL) {
 						err(udev, "worker [%u] failed while handling '%s'\n", pid, worker->event->devpath);
+						if (worker->event->program)
+							err(udev, "worker [%u] failed while running '%s'\n", pid, worker->event->program);
 						worker->event->exitcode = -32;
 						event_queue_delete(worker->event, true);
 						/* drop reference from running event */
Signature · 1 line
1.7.3.4