Subject: Re: Multiple syscalls in an LKM
To: Pete Yandell <pete.yandell@gmail.com>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 07/02/2004 11:47:22
--bg08WKrSYDhXBjb5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Jul 02, 2004 at 02:15:22PM +1000, Pete Yandell wrote:
> Is there an easy way to define multiple new syscalls in an LKM? Using
> the MOD_SYSCALL macro more than once results in errors (error:
> redefinition of `_module'), and pulling MOD_SYSCALL apart and trying
> to do the equivalent myself looks painful.

I think all you really need to do is make your lkm a MISC lkm, and have
your lkm loader do what lkmdispatch() and _lkm_syscall() do for LM_SYSCALL=
=20
lkms.

Another option is to have multiple syscall lkms. Have the first one=20
contain code it needs and code it shares with the second one. Load it=20
first. Save the output of the linking, then use that when loading the=20
second LKM. The second LKM can refer to routines in the first.

> Alternatively, am I better off just defining a single syscall and
> using a selector to choose the appropriate function, ioctl style?

That's up to you.

Take care,

Bill

--bg08WKrSYDhXBjb5
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFA5a26Wz+3JHUci9cRAnIfAJ9my5vR86GnfUtpQ5eWufqJW27fkACdEkef
U0YnUvsRaB43G4+Nn/NOGv4=
=W/uV
-----END PGP SIGNATURE-----

--bg08WKrSYDhXBjb5--