splitting fnctl(), ioctl()

David P. Reese, Jr. daver at gomerbud.com
Fri Oct 10 06:24:35 PDT 2003

In splitting syscalls like fcntl() and ioctl(), I am considering doing
something like the following:

fcntl(stuct fcntl_args *uap)
	fcntl_copyin(uap->cmd, uap->arg, &buf);
	kern_fcntl(uap->fd, uap->arg, &buf);
	fcntl_copyout(uap->cmd, uap->arg, &buf);

The buffer would be the size of the largest argument for fcntl.
The emulators would then implement their own versions of the copyin/
copyout functions.  While this does separate the copyin/copyout,
it places code for the same fcntl in three different places.

The ioctl() syscall will be a little more trouble.  I don't like the
fact that drivers can copyin at their own discression, especially from
pointers stored in uap->arg.

More information about the Kernel mailing list