On Mon, 3 Feb 2003, Sebastian Kapfer wrote:

> The alsa-lib doesn't set the close-on-exec flag on its PCM device FD's.
> The consequence is that processes spawned by alsa-lib clients inherit an
> open file handle to the PCM device and thereby block it.
> 
> For example, mplayer can disable and re-launch the xscreensaver daemon.
> In the alsa-enabled version of mplayer, the xscreensaver process
> inherits a pcm handle, although xss can't make use of it. This
> effectively forces me to restart xss manually after each mplayer
> session.
> 
> Suggested fix:
> 
> --- src/pcm/pcm_hw.c.orig     2002-10-12 13:49:54.000000000 +0200
> +++ src/pcm/pcm_hw.c  2003-02-03 23:07:14.000000000 +0100
> @@ -867,6 +867,11 @@
>               ret = -errno;
>               goto _err;
>       }
> +     if( fcntl( fd, F_SETFD, FD_CLOEXEC ) != 0 ) {
> +             SYSERR("fcntl FD_CLOEXEC failed");
> +             ret = -errno;
> +             goto _err;
> +     }
>       if (ioctl(fd, SNDRV_PCM_IOCTL_PVERSION, &ver) < 0) {
>               SYSERR("SNDRV_PCM_IOCTL_PVERSION failed");
>               ret = -errno;

Well, I and Abramo think that it's better to force application developers 
to clean allocated things before they'll call exec(). I believe that not 
only ALSA file descriptors are open after exec() in mplayer.

                                                Jaroslav

-----
Jaroslav Kysela <[EMAIL PROTECTED]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to