DragonFly On-Line Manual Pages

Search: Section:  


UDEV_MONITOR(3)       DragonFly Library Functions Manual       UDEV_MONITOR(3)

NAME

udev_monitor_new, udev_monitor_ref, udev_monitor_unref, udev_monitor_get_udev, udev_monitor_get_fd, udev_monitor_receive_device, udev_monitor_enable_receiving, udev_monitor_filter_add_match_subsystem_devtype, udev_monitor_filter_add_match_expr, udev_monitor_filter_add_match_property, udev_monitor_filter_add_nomatch_expr, udev_monitor_filter_add_nomatch_property, udev_monitor_filter_add_match_regex, udev_monitor_filter_add_nomatch_regex -- device event monitor functions

LIBRARY

Device attribute and event library (libdevattr, -ldevattr)

SYNOPSIS

#include <devattr.h> struct udev_monitor * udev_monitor_new(struct udev *udev_ctx); struct udev_monitor * udev_monitor_ref(struct udev_monitor *udev_monitor); void udev_monitor_unref(struct udev_monitor *udev_monitor); struct udev * udev_monitor_get_udev(struct udev_monitor *udev_monitor); int udev_monitor_get_fd(struct udev_monitor *udev_monitor); struct udev_device * udev_monitor_receive_device(struct udev_monitor *udev_monitor); int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype); int udev_monitor_filter_add_match_expr(struct udev_monitor *udev_monitor, const char *key, char *expr); int udev_monitor_filter_add_match_property(struct udev_monitor *udev_monitor, const char *key, const char *expr); int udev_monitor_filter_add_nomatch_expr(struct udev_monitor *udev_monitor, const char *key, char *expr); int udev_monitor_filter_add_nomatch_property(struct udev_monitor *udev_monitor, const char *key, const char *expr); int udev_monitor_filter_add_match_regex(struct udev_monitor *udev_monitor, const char *key, char *expr); int udev_monitor_filter_add_nomatch_regex(struct udev_monitor *udev_monitor, const char *key, char *expr);

DESCRIPTION

The udev_monitor_new() function creates a new udev_monitor object in the specified udev context udev_ctx. It returns NULL if no such object could be created. The udev_monitor_ref() and udev_monitor_unref() functions increase or decrease the reference count on a udev_monitor object respectively. When the reference count drops to 0, the object is automatically destroyed and any remaining event socket closed. The udev_monitor_ref() function returns the same object that was passed in. The udev_monitor_get_udev() function returns the udev context in which the udev_monitor object was created. The udev_monitor_enable_receiving() function enables receiving event notifications matching the filters added by previous calls to udev_monitor_filter_*(). The function returns -1 if an error occurs. The udev_monitor_receive_device() function reads a udev_device, once the monitor has been enabled for receiving. This call will block until a device is available. It returns NULL if a read error occurs. The udev_monitor_get_fd() returns the raw file descriptor on which events are notified after a call to udev_monitor_enable_receiving(). This file descriptor can then be used in conjunction with poll(2) or kqueue(2). The udev_monitor_receive_device() call must be used to read from the descriptor. The function returns -1 if the socket is not connected. The udev_monitor_filter_add_match_subsystem_devtype() function adds a filter that matches the given subsystem and/or devtype. If subsystem or devtype is NULL, that argument is ignored. The function returns 0 in case of success and a negative value if an error occurred. NOTE: Currently devtype matching is not implemented. The udev_monitor_filter_add_match_expr(), udev_monitor_filter_add_match_property(), udev_monitor_filter_add_nomatch_expr() and udev_monitor_filter_add_nomatch_property() functions add a filter to match or not to match, respectively, devices with the specified key and value expr. The expr can contain wildcards. On error, these functions return a negative value and 0 if no error occurred. The udev_monitor_filter_add_match_regex(), and udev_monitor_filter_add_nomatch_regex() functions add a filter to match or not to match, respectively, devices with the specified key and value expr. The expr can contain regular expressions according to regex(3). On error, these functions return a negative value and 0 if no error occurred.

SEE ALSO

devattr(3), udev(3), udev_device(3), udev_enumerate(3), udevd(8) DragonFly 5.5 November 16, 2010 DragonFly 5.5

Search: Section: