mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Some cleaning to mmap
This commit is contained in:
parent
a07e3c967b
commit
5860beac69
3 changed files with 11 additions and 16 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue