From owner-freebsd-questions Fri Aug 9 0:35:10 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 34E6637B400 for ; Fri, 9 Aug 2002 00:35:08 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (happy-idiot-talk.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 53F2F43E65 for ; Fri, 9 Aug 2002 00:35:07 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk ([IPv6:::1]) by smtp.infracaninophile.co.uk (8.12.5/8.12.5) with ESMTP id g797Z4Fo087182; Fri, 9 Aug 2002 08:35:04 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost) by happy-idiot-talk.infracaninophile.co.uk (8.12.5/8.12.5/Submit) id g797YxwR087181; Fri, 9 Aug 2002 08:34:59 +0100 (BST) Date: Fri, 9 Aug 2002 08:34:59 +0100 From: Matthew Seaman To: joel@ie.cuhk.edu.hk Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Problem using fopen with ip_dummynet.c Message-ID: <20020809073459.GC86506@happy-idiot-talk.infracaninophi> References: <1028865572.3d533e24d682a@eng-ser4.erg.cuhk.edu.hk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1028865572.3d533e24d682a@eng-ser4.erg.cuhk.edu.hk> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Aug 09, 2002 at 11:59:32AM +0800, joel@ie.cuhk.edu.hk wrote: > I am trying to monitor the buffer size by using ipfw and I am modifying the > ip_dummynet.c file. > > I have included #include at the top of the code. > Then,I have file and started logging information in it. > > But when i want to compile I get the following error message : > > ip_dummynet.o: In function `move_pkt': > ip_dummynet.o(.text+0x51d): undefined reference to `fopen' > ip_dummynet.o(.text+0x531): undefined reference to `__sF' > ip_dummynet.o(.text+0x536): undefined reference to `fprintf' > ip_dummynet.o(.text+0x5ac): undefined reference to `fprintf' > ip_dummynet.o(.text+0x5b8): undefined reference to `fclose' > > Can anyone explain me the reason of this problem? I would be extremely > grateful. You're trying to use userland libc style code in the kernel --- as you have discovered, that doesn't work. One approach that should work is to use the sysctl(8) mechanism to save the buffer size at some MIB from within the kernel, and then write a userland process to monitor the value of the sysctl. If you hunt around in the ipfw code (which uses sysctl(8) quite a bit), you should be able to glean sufficient examples to be able to code that up. Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way Tel: +44 1628 476614 Marlow Fax: +44 0870 0522645 Bucks., SL7 1TH UK To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message