Don't know why the earlier message got truncated so here it is again...
Reading the source alsa-lib I see that dmix runs in a forked process *without* exec.
file: src/pcm/pcm_direct.c function: snd_pcm_direct_server_create
ret = fork(); if (ret < 0) { close(dmix->server_fd); return ret; } else if (ret == 0) { ret = fork(); if (ret == 0) server_job(dmix); _exit(EXIT_SUCCESS); } else { waitpid(ret, NULL, 0); }
_From what I understand, this is a concern since if our app is the first to start dmix then a copy of the process (app) will remain till the system is shutdown ?
Also I see that from alsa-lib 1.0.12 a check is performed before starting dmix.
file: src/pcm/pcm_dmix.c function: snd_pcm_dmix_open
if (dmix->shmptr->use_server) { dmix->server_free = dmix_server_free;
ret = snd_pcm_direct_server_create(dmix); if (ret < 0) { SNDERR("unable to create server"); goto _err; } }
When I checked how dmix->shmptr->use_server is set
file: src/pcm/pcm_dmix.c function: snd_pcm_direct_initialize_slave
int ver = 0; ioctl(spcm->poll_fd, SNDRV_PCM_IOCTL_PVERSION, &ver); if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 8)) dmix->shmptr->use_server = 1;
So if sndrv version is older than 2.0.8, use_server is set!
So even using alsa-lib greater than 1.0.12 doesn't guarantee that the forked process (without exec) code path will be avoided.
I'm currently porting the sound code of our app from OSS to ALSA but this problem is preventing me from doing so. Is there any way to get around this problem?
Help here will be greatly appreciated.
If this is an incorrect list then kindly fwd it to the appropriate one.
Thanks, Bankim.
PS: I've tried using the ioctl mentioned above after copying the necessary macros from kernel headers but ioctl returns error "Inappropriate ioctl for this device" on my Ubuntu 7.04 host.