X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fudev%2Fudevadm-monitor.c;h=1a5f516ddcbfe5937631d37a230de56fc2c574f5;hb=1693a943ca581aca2beebb4c812ec6c9f17b8164;hp=b2f7f6ba4c08baf30d67f248fe651b307a02e6b6;hpb=29804cc1e0f37ee34301530fd7f1eb8550be464e;p=elogind.git diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c index b2f7f6ba4..1a5f516dd 100644 --- a/src/udev/udevadm-monitor.c +++ b/src/udev/udevadm-monitor.c @@ -37,20 +37,18 @@ static bool udev_exit; -static void sig_handler(int signum) -{ +static void sig_handler(int signum) { if (signum == SIGINT || signum == SIGTERM) udev_exit = true; } -static void print_device(struct udev_device *device, const char *source, int prop) -{ +static void print_device(struct udev_device *device, const char *source, int prop) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - printf("%-6s[%llu.%06u] %-8s %s (%s)\n", + printf("%-6s[%"PRI_TIME".%06ld] %-8s %s (%s)\n", source, - (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, + ts.tv_sec, ts.tv_nsec/1000, udev_device_get_action(device), udev_device_get_devpath(device), udev_device_get_subsystem(device)); @@ -75,8 +73,7 @@ static void help(void) { " -h,--help\n\n"); } -static int adm_monitor(struct udev *udev, int argc, char *argv[]) -{ +static int adm_monitor(struct udev *udev, int argc, char *argv[]) { struct sigaction act = {}; sigset_t mask; bool prop = false; @@ -158,7 +155,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) fd_ep = epoll_create1(EPOLL_CLOEXEC); if (fd_ep < 0) { - log_error("error creating epoll fd: %m"); + log_error_errno(errno, "error creating epoll fd: %m"); return 1; } @@ -198,7 +195,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) ep_udev.events = EPOLLIN; ep_udev.data.fd = fd_udev; if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { - log_error("fail to add fd to epoll: %m"); + log_error_errno(errno, "fail to add fd to epoll: %m"); return 2; } @@ -232,7 +229,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) ep_kernel.events = EPOLLIN; ep_kernel.data.fd = fd_kernel; if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_kernel, &ep_kernel) < 0) { - log_error("fail to add fd to epoll: %m"); + log_error_errno(errno, "fail to add fd to epoll: %m"); return 5; }