UDEV(3)

NAME
udev_new, udev_ref, udev_unref, udev_get_dev_path, udev_set_userdata, udev_get_userdata - general udev functions

LIBRARY
libdevattr

SYNOPSIS
#include <devattr.h>
struct udev *
udev_new(void);
struct udev *
udev_ref(struct udev *udev_ctx);
void
udev_unref(struct udev *udev_ctx);
const char *
udev_get_dev_path(struct udev *udev_ctx);
void
udev_set_userdata(struct udev *udev_ctx, void *userdata);
void *
udev_get_userdata(struct udev *udev_ctx);

DESCRIPTION
The udev_new() function returns a new udev context. This is needed as a context for all other libdevattr functions. The returned context has a refcount of 1. This function returns NULL if no udev context could be created, which usually happens when the udevd daemon is not running.

The udev_ref() and udev_unref() functions increase or decrease the reference count on a udev object respectively. When the reference count drops to 0, the object is automatically destroyed. The udev_ref() function returns the same object that was passed in.

The udev_get_dev_path() function returns the path to the system device directory.

The udev_set_userdata() function allows the consumer to associate some userdata to the specified udev_ctx. The udev_get_userdata() function returns the currently associated user data.

SEE ALSO
devattr(3), udev_device(3), udev_enumerate(3), udev_monitor(3), udevd(8)