[alsa-devel] How to close ALSA device nodes?
rem at videolan.org
Sun Oct 18 18:06:25 CEST 2009
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:
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?
More information about the Alsa-devel