Lines 47-52
Link Here
|
47 |
static int udevsendsock; |
47 |
static int udevsendsock; |
48 |
|
48 |
|
49 |
static int pipefds[2]; |
49 |
static int pipefds[2]; |
|
|
50 |
static long startup_time; |
50 |
static unsigned long long expected_seqnum = 0; |
51 |
static unsigned long long expected_seqnum = 0; |
51 |
static volatile int sigchilds_waiting; |
52 |
static volatile int sigchilds_waiting; |
52 |
static volatile int run_msg_q; |
53 |
static volatile int run_msg_q; |
Lines 220-225
Link Here
|
220 |
struct hotplug_msg *tmp_msg; |
221 |
struct hotplug_msg *tmp_msg; |
221 |
struct sysinfo info; |
222 |
struct sysinfo info; |
222 |
long msg_age = 0; |
223 |
long msg_age = 0; |
|
|
224 |
static int timeout = EVENT_INIT_TIMEOUT_SEC; |
225 |
static int init = 1; |
223 |
|
226 |
|
224 |
dbg("msg queue manager, next expected is %llu", expected_seqnum); |
227 |
dbg("msg queue manager, next expected is %llu", expected_seqnum); |
225 |
recheck: |
228 |
recheck: |
Lines 230-240
Link Here
|
230 |
continue; |
233 |
continue; |
231 |
} |
234 |
} |
232 |
|
235 |
|
|
|
236 |
/* see if we are in the initialization phase and wait for the very first events */ |
237 |
if (init && (info.uptime - startup_time >= INIT_TIME_SEC)) { |
238 |
init = 0; |
239 |
timeout = EVENT_TIMEOUT_SEC; |
240 |
dbg("initialization phase passed, set timeout to %i seconds", EVENT_TIMEOUT_SEC); |
241 |
} |
242 |
|
233 |
/* move event with expired timeout to the exec list */ |
243 |
/* move event with expired timeout to the exec list */ |
234 |
sysinfo(&info); |
244 |
sysinfo(&info); |
235 |
msg_age = info.uptime - loop_msg->queue_time; |
245 |
msg_age = info.uptime - loop_msg->queue_time; |
236 |
dbg("seq %llu is %li seconds old", loop_msg->seqnum, msg_age); |
246 |
dbg("seq %llu is %li seconds old", loop_msg->seqnum, msg_age); |
237 |
if (msg_age > EVENT_TIMEOUT_SEC-1) { |
247 |
if (msg_age >= timeout) { |
238 |
msg_move_exec(loop_msg); |
248 |
msg_move_exec(loop_msg); |
239 |
goto recheck; |
249 |
goto recheck; |
240 |
} else { |
250 |
} else { |
Lines 246-253
Link Here
|
246 |
|
256 |
|
247 |
/* set timeout for remaining queued events */ |
257 |
/* set timeout for remaining queued events */ |
248 |
if (list_empty(&msg_list) == 0) { |
258 |
if (list_empty(&msg_list) == 0) { |
249 |
struct itimerval itv = {{0, 0}, {EVENT_TIMEOUT_SEC - msg_age, 0}}; |
259 |
struct itimerval itv = {{0, 0}, {timeout - msg_age, 0}}; |
250 |
dbg("next event expires in %li seconds", EVENT_TIMEOUT_SEC - msg_age); |
260 |
dbg("next event expires in %li seconds", timeout - msg_age); |
251 |
setitimer(ITIMER_REAL, &itv, NULL); |
261 |
setitimer(ITIMER_REAL, &itv, NULL); |
252 |
} |
262 |
} |
253 |
} |
263 |
} |
Lines 429-434
Link Here
|
429 |
|
439 |
|
430 |
int main(int argc, char *argv[], char *envp[]) |
440 |
int main(int argc, char *argv[], char *envp[]) |
431 |
{ |
441 |
{ |
|
|
442 |
struct sysinfo info; |
432 |
int maxsockplus; |
443 |
int maxsockplus; |
433 |
struct sockaddr_un saddr; |
444 |
struct sockaddr_un saddr; |
434 |
socklen_t addrlen; |
445 |
socklen_t addrlen; |
Lines 531-536
Link Here
|
531 |
dbg("udev binary is set to '%s'", udev_bin); |
542 |
dbg("udev binary is set to '%s'", udev_bin); |
532 |
else |
543 |
else |
533 |
udev_bin = UDEV_BIN; |
544 |
udev_bin = UDEV_BIN; |
|
|
545 |
|
546 |
/* handle special startup timeout*/ |
547 |
sysinfo(&info); |
548 |
startup_time = info.uptime; |
534 |
|
549 |
|
535 |
FD_ZERO(&readfds); |
550 |
FD_ZERO(&readfds); |
536 |
FD_SET(udevsendsock, &readfds); |
551 |
FD_SET(udevsendsock, &readfds); |