[alsa-devel] write/read system calls and ioctl

Michael Voigt michael.c.m.voigt at web.de
Wed Dec 19 18:56:17 CET 2007

Dear ALSA developers,

At the beginning, I would like to give a short introdution of myself, then my 
question follows. 

My project:
Currently, I am interning at the TU Dresden operating 
systems group's [1] and it is my task to port ALSA to DROPS [2, 3], a
L4-microkernel-based real-time system. The long-term goal of this
project should be to establish a truely real-time capable FOSS platform
for audio recording and processing.

The current state of the project: By using DDELinux [4] and writing a small 
kernel-user inferface emulation layer, we now have an unchanged version of 
ALSA and an unchanged version of salsa-lib [5] running on our system. The 
next steps will be to test how stable this port is and fix bugs. Then, during 
my diploma thesis, it is my task to port Jack (or an equivalent) to our 
system and to evaluate how to make the whole thing to work in real-time.

But now my question:
In the file pcm_native in alsa-core read (snd_pcm_read) and write 
(snd_pcm_write) functions are attached to the snd_pcm_f_ops. But as far 
as I can see, these write- und read- system calls aren't used either in 
salsa-lib or in alsa-lib.

I can see that in former versions of alsa-lib (for instance alsalib-0.0.3) the 
write system call was used to implement snd_pcm_write (LIB); but now we have 
snd_pcm_writei (LIB) and snd_pcm_writen (LIB) which use ioctl. I guess this 
was done to realize both interleaved and noninterleaved audio playback (The 
old snd_pcm_write (LIB) was based on bytes not on frames and did not have a 
notion of interleaved/noninterleaved playback?). If I have a look at 
snd_pcm_write (KERNEL, pcm_native.c), I can see it also ends up in 
snd_pcm_lib_write(...). So does ioctl with SNDRV_PCM_IOCTL_WRITEI_FRAMES as 
argument, but snd_pcm_write (KERNEL) does not copy the frames to kernel 

My question: what is snd_pcm_write in pcm_native.c good for? Is it only there 
to keep ALSA compatible to older versions of alsa-lib?

Kindest regards,
Michael Voigt

[1] http://www.inf.tu-dresden.de/index.php?node_id=1141&ln=en
[2] http://www.osnews.com/story.php/15814/Introduction-to-TUD-OS/
[4] http://demo.tudos.org/dsweeper_tutorial.html
[5] http://ftp.isr.ist.utl.pt/pub/MIRRORS/ftp.suse.com/people/tiwai/salsa-lib/

Today is Pungenday, the 61st day of The Aftermath in the YOLD 3173

More information about the Alsa-devel mailing list