[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-test5-33-g560da5b

Lennart Poettering gitmailer-noreply at 0pointer.de
Sat Aug 22 12:58:56 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  1a05d67f07fb4bfa6e419791cf5609d608f536cd (commit)

- Log -----------------------------------------------------------------
560da5b udev: process all inotify events queued up, not just the first one in the queue
-----------------------------------------------------------------------

Summary of changes:
 src/modules/module-udev-detect.c |   56 ++++++++++++++++++++++++++-----------
 1 files changed, 39 insertions(+), 17 deletions(-)

-----------------------------------------------------------------------

commit 560da5b0a1386c2a158d69b6ba0ef99c0f03bbf4
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sat Aug 22 21:59:17 2009 +0200

    udev: process all inotify events queued up, not just the first one in the queue

diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c
index 1d67c0c..5513634 100644
--- a/src/modules/module-udev-detect.c
+++ b/src/modules/module-udev-detect.c
@@ -325,6 +325,7 @@ static void inotify_cb(
 
     for (;;) {
         ssize_t r;
+        struct inotify_event *event;
 
         pa_zero(buf);
         if ((r = pa_read(fd, &buf, sizeof(buf), &type)) <= 0) {
@@ -336,23 +337,44 @@ static void inotify_cb(
             goto fail;
         }
 
-        /* From udev we get the guarantee that the control
-         * device's ACL is changes last. To avoid races when ACLs
-         * are changed we hence watch only the control device */
-        if (((buf.e.mask & IN_ATTRIB) && pa_startswith(buf.e.name, "controlC")))
-            PA_HASHMAP_FOREACH(d, u->devices, state)
-                if (control_node_belongs_to_device(d, buf.e.name))
-                    d->need_verify = TRUE;
-
-        /* ALSA doesn't really give us any guarantee on the closing
-         * order, so let's simply hope */
-        if (((buf.e.mask & IN_CLOSE_WRITE) && pa_startswith(buf.e.name, "pcmC")))
-            PA_HASHMAP_FOREACH(d, u->devices, state)
-                if (pcm_node_belongs_to_device(d, buf.e.name))
-                    d->need_verify = TRUE;
-
-        if ((buf.e.mask & (IN_DELETE_SELF|IN_MOVE_SELF)))
-            deleted = TRUE;
+        event = &buf.e;
+        while (r > 0) {
+            size_t len;
+
+            if ((size_t) r < sizeof(struct inotify_event)) {
+                pa_log("read() too short.");
+                goto fail;
+            }
+
+            len = sizeof(struct inotify_event) + event->len;
+
+            if ((size_t) r < len) {
+                pa_log("Payload missing.");
+                goto fail;
+            }
+
+            /* From udev we get the guarantee that the control
+             * device's ACL is changed last. To avoid races when ACLs
+             * are changed we hence watch only the control device */
+            if (((event->mask & IN_ATTRIB) && pa_startswith(event->name, "controlC")))
+                PA_HASHMAP_FOREACH(d, u->devices, state)
+                    if (control_node_belongs_to_device(d, event->name))
+                        d->need_verify = TRUE;
+
+            /* ALSA doesn't really give us any guarantee on the closing
+             * order, so let's simply hope */
+            if (((event->mask & IN_CLOSE_WRITE) && pa_startswith(event->name, "pcmC")))
+                PA_HASHMAP_FOREACH(d, u->devices, state)
+                    if (pcm_node_belongs_to_device(d, event->name))
+                        d->need_verify = TRUE;
+
+            /* /dev/snd/ might have been removed */
+            if ((event->mask & (IN_DELETE_SELF|IN_MOVE_SELF)))
+                deleted = TRUE;
+
+            event = (struct inotify_event*) ((uint8_t*) event + len);
+            r -= len;
+        }
     }
 
     PA_HASHMAP_FOREACH(d, u->devices, state)

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list