* Possible solution for the alsa-oss fopen problem.
@ 2004-06-09 11:10 James Courtier-Dutton
2004-06-09 11:33 ` Jaroslav Kysela
2004-06-10 12:09 ` Florian Schmidt
0 siblings, 2 replies; 5+ messages in thread
From: James Courtier-Dutton @ 2004-06-09 11:10 UTC (permalink / raw)
To: ALSA development
I have found out that the artsdsp /dev/oss redirector supports fopen and
friends.
I looked at the artsdsp, (find it inside arts-1.2.2.tar.bz2)
It uses a function called fopencookie()
Extract from /arts-1.2.2/artsc/stdioemu.c below.
Would this be useable in the alsa-oss redirector?
Cheers
James
static FILE *fake_fopen(const char *path, const char *mode)
{
cookie_io_functions_t fns = { fdc_read, fdc_write, fdc_seek,
fdc_clean };
struct fd_cookie *fdc =
(struct fd_cookie *)malloc(sizeof(struct fd_cookie));
const char *mptr;
int open_mode = 0;
FILE *result = 0;
for(mptr = mode; *mptr; mptr++)
{
if(*mptr == 'r') open_mode |= 1; /* 1 = read */
if(*mptr == 'w') open_mode |= 2; /* 2 = write */
if(*mptr == '+') open_mode |= 3; /* 3 = readwrite */
if(*mptr == 'a') open_mode |= 2; /* append -> write */
}
if(open_mode == 1) fdc->fd = open(path,O_RDONLY,0666);
if(open_mode == 2) fdc->fd = open(path,O_WRONLY,0666);
if(open_mode == 3) fdc->fd = open(path,O_RDWR,0666);
if(open_mode && fdc->fd > 0)
{
result = fopencookie (fdc,"w", fns);
result->_fileno = fdc->fd; /* ugly patchy
slimy kludgy hack */
}
return result;
}
-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Possible solution for the alsa-oss fopen problem.
2004-06-09 11:10 Possible solution for the alsa-oss fopen problem James Courtier-Dutton
@ 2004-06-09 11:33 ` Jaroslav Kysela
2004-06-09 11:56 ` James Courtier-Dutton
2004-06-10 12:09 ` Florian Schmidt
1 sibling, 1 reply; 5+ messages in thread
From: Jaroslav Kysela @ 2004-06-09 11:33 UTC (permalink / raw)
To: James Courtier-Dutton; +Cc: ALSA development
On Wed, 9 Jun 2004, James Courtier-Dutton wrote:
> I have found out that the artsdsp /dev/oss redirector supports fopen and
> friends. I looked at the artsdsp, (find it inside arts-1.2.2.tar.bz2) It
> uses a function called fopencookie()
Does it work for sox and teamspeak?
Jaroslav
-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs
-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Possible solution for the alsa-oss fopen problem.
2004-06-09 11:33 ` Jaroslav Kysela
@ 2004-06-09 11:56 ` James Courtier-Dutton
0 siblings, 0 replies; 5+ messages in thread
From: James Courtier-Dutton @ 2004-06-09 11:56 UTC (permalink / raw)
To: Jaroslav Kysela; +Cc: ALSA development
Jaroslav Kysela wrote:
> On Wed, 9 Jun 2004, James Courtier-Dutton wrote:
>
>
>>I have found out that the artsdsp /dev/oss redirector supports fopen and
>>friends. I looked at the artsdsp, (find it inside arts-1.2.2.tar.bz2) It
>>uses a function called fopencookie()
>
>
> Does it work for sox and teamspeak?
>
> Jaroslav
>
I don't use KDE, so I can't really test it.
I just heard someone say on irc "It works on artsdsp, but not aoss"
I can't remember which app "It" was.
Has anyone created a test app that uses fopen and friends so that
testing these features would be easier?
Cheers
James
-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Possible solution for the alsa-oss fopen problem.
2004-06-09 11:10 Possible solution for the alsa-oss fopen problem James Courtier-Dutton
2004-06-09 11:33 ` Jaroslav Kysela
@ 2004-06-10 12:09 ` Florian Schmidt
2004-06-10 12:49 ` James Courtier-Dutton
1 sibling, 1 reply; 5+ messages in thread
From: Florian Schmidt @ 2004-06-10 12:09 UTC (permalink / raw)
To: alsa-devel
On Wed, 09 Jun 2004 12:10:45 +0100
James Courtier-Dutton <James@superbug.demon.co.uk> wrote:
> I have found out that the artsdsp /dev/oss redirector supports fopen and
> friends.
> I looked at the artsdsp, (find it inside arts-1.2.2.tar.bz2)
> It uses a function called fopencookie()
>
> Extract from /arts-1.2.2/artsc/stdioemu.c below.
>
> Would this be useable in the alsa-oss redirector?
This fopencookie seems to be a libc thing to implement custom streams.. See
http://wwwwbs.cs.tu-berlin.de/user-taipan/kraxel/gnuinfo/libc/Streams_and_Cookies.html
Might be exctly the thing which is needed to intercept fopen() and friends AND handle the intercepted calls gracefully..
I have a question though: If this works for alsa-oss, then the libc problem with the internal symbols of open() and friends is solved. But i wonder if there are any other libs which are as "evil" in this regard as libc is. The basic problem persists: If a lib uses internal symbols for open() and friends and an app uses that lib to access /dev/dsp, etc., then we're screwed again..
On the other hand: How many libs besides libc do stuff like this? And how many apps use such a lib? I would guess: very very few.. If this is the case, i suppose it will work well (tm)
Florian Schmidt
--
Palimm Palimm!
-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Possible solution for the alsa-oss fopen problem.
2004-06-10 12:09 ` Florian Schmidt
@ 2004-06-10 12:49 ` James Courtier-Dutton
0 siblings, 0 replies; 5+ messages in thread
From: James Courtier-Dutton @ 2004-06-10 12:49 UTC (permalink / raw)
To: Florian Schmidt; +Cc: alsa-devel
Florian Schmidt wrote:
> On Wed, 09 Jun 2004 12:10:45 +0100
> James Courtier-Dutton <James@superbug.demon.co.uk> wrote:
>
>
>>I have found out that the artsdsp /dev/oss redirector supports fopen and
>>friends.
>>I looked at the artsdsp, (find it inside arts-1.2.2.tar.bz2)
>>It uses a function called fopencookie()
>>
>>Extract from /arts-1.2.2/artsc/stdioemu.c below.
>>
>>Would this be useable in the alsa-oss redirector?
>
>
> This fopencookie seems to be a libc thing to implement custom streams.. See
>
> http://wwwwbs.cs.tu-berlin.de/user-taipan/kraxel/gnuinfo/libc/Streams_and_Cookies.html
>
> Might be exctly the thing which is needed to intercept fopen() and friends AND handle the intercepted calls gracefully..
>
> I have a question though: If this works for alsa-oss, then the libc problem with the internal symbols of open() and friends is solved. But i wonder if there are any other libs which are as "evil" in this regard as libc is. The basic problem persists: If a lib uses internal symbols for open() and friends and an app uses that lib to access /dev/dsp, etc., then we're screwed again..
>
> On the other hand: How many libs besides libc do stuff like this? And how many apps use such a lib? I would guess: very very few.. If this is the case, i suppose it will work well (tm)
>
> Florian Schmidt
>
Does anyone have a small test app that uses fopen and friends, so that I
could test them if I add fopencookie() to aoss.
Hopefully, the test app should use the fopen and friends calls in the
same way that know "problem" apps use.
If there is not a test app out there, can someone please tell me more
details about the problem, so that I could build a test app myself.
I need to know which fcalls lead to a failure, so that if I get those
fcalls working, these "problem" apps will be guaranteed to work.
Cheers
James
-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-06-10 12:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-09 11:10 Possible solution for the alsa-oss fopen problem James Courtier-Dutton
2004-06-09 11:33 ` Jaroslav Kysela
2004-06-09 11:56 ` James Courtier-Dutton
2004-06-10 12:09 ` Florian Schmidt
2004-06-10 12:49 ` James Courtier-Dutton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.