From owner-freebsd-net@FreeBSD.ORG Fri May 4 21:48:04 2012 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D2551065742 for ; Fri, 4 May 2012 21:48:04 +0000 (UTC) (envelope-from hapvbk@yahoo.co.uk) Received: from nm10-vm0.bullet.mail.ird.yahoo.com (nm10-vm0.bullet.mail.ird.yahoo.com [77.238.189.90]) by mx1.freebsd.org (Postfix) with SMTP id B0DF28FC19 for ; Fri, 4 May 2012 21:48:03 +0000 (UTC) Received: from [77.238.189.56] by nm10.bullet.mail.ird.yahoo.com with NNFMP; 04 May 2012 21:47:56 -0000 Received: from [212.82.108.254] by tm9.bullet.mail.ird.yahoo.com with NNFMP; 04 May 2012 21:47:56 -0000 Received: from [127.0.0.1] by omp1019.mail.ird.yahoo.com with NNFMP; 04 May 2012 21:47:56 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 696897.18508.bm@omp1019.mail.ird.yahoo.com Received: (qmail 41105 invoked by uid 60001); 4 May 2012 21:47:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1336168076; bh=sZ7J9Imdroh2RhH72KpKmNjUy/tr1BBg5S6RbMvh9FY=; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=EouST/7CoqQkZEOIM/VT5Ye7HGXSUnk4ANTjyneV4K5JIpflTWjgRWaPcP45oDenpo9AQ3NNJS12E3LH1Yb64canJRUHk3XuvOGGdo++OpC4y5wTkQvU9aylnO6lSNTP+sAsNXCj/o+vIwy6hh6FFRMdsPLGDJHMMZka46eifVk= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=RVh/y8tk3crZDLCu0ctVI+D5Hu0UxNJEXLyThndvbFZTqh3QiWOHwqp3dub6qTcQb1RH6pXZGq6tULyZxQpPJI7cM00YoeE4YxyMjIeeP36aB7CcurMgmym4QgVfrU/jQvCfAwenxQgUWva3cAYDwehcrRCu3goyT37y6PKMm5o=; X-YMail-OSG: oPItnFwVM1lwIgaj3uh5Rttq907UHgVxU4r.nW84knQHuts opl0xEkylqdxclLVokDEf02MGrvehu0g6dgVHpuCUqCWDEylH5qMxzI9RXLn MT6rAN9JSdN0FL49LRgF0xJPflcNq7zfJ.lgFtvRYasrqk4LVe7ZeMvqHFVt KALvuyCrbYpFGLgj1Dq.U74FUJXVrEa6oA7YbZu0ULqUZlvZtnDjonOU7dNa T6KhRJggYiu4hO52x7HmTrVVTk3FCWy6KVgb3JmtAdKodpPI7Qe7rPuY2HJD rQO.5H8ZVHQ__4QC7Su15rzv05IbJPe4rrE1eKcuzq6LlqJCrYJEd0ugZYvm hl0Bhtt1MVpxr6kTXgC_iukfezteRkIlU2O_t_8jBuMQOMuppgNEk4PtRkki kobssclbPiayyVuCZ067CdTOzNZWiEyJQEJI- Received: from [204.138.59.246] by web28802.mail.ir2.yahoo.com via HTTP; Fri, 04 May 2012 22:47:56 BST X-Mailer: YahooMailWebService/0.8.117.340979 Message-ID: <1336168076.28222.YahooMailNeo@web28802.mail.ir2.yahoo.com> Date: Fri, 4 May 2012 22:47:56 +0100 (BST) From: Pham Viet Ha To: "net@freebsd.org" , "freebsd-net@freebsd.org" MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 04 May 2012 22:14:01 +0000 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: sysctl command with struct X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Pham Viet Ha List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 May 2012 21:48:04 -0000 Hi all,=0A=0AI am writing a code using sysctl to manipulate a kernel variab= le. The variable is a data structure with two fields, protocol number (uint= 16_t) and description (char *).=0A=0AI have some difficulties with sysctl c= ommand to pass both protocol number and description at a time to the kernel= . I used CTLTYPE_OPAQUE in SYSCTL_ADD_PROC call, then I used=A0sysctl_handl= e_opaque to read data.=A0=0A=0AIt does not work correctly. I don't know how= what is the format I have to use when I type in "sysctl ..." at the prompt= .=A0=0A=0Astruct protodesc {=A0=0Auint16_t protonumber;=A0=0Achar descripti= on[256];=0A}