From owner-freebsd-hackers@freebsd.org Mon Jun 20 05:40:23 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AFA3A7A82F for ; Mon, 20 Jun 2016 05:40:23 +0000 (UTC) (envelope-from noname.esst@yahoo.com) Received: from nm22-vm0.bullet.mail.ne1.yahoo.com (nm22-vm0.bullet.mail.ne1.yahoo.com [98.138.91.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D30251A8F for ; Mon, 20 Jun 2016 05:40:22 +0000 (UTC) (envelope-from noname.esst@yahoo.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1466401216; bh=VoA4LzB2+oLXlEEqofLE6PuWh2WjHa7Ye/X1aUEbPrc=; h=Date:From:Reply-To:To:Subject:References:From:Subject; b=jjqqP3TrzFxmN4nWFfgrQehWziF/IC5HUvTgY9ute4OedoSu9ay47v7Jw7+Q/pbUIE/mIHdW5smYXuWoD0uoQIFeiZmCwhT0IxfhaT2qMNgz/3yixtSICDUMJ0uk2dmJqLiN9PMfhiGlwORlvEnu2WEaK5SQjIegDlZJPFzMeTaqMdc9ezKm+yk0myuE4KN2OHAgJPchXZxhilwbuPuNNuQZ8u4di+DGiIOxuFTO0joKq1yQRn+8hX6om6Nfl02xxrH7w+2ttNOUmlQgpEnnxmNtNqk+QL3R/t3KD5RdXPxcBG4RUpYY78sk3XByhjIQn37mPeYQSRq/OA9qqcsrag== Received: from [98.138.226.180] by nm22.bullet.mail.ne1.yahoo.com with NNFMP; 20 Jun 2016 05:40:16 -0000 Received: from [98.138.89.250] by tm15.bullet.mail.ne1.yahoo.com with NNFMP; 20 Jun 2016 05:40:16 -0000 Received: from [127.0.0.1] by omp1042.mail.ne1.yahoo.com with NNFMP; 20 Jun 2016 05:40:16 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 607501.30703.bm@omp1042.mail.ne1.yahoo.com X-YMail-OSG: OQHds0kVM1l0fO89iukieuXHDaC1QyKx71ZJA7xplRo3Kx_OhmsTNBLMEDmQJhl HVt6Y1PXV7imRpg9GWoh_Dt.OTjXCEGv9qUXYpAEAUq87kIIy1cLdvggYXX48sbLBfFC3AQyUrvI .oVdWecwD5T9dwk90Yllyx.psSNweaAkMm3uqBn07eCka4Tcmwe_QQLVrwX2CgbhuSN83_ODAG9c mGeWKHniE4S1pzsubVkTE3wf5yNeyUWxZQDCpnQlF5Yv1VvD8fyBV4maw.jWF0RASfSo8upgbVSO sYmcPyXK9k243Vohw4yOjo_5jA8BLnZrZ0FsFTLq9HOQYsX1wD9U6NldP.YI2f6BQ7nyUu_igtsz qqAF_iQWaAC8dTe34zOE4lUXa_sYvhL8MkJin4zVucBywuYM_bo5nIoV0Z7MDV2ngt2fXFusARXg 3lQrv4iASHDjdTV1I5ru5JzMOHwYeEX8ld3b8M8jv56jDrQYyb4oX4V2nAVY4KSKxVmEI3Qv7pbl VmkpN6NNWH5LfGcaPy17XMF9ezbUDWw-- Received: from jws100236.mail.ne1.yahoo.com by sendmailws158.mail.ne1.yahoo.com; Mon, 20 Jun 2016 05:40:16 +0000; 1466401216.146 Date: Mon, 20 Jun 2016 05:40:15 +0000 (UTC) From: Nomad Esst Reply-To: Nomad Esst To: FreeBSD Hackers Message-ID: <820876206.1145906.1466401215430.JavaMail.yahoo@mail.yahoo.com> Subject: Using netgraph in kernel modules MIME-Version: 1.0 References: <820876206.1145906.1466401215430.JavaMail.yahoo.ref@mail.yahoo.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 05:40:23 -0000 Hi I included the two files in my kernel module : #include #include And here is contents of Makefile: =C2=A0 KMOD=3D echo=C2=A0=C2=A0 SRCS=3D char_dev.c =C2=A0 .include When I try to run make I face the following errors: @/netgraph/ng_message.h:59: error: expected specifier-qualifier-list before= 'u_char' @/netgraph/ng_message.h:227: error: expected specifier-qualifier-list befor= e 'uint32_t' @/netgraph/ng_message.h:269: error: expected specifier-qualifier-list befor= e 'u_int32_t' @/netgraph/ng_message.h:283: error: expected specifier-qualifier-list befor= e 'u_int32_t' @/netgraph/ng_message.h:294: error: expected specifier-qualifier-list befor= e 'u_int32_t' @/netgraph/ng_message.h:306: error: expected specifier-qualifier-list befor= e 'u_int64_t' @/netgraph/ng_message.h:332: error: expected specifier-qualifier-list befor= e 'u_int' @/netgraph/ng_message.h:352: error: expected specifier-qualifier-list befor= e 'uint32_t' In file included from @/sys/lock.h:36, =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0from @/netgra= ph/netgraph.h:52, =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0from char_dev= .c:2: @/sys/_lock.h:36: error: expected specifier-qualifier-list before 'u_int' In file included from @/netgraph/netgraph.h:52, =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0from char_dev= .c:2: @/sys/lock.h:60: error: expected specifier-qualifier-list before 'u_int' In file included from char_dev.c:2: @/netgraph/netgraph.h:1187: error: field 'tag' has incomplete type *** [char_dev.o] Error code 1 Stop in /extra/char-dev. What's the problem?? From owner-freebsd-hackers@freebsd.org Mon Jun 20 06:27:06 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A68CA7B034 for ; Mon, 20 Jun 2016 06:27:06 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E9CF32CB9 for ; Mon, 20 Jun 2016 06:27:05 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-242-176.lns20.per4.internode.on.net [121.45.242.176]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id u5K6R0eK086341 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 19 Jun 2016 23:27:02 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: Using netgraph in kernel modules To: noname.esst@yahoo.com References: <820876206.1145906.1466401215430.JavaMail.yahoo.ref@mail.yahoo.com> <820876206.1145906.1466401215430.JavaMail.yahoo@mail.yahoo.com> From: Julian Elischer Cc: freebsd-hackers@freebsd.org Message-ID: Date: Mon, 20 Jun 2016 14:26:54 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <820876206.1145906.1466401215430.JavaMail.yahoo@mail.yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 06:27:06 -0000 On 20/06/2016 1:40 PM, Nomad Esst via freebsd-hackers wrote: > Hi > > I included the two files in my kernel module : > > #include #include did you start with /usr/src/sys/netgraph/ng_sample.c? My suggestion is to start with that and add in your code a bit at a time To see it compile, go to /usr/src/sys/modules/netgraph/sample and type "make to make your own module, copy the build directory to /usr/src/sys/modules/netgraph/mymodule copy the source files to /usr/src/sys/netgraph/ng_mymodule.h /usr/src/sys/netgraph/ng_mymodule.c and replace all instances of 'sample' in all the files and the Makefile with 'mymodule' Then go to /usr/src/sys/modules/netgraph/mymodule and make sure it still compiles then add all your own code, adding include files as you need them recompile it every time you have the oportunity while you are working on it. > > And here is contents of Makefile: > > KMOD= echo SRCS= char_dev.c > > .include > > When I try to run make I face the following errors: > > > @/netgraph/ng_message.h:59: error: expected specifier-qualifier-list before 'u_char' > @/netgraph/ng_message.h:227: error: expected specifier-qualifier-list before 'uint32_t' > @/netgraph/ng_message.h:269: error: expected specifier-qualifier-list before 'u_int32_t' > @/netgraph/ng_message.h:283: error: expected specifier-qualifier-list before 'u_int32_t' > @/netgraph/ng_message.h:294: error: expected specifier-qualifier-list before 'u_int32_t' > @/netgraph/ng_message.h:306: error: expected specifier-qualifier-list before 'u_int64_t' > @/netgraph/ng_message.h:332: error: expected specifier-qualifier-list before 'u_int' > @/netgraph/ng_message.h:352: error: expected specifier-qualifier-list before 'uint32_t' > In file included from @/sys/lock.h:36, > from @/netgraph/netgraph.h:52, > from char_dev.c:2: > @/sys/_lock.h:36: error: expected specifier-qualifier-list before 'u_int' > In file included from @/netgraph/netgraph.h:52, > from char_dev.c:2: > @/sys/lock.h:60: error: expected specifier-qualifier-list before 'u_int' > In file included from char_dev.c:2: > @/netgraph/netgraph.h:1187: error: field 'tag' has incomplete type > *** [char_dev.o] Error code 1 > > > Stop in /extra/char-dev. > > > What's the problem?? > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > >