mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-12-16 08:56:42 -05: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);
|
size = PAGE_ALIGN(size);
|
||||||
switch (i->type) {
|
switch (i->type) {
|
||||||
case SND_PCM_AREA_MMAP:
|
case SND_PCM_AREA_MMAP:
|
||||||
|
#if 0
|
||||||
|
/* Tricky here: for alsa-oss */
|
||||||
|
errno = 12345;
|
||||||
|
#endif
|
||||||
err = munmap(i->addr, size);
|
err = munmap(i->addr, size);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
SYSERR("mmap failed");
|
SYSERR("mmap failed");
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
errno = 0;
|
||||||
break;
|
break;
|
||||||
case SND_PCM_AREA_SHM:
|
case SND_PCM_AREA_SHM:
|
||||||
err = shmdt(i->addr);
|
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)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_pcm_plug_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
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;
|
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)
|
int snd_pcm_plugin_mmap(snd_pcm_t *pcm)
|
||||||
{
|
{
|
||||||
snd_pcm_plugin_t *plug = pcm->private;
|
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);
|
||||||
size_t size = snd_pcm_frames_to_bytes(pcm, pcm->buffer_size);
|
int id = shmget(IPC_PRIVATE, size, 0666);
|
||||||
int id = shmget(IPC_PRIVATE, size, 0666);
|
if (id < 0) {
|
||||||
if (id < 0) {
|
SYSERR("shmget failed");
|
||||||
SYSERR("shmget failed");
|
return -errno;
|
||||||
return -errno;
|
|
||||||
}
|
|
||||||
plug->shmid = id;
|
|
||||||
}
|
}
|
||||||
|
plug->shmid = id;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue