Subject: Re: dupfd hack and clonable devices
To: None <email@example.com>
From: Christos Zoulas <firstname.lastname@example.org>
Date: 11/16/2004 15:59:37
In article <20041116153712.GC11216@gallia.cubidou.net>,
>As I was looking for a way to turn ethfoo(4) into some sort of
>clonable device, I saw the "dupfd hack", which is more or less
>what I want. If I understand correctly, I have to fill
>curlwp->l_dupfd with a complete file descriptor that will be
>re-opened by sys_open().
>The drawback of this is that it doesn't simply makes a character
>device clonable, as I have to provide a fileops structure. There
>are two ways of doing that: providing my own (as systrace and
>dmover do), or using vnops (as ptmx does). The former introduces
>a lot of complexity, the latter requires the correct device nodes
>to exist in the file-system.
>Is my analysis correct? Is there a simpler way to acheive what
>I want to do (which, in case it's not clear, is to have a ethfoo
>device that creates an interface for each open)?
Actually you don't need to provide device nodes in the second case.
You only need device nodes if you are planning to access those nodes
from userland. If the open file descriptor is all you need, then
you don't need to create them. This is what is done for the master
side of pty's in ptyfs. You don't get access to /dev/ptc/X,
but you get a file-descriptor opened that points to it.