What does kern_ioctl do?
Brooks Davis
brooks at freebsd.org
Thu Nov 30 00:58:53 UTC 2017
On Wed, Nov 29, 2017 at 07:29:55PM -0500, Farhan Khan wrote:
> Does anyone know what kern_ioctl does?
>
> It is called by sys_ioctl and located in
> /usr/src/sys/kern/sys_generic.c. OpenBSD and NetBSD do not have this
> function, so its FreeBSD-specific, but I do not understand its
> purpose.
Generally speaking, kern_<syscall>() functions are the actual
implementation with sys_<syscall>() handling the conversion from struct
<syscall>_args and possiably performing some argument checking to regular function arguments. The kern_ versions
exist to allow multiple callers to use the implementation. In the case
of kern_ioctl() a few callers want to effectively perform an ioctl. In
other cases, the kern_ function is there to allow the
freebsd32_<syscall> function to translate arguments before calling
kern_<syscall> rather than duplicating the guts of sys_<syscall>.
A good example of this is kern_openat() which is used by most
compatibility layers and by implements both open(2) and openat(2).
-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20171130/35206a8d/attachment.sig>
More information about the freebsd-hackers
mailing list