Subject: Re: Getting file descriptor in driver ioctl method
To: Aaro J Koskinen <firstname.lastname@example.org>
From: Emmanuel Dreyfus <email@example.com>
Date: 05/06/2002 21:48:34
> File system ioctl can naturally access the vnode (you won't probably
> need or even want to know what the file descriptor is). Maybe you
> should implement the "device" as a special file in the /kern file
> system, instead of writing a device driver (and then use symlink
> /dev/usemaclone -> /kern/usemaclone).
This is a good idea, but I really need the file descriptor (or the
struct file), since the behavior of /dev/usemaclone really depends on
it. Here is what can happen on IRIX:
- open /dev/usemaclone, get fd = 5
- open /dev/usemaclone, get fd = 6
- register semaphore S1 with an ioctl on fd = 5
- register semaphore S2 with an ioctl on fd = 6
- fork 2 additionnal threads
- thread 1 does a select on fd = 5
- thread 2 does a select on fd = 6
- thread 3 makes semaphore S1 available
Here thread 1 is awaken, thread 2 keep sleeping on select
If you work with vnodes, fd = 5 and fd = 6 have different struct file,
but f_data points to the same vnode, making impossible to attach a
semaphore to a struct vnode.
Is there a possibility to duplicate the struct vnode on open if I use a
file on kernfs?
- Quel est le meilleur moyen d'accelerer un PC?
- 9,81 m/s^2