chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
udevadm: move udevadm command descriptions into their files
[elogind.git]
/
udev
/
udevadm-monitor.c
diff --git
a/udev/udevadm-monitor.c
b/udev/udevadm-monitor.c
index f3a72cf17e3d283a4d2a5ced43d06934567a4995..7ea7aa0f7067f76ba470036bb0f84b8714494584 100644
(file)
--- a/
udev/udevadm-monitor.c
+++ b/
udev/udevadm-monitor.c
@@
-24,6
+24,7
@@
#include <errno.h>
#include <signal.h>
#include <getopt.h>
#include <errno.h>
#include <signal.h>
#include <getopt.h>
+#include <time.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/un.h>
@@
-43,13
+44,12
@@
static void sig_handler(int signum)
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 timeval tv;
- struct timezone tz;
+ struct timespec ts;
-
gettimeofday(&tv, &tz
);
+
clock_gettime(CLOCK_MONOTONIC, &ts
);
printf("%-6s[%llu.%06u] %-8s %s (%s)\n",
source,
printf("%-6s[%llu.%06u] %-8s %s (%s)\n",
source,
- (unsigned long long) t
v.tv_sec, (unsigned int) tv.tv_usec
,
+ (unsigned long long) t
s.tv_sec, (unsigned int) ts.tv_nsec/1000
,
udev_device_get_action(device),
udev_device_get_devpath(device),
udev_device_get_subsystem(device));
udev_device_get_action(device),
udev_device_get_devpath(device),
udev_device_get_subsystem(device));
@@
-64,7
+64,7
@@
static void print_device(struct udev_device *device, const char *source, int pro
}
}
}
}
-
int udev
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;
{
struct sigaction act;
sigset_t mask;
@@
-137,6
+137,9
@@
int udevadm_monitor(struct udev *udev, int argc, char *argv[])
" --tag-match=<tag> filter events by tag\n"
" --help\n\n");
goto out;
" --tag-match=<tag> filter events by tag\n"
" --help\n\n");
goto out;
+ default:
+ rc = 1;
+ goto out;
}
}
}
}
@@
-286,3
+289,9
@@
out:
udev_list_cleanup_entries(udev, &tag_match_list);
return rc;
}
udev_list_cleanup_entries(udev, &tag_match_list);
return rc;
}
+
+const struct udevadm_cmd udevadm_monitor = {
+ .name = "monitor",
+ .cmd = adm_monitor,
+ .help = "listen to kernel and udev events",
+};