[alsa-devel] dsnoop issues

Jaroslav Kysela perex at suse.cz
Fri Apr 27 15:18:53 CEST 2007


On Fri, 27 Apr 2007, Takashi Iwai wrote:

> At Fri, 27 Apr 2007 15:00:22 +0200 (CEST),
> Jaroslav Kysela wrote:
> > 
> > On Fri, 27 Apr 2007, Takashi Iwai wrote:
> > 
> > > Actually, the documentation is wrong, IMO.  The typical behavior of
> > > read syscall is that it returns a value actually read by that call.
> > > It doesn't guarantee whether the requested size is filled, and can be
> > > shorter than requested.  As snd_pcm_readi() emulates the read syscall,
> > > it should behave in that way.
> > 
> > I don't think so completely. For blocking mode (!O_NONBLOCK), all possible 
> > data should be read. Only signal or an error should break this.
> > 
> > The read logic for dsnoop is in snd_pcm_read_areas() in pcm/pcm.c 
> > (alsa-lib).
> 
> In the current implementation, it may work in that way.  But, in
> general, I'm against such a condition.  It's not what read syscalls
> does, so there is no real reason that snd_pcm_readi() should do so.

Well 'man 2 read' exactly explains when a less count than requested might 
be returned for blocking behaviour. I'm missing something? Of course, 
applications should not expect to read all possible frames, but under 
normal conditions, less count should be returned in rare cases (for 
the blocking mode, of course).

						Jaroslav

-----
Jaroslav Kysela <perex at suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs


More information about the Alsa-devel mailing list