~ubuntu-branches/ubuntu/raring/pulseaudio/raring

« back to all changes in this revision

Viewing changes to src/pulsecore/inotify-wrapper.c

  • Committer: Package Import Robot
  • Author(s): David Henningsson
  • Date: 2013-04-18 13:24:16 UTC
  • Revision ID: package-import@ubuntu.com-20130418132416-cdnps88gp6erhtqr
Tags: 1:3.0-0ubuntu6
0022-inotify-wrapper-Quit-daemon-if-pid-file-is-removed.patch:
Fix patch not to cause 100% CPU (LP: #1170313)

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
        pa_io_event_flags_t events,
29
29
        void *userdata) {
30
30
 
 
31
    struct {
 
32
        struct inotify_event event;
 
33
        char name[NAME_MAX+1];
 
34
    } buf;
 
35
 
31
36
    pa_inotify *i = userdata;
32
37
    int pid_fd;
33
38
 
34
39
    pa_assert(i);
35
40
 
 
41
    if (pa_read(fd, &buf, sizeof(buf), NULL) < (int) sizeof(buf.event))
 
42
        pa_log_warn("inotify did not read a full event.");
 
43
    else
 
44
        pa_log_debug("inotify callback, event mask: 0x%x", (int) buf.event.mask);
 
45
 
36
46
    pid_fd = pa_open_cloexec(i->filename, O_RDONLY
37
47
#ifdef O_NOFOLLOW
38
48
                       |O_NOFOLLOW
66
76
        return NULL;
67
77
    }
68
78
 
69
 
    if (inotify_add_watch(i->fd, filename, IN_ATTRIB|IN_CLOSE_WRITE|IN_DELETE_SELF|IN_MOVE_SELF) < 0) {
 
79
    if (inotify_add_watch(i->fd, filename, IN_DELETE_SELF|IN_MOVE_SELF) < 0) {
70
80
        pa_log("inotify_add_watch() failed: %s", pa_cstrerror(errno));
71
81
        pa_inotify_stop(i);
72
82
        return NULL;