[MPlayer-users] alsa 0.9.1- xscreensaver
Jindrich Makovicka
makovick at kmlinux.fjfi.cvut.cz
Mon Mar 24 13:54:46 CET 2003
D Richard Felker III wrote:
>[Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
>On Fri, Mar 21, 2003 at 09:46:15AM +0100, Jindrich Makovicka wrote:
>
>
>>>It's a known limitation of the broken design of alsa userspace libs,
>>>as well as a bug in xscreensaver which the author refuses to fix. Use
>>>oss emulation (should work just as well) or else killall -9
>>>xscreensaver (preferred).
>>>
>>>
>>>
>>>
>>Here is a spinoff of a recent patch by Tobias Geiger
>><tobias.geiger at web.de> posted to devel, with the changes you proposed. I
>>changed my opinion on this after having the same problem with /dev/rtc
>>and who knows what else can be affected.
>>
>>Regards,
>>
>>--
>>Jindrich Makovicka
>>
>>
>>
>
>
>
>>Index: x11_common.c
>>===================================================================
>>RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
>>retrieving revision 1.140
>>diff -u -b -B -r1.140 x11_common.c
>>--- x11_common.c 10 Feb 2003 14:08:37 -0000 1.140
>>+++ x11_common.c 21 Mar 2003 08:56:57 -0000
>>@@ -12,6 +12,7 @@
>>
>> #include <string.h>
>> #include <unistd.h>
>>+#include <fcntl.h>
>> #include <sys/mman.h>
>>
>> #include "video_out.h"
>>@@ -890,7 +891,28 @@
>> }
>>
>> if (xscreensaver_was_running && stop_xscreensaver) {
>>+ pid_t pid;
>>+
>>+ if ((pid = fork()) < 0)
>>+ exit(1);
>>+ if (pid == 0) {
>>+ unsigned int i;
>>+ for (i = 3; i < 1024; i++)
>>+ close(i);
>>+ i = open("/dev/null", O_RDONLY);
>>+ dup2(i, 0);
>>+ close(i);
>>+ i = open("/dev/null", O_WRONLY);
>>+ dup2(i, 1);
>>+ close(i);
>>+ i = open("/dev/null", O_WRONLY);
>>+ dup2(i, 2);
>>+ close(i);
>>
>>
>
>This code is total nonsense. You have to close 0-2 AFTER opening
>/dev/null but before the dup2; otherwise these fd's might already get
>reused!! Here is the correct implementation:
>
>i = open("/dev/null", O_RDWR);
>close(0); close(1); close(2);
>dup2(i,0); dup2(i,1); dup2(i,2); close(i);
>
>
afaik dup2 does close() of the destination descriptor automatically, so
it's equivalent.
>But in any case, it will NOT fix the problem, since the fd's being
>wrongly inherited by xscreensaver are not stdin/out/err but other
>stuff!!
>
>One 'correct' (but still nonsense) fix is:
>
>for (i=3; i<1024; i++) close(i);
>
it's the line just above the std* stuff...
>A much better solution (WHY WON'T SOMEONE IMPLEMENT THIS???) is to
>killall -STOP xscreensaver when starting and killall -CONT
>xscreensaver on exit.
>
>
--
Jindrich Makovicka
More information about the MPlayer-users
mailing list