Cleanups in IPC stuff.

Cleanups in snd_pcm_close().
Added initial code for dmix plugin:
  - only skeleton, but all major problems should be solved
This commit is contained in:
Jaroslav Kysela 2003-02-04 14:48:51 +00:00
parent 74859a4646
commit 8720faaccb
10 changed files with 1132 additions and 59 deletions

View file

@ -282,6 +282,7 @@ int snd_pcm_channel_info_shm(snd_pcm_t *pcm, snd_pcm_channel_info_t *info,
info->addr = 0;
info->type = SND_PCM_AREA_SHM;
info->u.shm.shmid = shmid;
info->u.shm.remove = 0;
return 0;
}
@ -361,6 +362,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
return -errno;
}
i->u.shm.shmid = id;
i->u.shm.remove = 1;
}
ptr = shmat(i->u.shm.shmid, 0, 0);
if (ptr == (void*) -1) {
@ -438,6 +440,14 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
SYSERR("shmdt failed");
return -errno;
}
if (i->u.shm.remove) {
if (shmctl(i->u.shm.shmid, IPC_RMID, 0) < 0) {
SYSERR("shmctl IPC_RMID failed");
return -errno;
}
i->u.shm.shmid = -1;
i->u.shm.remove = 0;
}
break;
default:
assert(0);