From: Abramo Bagnara Date: Mon, 11 Dec 2000 15:54:55 +0000 (+0000) Subject: Some cleaning to mmap X-Git-Tag: v1.0.3~1051 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=5860beac6973d4c612f9edf813fd544b2f873b30;p=alsa-lib.git Some cleaning to mmap --- diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c index a713471b..7e05a09a 100644 --- a/src/pcm/pcm_mmap.c +++ b/src/pcm/pcm_mmap.c @@ -378,11 +378,16 @@ int snd_pcm_munmap(snd_pcm_t *pcm) size = PAGE_ALIGN(size); switch (i->type) { case SND_PCM_AREA_MMAP: +#if 0 + /* Tricky here: for alsa-oss */ + errno = 12345; +#endif err = munmap(i->addr, size); if (err < 0) { SYSERR("mmap failed"); return -errno; } + errno = 0; break; case SND_PCM_AREA_SHM: err = shmdt(i->addr); diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index 3dc7cfac..9c6c1426 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -620,19 +620,11 @@ static int snd_pcm_plug_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *inf static int snd_pcm_plug_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED) { -#if 0 - snd_pcm_plugin_t *plug = pcm->private; - return snd_pcm_mmap(plug->slave); -#endif return 0; } static int snd_pcm_plug_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED) { -#if 0 - snd_pcm_plugin_t *plug = pcm->private; - return snd_pcm_munmap(plug->slave); -#endif return 0; } diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c index 253c147f..d8d36232 100644 --- a/src/pcm/pcm_plugin.c +++ b/src/pcm/pcm_plugin.c @@ -321,15 +321,13 @@ int snd_pcm_plugin_set_avail_min(snd_pcm_t *pcm, size_t frames) int snd_pcm_plugin_mmap(snd_pcm_t *pcm) { snd_pcm_plugin_t *plug = pcm->private; - if (!(pcm->info & SND_PCM_INFO_MMAP)) { - size_t size = snd_pcm_frames_to_bytes(pcm, pcm->buffer_size); - int id = shmget(IPC_PRIVATE, size, 0666); - if (id < 0) { - SYSERR("shmget failed"); - return -errno; - } - plug->shmid = id; + size_t size = snd_pcm_frames_to_bytes(pcm, pcm->buffer_size); + int id = shmget(IPC_PRIVATE, size, 0666); + if (id < 0) { + SYSERR("shmget failed"); + return -errno; } + plug->shmid = id; return 0; }