[buug] Re: /dev/dsp, /dev/audio, open(2), ... (About OSS program)
mp at rawbw.com
Wed Aug 11 07:00:03 PDT 2004
Quoting George Wong <crazylion at vip.sina.com>:
> There is no error if I do "cat /dev/dsp > hello" and "cat hello > /dev/dsp".
> But if I try to open () device, it will display "cannot open device: resource
> or device busy". The result of lsmod is
> #define DEVICE "/dev/audio"
> fd = open(DEVICE,O_RDWR);
You're using two different pathnames - /dev/dsp and /dev/audio.
I'm not sure which distribution/kernel you're using, but at least when I
peek at my configuration, those pathnames are both distinct files and
distinct devices (different inodes, different minor numbers).
You might also use strace(1) to investigate the varous programs. Perhaps
different flags are being used in the open(2), e.g. O_RDONLY vs. O_WRONLY
vs. O_RDWR, and perhaps that's a factor. fuser(1) and/or lsof(8)
might also possibly be useful.
More information about the buug