Set CLOEXEC flag for pipes in PulseAudio plugins
PATCH 1/1 Set CLOEXEC flag for pipes in PulseAudio plugins
Hi,
I have noticed that Alsa / PulseAudio are leaking a couple of pipes after a fork/exec, and have traced the leak to the following two plugins:
libasound_module_ctl_pulse.so
libasound_module_pcm_pulse.so
This is with Fedora 15. I have attached a patch for the problem.
Cheers,
Chris
pulse/pulse.c +6 -0
@@ -114,6 +114,10 @@return fcntl (fd,F_SETFL , fl |O_NONBLOCK ); } +static int make_close_on_exec (int fd) { +return fcntl (fd,F_SETFD ,FD_CLOEXEC ); +} +snd_pulse_t *pulse_new (void ) {snd_pulse_t *p;
@@ -134,7 +138,9 @@ p->thread_fd = fd[1 ];make_nonblock (p->main_fd); +make_close_on_exec (p->main_fd);make_nonblock (p->thread_fd); +make_close_on_exec (p->thread_fd); p->mainloop =pa_threaded_mainloop_new ();if (!p->mainloop)
Takashi Iwai
AppliedAt Mon, 26 Sep 2011 17:09:24 +0100,
Quoted 10 lines · Chris Rankin
Hi,
I have noticed that Alsa / PulseAudio are leaking a couple of pipes after a fork/exec, and have traced the leak to the following two plugins:
libasound_module_ctl_pulse.so
libasound_module_pcm_pulse.soThis is with Fedora 15. I have attached a patch for the problem.
Thanks, applied now.
Takashi
Quoted 32 lines
Cheers,
Chris
[2 ALSA-PULSE-CLOEXEC.diff <text/x-patch (7bit)>]pulse/pulse.c +6
-0@@ -114,6 +114,10 @@return fcntl (fd,F_SETFL , fl |O_NONBLOCK ); } +static int make_close_on_exec (int fd) { +return fcntl (fd,F_SETFD ,FD_CLOEXEC ); +} +snd_pulse_t *pulse_new (void ) {snd_pulse_t *p;@@ -134,7 +138,9 @@ p->thread_fd = fd[1 ];make_nonblock (p->main_fd); +make_close_on_exec (p->main_fd);make_nonblock (p->thread_fd); +make_close_on_exec (p->thread_fd); p->mainloop =pa_threaded_mainloop_new ();if (!p->mainloop)[3 <text/plain; us-ascii (7bit)>]
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel