+
+int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_device *udev_device)
+{
+ const char *action;
+ struct udev_list_entry *list_entry;
+ char buf[4096];
+ size_t bufpos;
+ ssize_t count;
+
+ action = udev_device_get_action(udev_device);
+ if (action == NULL)
+ return -EINVAL;
+ bufpos = snprintf(buf, sizeof(buf), "%s@%s", action, udev_device_get_devpath(udev_device));
+ bufpos++;
+ udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) {
+ bufpos += snprintf(&buf[bufpos], sizeof(buf) - bufpos, "%s=%s",
+ udev_list_entry_get_name(list_entry),
+ udev_list_entry_get_value(list_entry));
+ bufpos++;
+ }
+ count = sendto(udev_monitor->sock,
+ &buf, bufpos, 0,
+ (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen);
+ info(udev_monitor->udev, "passed %zi bytes to monitor %p, \n", count, udev_monitor);
+ return count;
+}