{
if (debug) {
char buf[1024];
- struct timeval tv;
- struct timezone tz;
+ struct timespec ts;
vsnprintf(buf, sizeof(buf), format, args);
- gettimeofday(&tv, &tz);
+ clock_gettime(CLOCK_MONOTONIC, &ts);
fprintf(stderr, "%llu.%06u [%u] %s: %s",
- (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec,
+ (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000,
(int) getpid(), fn, buf);
} else {
vsyslog(priority, format, args);
switch (fdsi.ssi_signo) {
case SIGTERM:
goto out;
- case SIGALRM:
- rc = EXIT_FAILURE;
- goto out;
}
}
}
udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024);
+ /* create queue file before signalling 'ready', to make sure we block 'settle' */
+ udev_queue_export = udev_queue_export_new(udev);
+ if (udev_queue_export == NULL) {
+ err(udev, "error creating queue file\n");
+ goto exit;
+ }
+
if (daemonize) {
pid_t pid;
int fd;
rc = 4;
goto exit;
default:
- rc = 0;
- goto exit;
+ rc = EXIT_SUCCESS;
+ goto exit_keep_queue;
}
setsid();
goto exit;
}
- udev_queue_export = udev_queue_export_new(udev);
- if (udev_queue_export == NULL) {
- err(udev, "error creating queue file\n");
- goto exit;
- }
-
memset(&ep_ctrl, 0, sizeof(struct epoll_event));
ep_ctrl.events = EPOLLIN;
ep_ctrl.data.fd = fd_ctrl;
}
}
- udev_queue_export_cleanup(udev_queue_export);
- rc = 0;
+ rc = EXIT_SUCCESS;
exit:
+ udev_queue_export_cleanup(udev_queue_export);
+exit_keep_queue:
if (fd_ep >= 0)
close(fd_ep);
worker_list_cleanup(udev);