Subject: Re: improvements to mknod(8)
To: None <tech-userlevel@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-userlevel
Date: 02/07/2003 21:58:34
In article <20030207202024.N7389@snowdrop.l8s.co.uk>,
David Laight <david@l8s.co.uk> wrote:
>> Ooh yes, I'd forgotten about that hack. In that case, I don't know that I
>> have any objection to making MAKEDEV utterly nonportable and lightning fast.
>> I'd be inclined to leave it as a shell script, though, just so it can begin
>> with something like:
>>
>> if [ x`uname` != xNetBSD ]; then
>> echo "This script must be run on the system for which you want to create"
>> echo "the device nodes. There's no need to run it before that system"
>> echo "boots, since init(8) can fabricate /dev itself if necessary."
>> fi >&2
>>
>> People (like me) will forget otherwise.
>
>It would even be possible to have a shell function that would emulate
>the 'fast' mknod if you are building a non-native /dev.
>
>That way you get the best of both worlds.
Yes, a function would be nice to have.
Then you could
if [ "$(uname)" = "NetBSD" ]
then
create_device=mknod
else
create_device=slow_mknod
fi
create_device() {
....
}
$create_device ... ... ...
christos