linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] udevd: help to debug timouts of RUN+=""
@ 2011-04-18  8:05 harald
  2011-04-18  8:28 ` Harald Hoyer
  0 siblings, 1 reply; 2+ messages in thread
From: harald @ 2011-04-18  8:05 UTC (permalink / raw)
  To: linux-hotplug

From: Harald Hoyer <harald@redhat.com>

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(-)

diff --git a/udev/udev-event.c b/udev/udev-event.c
index 60d06aa..6ac6ff5 100644
--- a/udev/udev-event.c
+++ b/udev/udev-event.c
@@ -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;
diff --git a/udev/udevd.c b/udev/udevd.c
index f730cab..47bc2f4 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -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 */
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] udevd: help to debug timouts of RUN+=""
  2011-04-18  8:05 [PATCH] udevd: help to debug timouts of RUN+="" harald
@ 2011-04-18  8:28 ` Harald Hoyer
  0 siblings, 0 replies; 2+ messages in thread
From: Harald Hoyer @ 2011-04-18  8:28 UTC (permalink / raw)
  To: linux-hotplug

Am 18.04.2011 10:05, schrieb harald@redhat.com:
> From: Harald Hoyer <harald@redhat.com>
> 
> Store pointer of command to RUN in the event, to aid debugging of timed
> out events.

forget it... will send correct patch later.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-04-18  8:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18  8:05 [PATCH] udevd: help to debug timouts of RUN+="" harald
2011-04-18  8:28 ` Harald Hoyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).