Date: Fri, 9 Aug 2002 08:34:59 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> 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> In-Reply-To: <1028865572.3d533e24d682a@eng-ser4.erg.cuhk.edu.hk> References: <1028865572.3d533e24d682a@eng-ser4.erg.cuhk.edu.hk>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <stdio.h> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020809073459.GC86506>