Re: [PATCH] Free OSS device on pause
Peter Alm <[email protected]> Tue, 10 Oct 2006 15:36:36 +0200
| Newsgroups | gmane.comp.multimedia.xmms.devel |
|---|---|
| Message-ID | <1160487396.3566.3.camel@localhost> |
On Tue, 2006-10-10 at 11:47 +0200, Metathronius Galabant wrote:
> > > please consider the following trivial patch for 1.2.11 (if there will be
> > > one). It frees the dsp interface on pause (much like mplayer does).
> >
> > I cannot comment on the technical quality of the patch, but I have to
> > say it's a feature I'd be glad to have in XMMS.
>
> xmms already close() and open()s the DSP interface upon un-pausing. I
> only inserted another close() on the pausing and left the other code
> paths how they were (it is not a problem to close() an already closed
> descriptor) as I don't know the whole picture.
>
> Cheers,
> M
Actually there is a problem with that because fd numbers will be reused,
try this small program and see for yourself:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int
main (int argc, char **argv)
{
int fd;
fd = open ("/dev/null", O_RDONLY);
printf ("fd: %d\n", fd);
close (fd);
fd = open ("/dev/random", O_RDONLY);
printf ("fd: %d\n", fd);
close (fd);
return 0;
}