[MPlayer-dev-eng] xscreensaver inherits mplayer's ALSA FD's

D Richard Felker III dalias at aerifal.cx
Mon Feb 10 18:26:04 CET 2003


On Mon, Feb 10, 2003 at 05:27:23PM +0100, Sebastian Kapfer wrote:
> 
> I have configured my mplayer to start/stop the xscreensaver daemon. This
> is the result:
> 
> $ lsof | grep xscreen | grep pcm
> $ mplayer archiv/movies/*
> [SNIPPED]
> $ lsof | grep xscreen | grep pcm
> xscreensa 2000   sk    9u   CHR     116,16              1017
> /dev/snd/pcmC0D0p
> 
> After exiting mplayer, xss blocks my sound card, which is of course a
> bit unfortunate, as xss continues to run in the background.
> 
> This can be fixed by patching alsa-lib to set the FD_CLOEXEC flag on its
> FD's. Unfortunately, the ALSA guys don't accept this patch, saying that
> it would be inconsistent to have ALSA FD's be FD_CLOEXEC. See
> http://www.mail-archive.com/alsa-devel@lists.sourceforge.net/msg06249.html
> for the whole thread...
> 
> This complicates the issue a bit. Re-starting xss can't be done via
> system("xscreensaver&") any more, since system doesn't close ALSA FD's
> either :)
> 
> The issue needs a global solution, as mplayer shouldn't be leaking
> /any/ FD's to child processes. Maybe starting an "uncontaminated" shell
> process before mplayer opens any files, and using that process to launch
> xss?

The whole xss start/stop business is a stupid hack put in because the
author of xss is a moron and refuses to fix xss. The correct fix would
be to have xss take a list of window names (in the user's config file)
that, when present, inhibit xss from activating. Instead, he insists
that all programs that don't want to be interrupted by the screensaver
periodically "ping" the screensaver, which is nonsense.

The other much more correct fix would be to make mplayer send SIGSTOP
to xscreensaver when starting and SIGCONT when it exits. If you want
this, write a patch; I don't use xss junk so I'm not interested in
doing it.

On the other hand, you could just use oss emulation. IMHO using libs
(libalsa or whatever) to access the sound device is nonsense. There's
a perfectly good /dev/dsp interface in alsa, so use it.

Rich



More information about the MPlayer-dev-eng mailing list