libudev: introduce udev_monitor_receive_sd_device()
This commit is contained in:
parent
7c7be5515f
commit
3782454c41
|
@ -18,6 +18,7 @@
|
|||
#include "fileio.h"
|
||||
#include "format-util.h"
|
||||
#include "libudev-private.h"
|
||||
#include "libudev-device-internal.h"
|
||||
#include "missing.h"
|
||||
#include "mount-util.h"
|
||||
#include "socket-util.h"
|
||||
|
@ -702,6 +703,19 @@ retry:
|
|||
return udev_device;
|
||||
}
|
||||
|
||||
int udev_monitor_receive_sd_device(struct udev_monitor *udev_monitor, sd_device **ret) {
|
||||
_cleanup_(udev_device_unrefp) struct udev_device *udev_device = NULL;
|
||||
|
||||
assert(ret);
|
||||
|
||||
udev_device = udev_monitor_receive_device(udev_monitor);
|
||||
if (!udev_device)
|
||||
return -errno;
|
||||
|
||||
*ret = sd_device_ref(udev_device->device);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int udev_monitor_send_device(struct udev_monitor *udev_monitor,
|
||||
struct udev_monitor *destination, struct udev_device *udev_device)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "libudev.h"
|
||||
#include "sd-device.h"
|
||||
|
||||
#include "macro.h"
|
||||
#include "mkdir.h"
|
||||
|
@ -62,6 +63,7 @@ int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct
|
|||
int udev_monitor_send_device(struct udev_monitor *udev_monitor,
|
||||
struct udev_monitor *destination, struct udev_device *udev_device);
|
||||
struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd);
|
||||
int udev_monitor_receive_sd_device(struct udev_monitor *udev_monitor, sd_device **ret);
|
||||
|
||||
/* libudev-list.c */
|
||||
struct udev_list_node {
|
||||
|
|
Loading…
Reference in New Issue