Re: [RFC] dynamic syscalls revisited
From: Steven Rostedt
Date: Mon Dec 06 2004 - 17:39:59 EST
On Mon, 2004-12-06 at 14:20 -0800, H. Peter Anvin wrote:
> Steven Rostedt wrote:
> >
> > I disagree about this statement. ioctl's suck because they usually have
> > none, or very poor documentation and you are stuck with opening devices,
> > and sending parameters to them that may be for the wrong device and
> > there is really no good checking to see what you sent is what you want
> > since its all defined by human unreadable numbers.
> >
>
> That's like saying you might be calling the wrong syscall by accident.
It can be easier to send the wrong command to a device, or even the
wrong device than to use a wrong system call.
You can do a mknod and use the wrong number, or have an outdated header
file, or wrong arch, and use the wrong command. Usually either of these
will just break the application doing so, but still can be dangerous.
> > As for dynamic system calls (and especially the way I've implemented
> > them) you have human readable names, with varying amount of parameters
> > that can make sense. So even if you still have none to very poor
> > documentation, you can understand things perhaps a little better. There
> > is also much better checking in dynamic system calls than to ioctls.
>
> There is NO checking in the syscall interface. Period. Any such
> checking is a facility of some kind of stub generator, and that's
> independent of the method used to invoke it.
I'll grant you that there is a stub generator that facilitates this, but
the entire mechanism is still better than the ioctl interface, and it
does have some kind of checking.
To get a system call, you must first ask for it by name. This is where
ioctl and dynamic system calls do differ. Since the name would be define
and you would have to match it. It's harder to confuse a name than a
number. Of course they also differ with the fact that the dynamic system
calls don't need a device.
As for the stub generator (which does the above action), it still gives
the methodology of making the system call with a format to check that
the arguments match. Yes, you do have to use a macro to define your
system call (like any other system call), but once that is done, then
you have a way to check parameters before they are sent. It's not
perfect (what is) but still can be useful, and I'm arguing that it can
be a better interface than the ioctls.
-- Steve
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/