Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/dev/audio



On Tue, Jun 01, 2021 at 09:12:24PM +0000, Taylor R Campbell wrote:
> audio(4): Set AUMODE_PLAY/RECORD only if asked _and_ supported.
> 
> If one is requested and _not_ supported, fail; otherwise we might
> enter audio_write with a null play track and crash on KASSERT.

It looks like this is an incompatible change.

Sun says:

- Attempts to open a device with FREAD set fail if the device is not
  capable of recording.  (Likewise for FWRITE and playback.)
https://github.com/illumos/illumos-gate/blob/9ecd05bdc59e4a1091c51ce68cce2028d5ba6fd1/usr/src/uts/common/io/audio/impl/audio_sun.c#L70

But in NetBSD 7...

audio_open() does not return a clear failure:
https://github.com/NetBSD/src/blob/netbsd-7/sys/dev/audio.c#L1652

EINVAL is returned if !audio_can_playback in audiostartp()
https://github.com/NetBSD/src/blob/netbsd-7/sys/dev/audio.c#L2801
... which is called from audio_write()

So it looks to me like open() should succeed but write() should fail.

This is important if you want to open an audio device just to test
a few properties (i.e. AUDIO_GETPROPS, AUDIO_GETDEV...).


Home | Main Index | Thread Index | Old Index