From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 28 03:48:35 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C4D8216A4CE for ; Sat, 28 Aug 2004 03:48:35 +0000 (GMT) Received: from mail.iinet.net.au (mail-13.iinet.net.au [203.59.3.45]) by mx1.FreeBSD.org (Postfix) with SMTP id 77A9243D1F for ; Sat, 28 Aug 2004 03:48:33 +0000 (GMT) (envelope-from hacker2004@damon.com) Received: (qmail 13579 invoked from network); 28 Aug 2004 03:48:32 -0000 Received: from unknown (HELO ?199.98.84.67?) (199.98.84.67) by mail.iinet.net.au with SMTP; 28 Aug 2004 03:48:32 -0000 Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <2061FF78-F8A5-11D8-BD8C-000A957C9058@damon.com> Content-Transfer-Encoding: 7bit X-Image-Url: http://homepage.mac.com/permezel/.cv/thumbs/me.thumbnail From: Herbert Acker X-Face: NW=A7k7S; x-wc#Kc74a\5QbF7iiHJ!a>%no+IRQE:0-0Pt@pVB`U&+_MSpHH}]*?l*Tol{ *7^7b>hPpuJpPvfwv+:f?hiz&>ecO8(^K'DCRHO2%sq2rz&w-?7G?pFs0/[fHW9`m>hL.S m#+64}^[o6eggyJ!w*_q*}1ZD7+HGy'h|$}Cbc ]h^N~>{uv>~L(r]o]5u\W{Xfi|MQNr4LY8*1(ss><[Zo? List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Aug 2004 03:48:35 -0000 Hi. I have been occasionally plagued by panics in KLD: at /usr/src/sys/i386/i386/trap.c:466 #6 0xc016c2dc in sysctl_register_oid (oidp=0x0) at /usr/src/sys/kern/kern_sysctl.c:92 #7 0xc016c841 in sysctl_register_set (lsp=0xcd5000a0) at /usr/src/sys/kern/kern_sysctl.c:391 #8 0xc0157847 in linker_file_register_sysctls (lf=0xcd4ea180) at /usr/src/sys/kern/kern_linker.c:224 #9 0xc01578fc in linker_load_file ( It bit me once several years ago, and then again today. It croaks because it finds the sysctl_set symbol in the KLD but the OIDs are zero. I finally got pissed off enough and figured out what the problem is, instead of using the dynamic-sysctls approach I adopted the other time. Essentially, I have two KLDs. One imports symbols from the other. I have them in separate dirs, and have a -I ../dir0/ in the Makefile of the KLD which imports the interface of the other KLD. IE: dir0/has_interfaces_and_sysctls.c dir1/uses_interfaces_no_sysctls.c dir1/Makefile: CFLAGS += -I../dir0/ gensetdefs creates files to manage the .set sections. The setdefs0.c includes setdefs.h, and the ../dir0/setdefs.h has some sysctls, so it has the set definitions for those sysctls. The second KLD has no sysctls. The second KLD is being linked with a setdefs0.o which is made using the ../dir0/setdefs.h. Simple fix: put "-I." in the CFLAGS prior to -I../dir0/. Hopefully, this will be helpful to some others. Damon