BSD is probably doing the same thing, but nevertheless, -STABLE (i.e. FreeBSD 4.x) has a bug in the pcm-driver (I think) which makes mapping the buffer write-only impossible (at least for me).
FreeBSD 5.x does not have that problem and sadly the pcm-code between 4.x and 5.x is virtually the same.
I think I remember BSD folks speaking of mmap changes... can someone confirm ?
+#ifndef __FreeBSD__ /* for some reason, es1371 and sblive! sometimes have junk in here. * clear it, or we get junk noise */ /* some libc implementations are buggy: their memset reads from the buffer... @@ -1826,6 +1832,9 @@ /* in all cases, fill the remaining bytes */ while (len-- != 0) *p1++ = 0; } +#else
memset(wwo->mapping,0, wwo->maplen);
+#endif
you shouldn't need this chunk
I know, this has nothing to do with mmap()ing the buffer, but it looks like FreeBSDs libc doesn't have the bug with memset(), so I just used that instead.
sure, not all Linux distros have this bug, but it creates a new code path, which is bad for maintenance... so leaving the code as it is, is a better option
A+