[vlc-devel] How to close ALSA device nodes?

Rémi Denis-Courmont remi at remlab.net
Sun Oct 18 18:02:07 CEST 2009


	Hello,

I'm getting a bug report against VLC media player whereby ALSA sound output 
stops working when the screensaver is inhibited. It turns out that VLC is 
leaking any file descriptor open through ALSA-lib into child processes. The 
exact same issue was already raised by mplayer... 6 years ago:
http://www.mail-archive.com/alsa-devel@lists.sourceforge.net/msg06249.html

In other cases (V4L, OSS, DVB, DVD, sockets, even regular files...), VLC would 
open the device nodes with O_CLOEXEC flag (if supported by kernel and libc) 
and fallback to setting FD_CLOEXEC via fcntl(). Then the descriptor is 
automatically, and in the earlier case, thread-safely, closed whenever VLC -
forks and- execs. With ALSA-lib, I cannot figure any way to achieve that...

From the earlier thread, I reckon that ALSA developers consider that this is 
an upper-layer issue. Maybe so, but then how is the upper-layer supposed to 
find which file descriptors ALSA-lib has opened - if any? Conversely, if ALSA-
lib won't tell while file descriptors it is using, what could possibly be the 
use case for not closing those on exec?

Best regards,

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list