Date: Thu, 30 Nov 2017 00:58:45 +0000 From: Brooks Davis <brooks@freebsd.org> To: Farhan Khan <khanzf@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: What does kern_ioctl do? Message-ID: <20171130005845.GA54229@spindle.one-eyed-alien.net> In-Reply-To: <CAFd4kYCsBsTSh6GbGF1zQ4_rVoFYn6PAh41UukfQ1ct%2BEHq8NA@mail.gmail.com> References: <CAFd4kYCsBsTSh6GbGF1zQ4_rVoFYn6PAh41UukfQ1ct%2BEHq8NA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--tKW2IUtsqtDRztdT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 29, 2017 at 07:29:55PM -0500, Farhan Khan wrote: > Does anyone know what kern_ioctl does? >=20 > 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 f= unction 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 --tKW2IUtsqtDRztdT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJaH1fEAAoJEKzQXbSebgfAfYgIAIUHkpbuFwlws0YzuYKPYoOY J6RJ0fuYEmPo/1U7HaamZdDPQx8IqRRC6h5yLdp9q6/g7Av/3GG/iOWia/lhMDZs pygi3F5pGcfj63vdn65p96r4YR4F5fgxcrlBaz/wwvbzAdS+gT8i49pjxjZXfcri sFP+7hWSv5de00+7TxWKaov1fWCJb+BetiVmlhtJ3hpu9mEQ+Kd8Ug0ZQDlSFBJh jTfcFL0nOq8qHV/37OpfkYE9cSRqRC6+mu9N3QvGA4z52LCn7xBSFGgY5DDmiJ6P DcChJ7KKLSod6F8uON4a3VZKsn54ivmXCNEzYYErjLb8tvs2EzLhSjUcgl8sxAw= =/wVi -----END PGP SIGNATURE----- --tKW2IUtsqtDRztdT--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171130005845.GA54229>