From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 26 13:46:06 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 175B71065670 for ; Tue, 26 Oct 2010 13:46:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C00338FC16 for ; Tue, 26 Oct 2010 13:46:05 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 495BF46B5B; Tue, 26 Oct 2010 09:46:05 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0F0E28A027; Tue, 26 Oct 2010 09:46:04 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Tue, 26 Oct 2010 09:34:57 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <4CC6830A.10701@icyb.net.ua> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201010260934.57247.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 26 Oct 2010 09:46:04 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: Andriy Gapon , Selphie Keller Subject: Re: SYSCALL_MODULE() macro and modfind() issues X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 13:46:06 -0000 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 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