summaryrefslogtreecommitdiff
path: root/udev/lib/libudev-device.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-04-22 03:50:11 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-04-22 03:50:11 +0200
commite14bdd88e9796ec3c70966dd1899add6667431f5 (patch)
tree729c921be3a7bedad393a754fbf99b42ab301f4b /udev/lib/libudev-device.c
parentf907449eee3f58fafafee0658e80578b1dbb2722 (diff)
libudev: monitor - add client socket filter for subsystem value
Messages send back by the udev daemon to the netlink socket are multiplexed by the kernel and delivered to multiple clients. The clients can upload a socket filter to let the kernel drop messages not belonging to a certain subsystem. This prevent needless wakeups and message processing for users who are only interested in a subset of available events. Recent kernels allow untrusted users to listen to the netlink messages. The messages send by the udev daemon are versioned, to prevent any custom software reading them without libudev. The message wire format may change with any udev version update.
Diffstat (limited to 'udev/lib/libudev-device.c')
-rw-r--r--udev/lib/libudev-device.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c
index 2b6086d032..92b2d18b83 100644
--- a/udev/lib/libudev-device.c
+++ b/udev/lib/libudev-device.c
@@ -1074,7 +1074,6 @@ const char *udev_device_get_property_value(struct udev_device *udev_device, cons
#define MONITOR_BUF_SIZE 4096
static int update_envp_monitor_buf(struct udev_device *udev_device)
{
- const char *action;
struct udev_list_entry *list_entry;
size_t bufpos;
size_t len;
@@ -1093,23 +1092,8 @@ static int update_envp_monitor_buf(struct udev_device *udev_device)
if (udev_device->envp == NULL)
return -ENOMEM;
- /* header <action>@<devpath> */
- action = udev_device_get_action(udev_device);
- if (action == NULL)
- return -EINVAL;
- bufpos = util_strlcpy(udev_device->monitor_buf, action, MONITOR_BUF_SIZE);
- len = util_strlcpy(&udev_device->monitor_buf[bufpos], "@", MONITOR_BUF_SIZE-bufpos);
- if (len >= MONITOR_BUF_SIZE-bufpos)
- return -EINVAL;
- bufpos += len;
- len = util_strlcpy(&udev_device->monitor_buf[bufpos],
- udev_device_get_devpath(udev_device),
- MONITOR_BUF_SIZE-bufpos);
- if (len+1 >= MONITOR_BUF_SIZE-bufpos)
- return -EINVAL;
- bufpos += len+1;
-
i = 0;
+ bufpos = 0;
udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) {
/* add string to envp array */
udev_device->envp[i++] = &udev_device->monitor_buf[bufpos];