Date: Tue, 26 Oct 2010 09:34:57 -0400 From: John Baldwin <jhb@freebsd.org> To: freebsd-hackers@freebsd.org Cc: Andriy Gapon <avg@icyb.net.ua>, Selphie Keller <selphie.keller@gmail.com> Subject: Re: SYSCALL_MODULE() macro and modfind() issues Message-ID: <201010260934.57247.jhb@freebsd.org> In-Reply-To: <AANLkTikRqHOJ8voweZhDEfNsRAR_pEoXspLQYrVtGsRH@mail.gmail.com> References: <AANLkTimVUzV3v9=y%2BWuuf%2B1fC4OYxD2Gs4j%2B=SO-M%2BP9@mail.gmail.com> <4CC6830A.10701@icyb.net.ua> <AANLkTikRqHOJ8voweZhDEfNsRAR_pEoXspLQYrVtGsRH@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, October 26, 2010 4:00:14 am Selphie Keller wrote: > Thanks Andriy, > > Took a look at the change to src/sys/sys/sysent.h > > @@ -149,7 +149,7 @@ static struct syscall_module_data name## > }; \ > \ > static moduledata_t name##_mod = { \ > - #name, \ > + "sys/" #name, \ > syscall_module_handler, \ > &name##_syscall_mod \ > }; \ > > applied the MFC prefix to pmap port: > > --- /usr/ports/sysutils/pmap/work/pmap/pmap/pmap.c.orig 2010-10-26 > 00:55:32.000000000 -0700 > +++ /usr/ports/sysutils/pmap/work/pmap/pmap/pmap.c 2010-10-26 > 00:56:10.000000000 -0700 > @@ -86,12 +86,12 @@ main(int argc, char **argv) > struct kinfo_proc *kp; > int pmap_helper_syscall; > > - if ((modid = modfind("pmap_helper")) == -1) { > + if ((modid = modfind("sys/pmap_helper")) == -1) { > /* module not found, try to load */ > modid = kldload("pmap_helper.ko"); > if (modid == -1) > err(1, "unable to load pmap_helper module"); > - modid = modfind("pmap_helper"); > + modid = modfind("sys/pmap_helper"); > if (modid == -1) > err(1, "pmap_helper module loaded but not found"); > } > > which restored functionality on freebsd 8.1. The best approach might be to have something like this: static int pmap_find(void) { int modid; modid = modfind("pmap_helper"); if (modid == -1) modid = modfind("sys/pmap_helper"); return (modid); } then in the original main() routine use this: if ((modid = pmap_find()) == -1) { /* module not found, try to load */ modid = kldload("pmap_helper.ko"); if (modid == -1) err(1, "unable to load pmap_helper module"); modid = pmap_find(); if (modid == -1) err(1, "pmap_helper module loaded but not found"); } This would make the code work for both old and new versions. > -Estella Mystagic (Selphie) > > On Tue, Oct 26, 2010 at 12:28 AM, Andriy Gapon <avg@icyb.net.ua> wrote: > > on 26/10/2010 01:01 Selphie Keller said the following: > >> hi fbsd-hackers, > >> > >> Noticed a issue in 8.1-release, 8.1p1-release and 8.1-stable > >> amd64/i386, to where modfind() will no longer find pmap_helper for the > >> /usr/ports/sysutils/pmap port, or other syscall modules using > >> SYSCALL_MODULE() macro. > >> The issue is that modfind() function no longer finds any modules using > >> SYSCALL_MODULE() macro to register the kernel module. Making it > >> difficult for userland apps to call the syscall provided. modfind() > >> always returns -1 which prevents modstat() from getting the required > >> information to perform the syscall. > >> > >> Also tested, the demo syscall module: > > > > After commit r205320 and, apparently, its MFC you need to prefix the module with > > "sys/". For example: > > modstat(modfind("sys/syscall"), &stat); > > > > P.S. > > Perhaps a KPI breakage in a stable branch? > > -- > > Andriy Gapon > > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010260934.57247.jhb>