Top | ![]() |
![]() |
![]() |
![]() |
struct udev_monitor * | udev_monitor_ref () |
struct udev_monitor * | udev_monitor_unref () |
struct udev * | udev_monitor_get_udev () |
struct udev_monitor * | udev_monitor_new_from_netlink () |
int | udev_monitor_enable_receiving () |
int | udev_monitor_set_receive_buffer_size () |
int | udev_monitor_get_fd () |
struct udev_device * | udev_monitor_receive_device () |
int | udev_monitor_filter_add_match_subsystem_devtype () |
int | udev_monitor_filter_add_match_tag () |
int | udev_monitor_filter_update () |
int | udev_monitor_filter_remove () |
struct udev_monitor *
udev_monitor_ref (struct udev_monitor *udev_monitor
);
Take a reference of a udev monitor.
struct udev_monitor *
udev_monitor_unref (struct udev_monitor *udev_monitor
);
Drop a reference of a udev monitor. If the refcount reaches zero, the bound socket will be closed, and the resources of the monitor will be released.
struct udev *
udev_monitor_get_udev (struct udev_monitor *udev_monitor
);
Retrieve the udev library context the monitor was created with.
struct udev_monitor * udev_monitor_new_from_netlink (struct udev *udev
,const char *name
);
Create new udev monitor and connect to a specified event source. Valid sources identifiers are "udev" and "kernel".
Applications should usually not connect directly to the "kernel" events, because the devices might not be useable at that time, before udev has configured them, and created device nodes. Accessing devices at the same time as udev, might result in unpredictable behavior. The "udev" events are sent out after udev has finished its event processing, all rules have been processed, and needed device nodes are created.
The initial refcount is 1, and needs to be decremented to release the resources of the udev monitor.
int
udev_monitor_enable_receiving (struct udev_monitor *udev_monitor
);
Binds the udev_monitor
socket to the event source.
int udev_monitor_set_receive_buffer_size (struct udev_monitor *udev_monitor
,int size
);
Set the size of the kernel socket buffer. This call needs the appropriate privileges to succeed.
int
udev_monitor_get_fd (struct udev_monitor *udev_monitor
);
Retrieve the socket file descriptor associated with the monitor.
struct udev_device *
udev_monitor_receive_device (struct udev_monitor *udev_monitor
);
Receive data from the udev monitor socket, allocate a new udev device, fill in the received data, and return the device.
Only socket connections with uid=0 are accepted.
The monitor socket is by default set to NONBLOCK. A variant of poll()
on
the file descriptor returned by udev_monitor_get_fd()
should to be used to
wake up when new devices arrive, or alternatively the file descriptor
switched into blocking mode.
The initial refcount is 1, and needs to be decremented to release the resources of the udev device.
int udev_monitor_filter_add_match_subsystem_devtype (struct udev_monitor *udev_monitor
,const char *subsystem
,const char *devtype
);
This filter is efficiently executed inside the kernel, and libudev subscribers will usually not be woken up for devices which do not match.
The filter must be installed before the monitor is switched to listening mode.
int udev_monitor_filter_add_match_tag (struct udev_monitor *udev_monitor
,const char *tag
);
This filter is efficiently executed inside the kernel, and libudev subscribers will usually not be woken up for devices which do not match.
The filter must be installed before the monitor is switched to listening mode.
int
udev_monitor_filter_update (struct udev_monitor *udev_monitor
);
Update the installed socket filter. This is only needed, if the filter was removed or changed.