diff -urNp hal-0.5.8.1.old/hald/hald.c hal-0.5.8.1/hald/hald.c --- hal-0.5.8.1.old/hald/hald.c 2006-09-19 21:23:25.000000000 +0100 +++ hal-0.5.8.1/hald/hald.c 2009-05-14 12:26:02.000000000 +0100 @@ -217,6 +217,9 @@ usage () " --use-syslog Print out debug messages to syslog instead of stderr.\n" " Use this option to get debug messages if HAL runs as\n" " daemon.\n" + " --child-timeout=time Set this timout for the child prober. A larger\n" + " number than the default 250s is required for systems\n" + " with many resources to be probed at boot time\n" " --help Show this information and exit\n" " --version Output version information and exit" "\n" @@ -297,7 +300,7 @@ handle_sigchld (int value) } static int -parent_wait_for_child (int child_fd, pid_t child_pid) +parent_wait_for_child (guint timeout, int child_fd, pid_t child_pid) { fd_set rfds; fd_set efds; @@ -324,8 +327,8 @@ parent_wait_for_child (int child_fd, pid FD_SET(child_fd, &rfds); FD_ZERO(&efds); FD_SET(child_fd, &efds); - /* Wait up to 250 seconds for device probing */ - tv.tv_sec = 250; + /* Wait up to a set time for device probing */ + tv.tv_sec = timeout; tv.tv_usec = 0; retval = select (child_fd + 1, &rfds, NULL, &efds, &tv); @@ -365,6 +368,7 @@ main (int argc, char *argv[]) guint sigterm_iochn_listener_source_id; char *path; char newpath[512]; + guint opt_child_timeout; openlog ("hald", LOG_PID, LOG_DAEMON); @@ -394,6 +398,9 @@ main (int argc, char *argv[]) setenv ("PATH", newpath, TRUE); + /* set the default child timeout to 250 seconds */ + opt_child_timeout = 250; + while (1) { int c; int option_index = 0; @@ -402,6 +409,7 @@ main (int argc, char *argv[]) {"daemon", 1, NULL, 0}, {"verbose", 1, NULL, 0}, {"use-syslog", 0, NULL, 0}, + {"child-timeout", 1, NULL, 0}, {"help", 0, NULL, 0}, {"version", 0, NULL, 0}, {NULL, 0, NULL, 0} @@ -431,6 +439,8 @@ main (int argc, char *argv[]) usage (); return 1; } + } else if (strcmp (opt, "child-timeout") == 0) { + opt_child_timeout = atoi (optarg); } else if (strcmp (opt, "verbose") == 0) { if (strcmp ("yes", optarg) == 0) { hald_is_verbose = TRUE; @@ -470,6 +480,7 @@ main (int argc, char *argv[]) loop = g_main_loop_new (NULL, FALSE); HAL_INFO ((PACKAGE_STRING)); + HAL_INFO (("using child timeout %is", opt_child_timeout)); if (opt_become_daemon) { int child_pid; @@ -516,7 +527,7 @@ main (int argc, char *argv[]) default: /* parent, block until child writes */ - exit (parent_wait_for_child (startup_daemonize_pipe[0], child_pid)); + exit (parent_wait_for_child (opt_child_timeout, startup_daemonize_pipe[0], child_pid)); break; }