Fwd: FreeBSD open() questions
Pedro F. Giffuni
giffunip at asme.org
Mon Jul 12 13:29:40 PDT 2004
This sounds like -multimedia might want to know about too...
(sorry for posible media mangling)
--- In freebsd-hackers at FreeBSD.org, 4Front Technologies
<dev at opensound.com> wrote:
Hi,
We are trying to implement multi-open() in our OSS drivers for
FreeBSD. The idea is that all apps keep opening /dev/dsp and
internally OSS finds the next available device (/dev/dspNN+1) and
returns that device's minor number back to the open routine. What
happens is that every read/write/close/ioctl call now uses the new
minor number.
This works in Solaris and Linux.
In Solaris the open routine has an extra parameter that permits
giving a new device number that will be used in subsequent
read/write/etc calls. Changing this field doesn't affect the way how
open works.
In Linux struct file has a private field that the driver can use as
it likes. We simply store the major/minor number in this field. In
the read/write/ioctl/etc routines we read the device number from this
field instead of using inode->dev.
BSD doesn't have such mechanisms. The dev_t parameter is a "global"
one and the same structure is shared by all applications having the
same device file opened.
If you change anything in this structure then it will affect the
other applications that had opened the same file. Every time one
application tries to open /dev/dsp the changes will affect also the
applications that are already running (they will jump to use the new
device).
I've taken a look at dev_clone and EVENT_HANDLER stuff in FreeBSD's
pcm drivers but essentially this works by creating a new device and
adding it via devfs_create if you access /dev/dsp. But in our case we
have already added all the devices so using dev_clone doesn't work
(or atleast I've not been able to get it to do what we want)
We already have all the devices configured during our Module Load. So
all we really want to do is if you open /dev/dsp, OSS's device
manager will look for a free device and return that device's minor
number and from now on all read/write/ioctl/close routines will use
that device number.
Does anybody have any suggestions on how to get such features working
in both FreeBSD 4x and 5x? Should we be looking at /dev/tty (because
you can keep opening /dev/tty and it kind of behaves the same way
OSS's open works in Solaris or Linux.
BTW, we also want to work with the BSD audio guys to implement the
upcoming OSS V4.0 mixer extensions that will allow you to add mixer
extensions to devices that aren't your standard AC97 or ISA devices.
So if anyone wants to extend FreeBSD's OSS api, by all means contact
us and we'll work with you to implement this.
best regards
Dev Mazumdar
PS: Please respond directly to me as I'm not subscribed to the
freebsd-hackers list.
-----------------------------------------------------------
4Front Technologies
4035 Lafayette Place, Unit F, Culver City, CA 90232, USA.
Tel: (310) 202 8530 URL: www.opensound.com
Fax: (310) 202 0496 Email: info at opensound.com
-----------------------------------------------------------
_______________________________________________
freebsd-hackers at f... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at f..."
--- End forwarded message ---
More information about the freebsd-multimedia
mailing list