From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 16 23:44:51 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 BD91C16A4CE for ; Thu, 16 Sep 2004 23:44:51 +0000 (GMT) Received: from vsmtp12.tin.it (vsmtp12.tin.it [212.216.176.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7E18643D4C for ; Thu, 16 Sep 2004 23:44:51 +0000 (GMT) (envelope-from flag@tin.it) Received: from southcross.homeunix.org (82.49.164.44) by vsmtp12.tin.it (7.0.027) id 4149A03A00032A0B for freebsd-hackers@freebsd.org; Fri, 17 Sep 2004 01:44:51 +0200 Received: by southcross.homeunix.org (Postfix, from userid 1001) id 755FE20CD; Fri, 17 Sep 2004 01:55:05 +0200 (CEST) Date: Fri, 17 Sep 2004 01:55:05 +0200 From: Paolo Pisati To: FreeBSD_Hackers Message-ID: <20040916235505.GA8460@tin.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i Subject: sysctl stuff and your article in daemon news zine 200305 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2004 23:44:51 -0000 Hi guys i was looking for some material about sysctl stuff when i found out phk's article in daemonews. Sysctl are simple to use but i'm stuck with SYSCTL_ADD_PROC(). Lets' take this: sysctl_ctx_init(&xxx_clist); o = SYSCTL_ADD_NODE(&xxx_clist, SYSCTL_STATIC_CHILDREN(_net), OID_AUTO, "xxx", CTLFLAG_RW, 0, "Virtual Network XXX"); SYSCTL_ADD_INT(&xxx_clist, SYSCTL_CHILDREN(o), OID_AUTO, "status", CTLFLAG_RW, &status, 0, "status of xxx"); SYSCTL_ADD_PROC(&xxx_clist, SYSCTL_CHILDREN(o), OID_AUTO, "text_xxx", CTLTYPE_STRING|CTLFLAG_WR, string, 10, sysctl_xxx_text_prg, "A", "baubaubau"); Here i create xxx under _net and start to add oid but, while "status" appear in the sysctl tree, "text_xxx" it doesn't show up. And the function sysctl_xxx_text_prg is called EVERY time i issue sysctl -a. Why it works this way? I mean, why don't "text_xxx" show up in sysctl tree? And why sysctl -a trigger sysctl_xxx_text_prg? I expected to see text_xxx near status in the sysctl tree, to be a text buffer and that sysctl_xxx_text_prg get called when i manipulate it and not everytime i list the complete sysctl tree. To put it clear, i would like something like this: net- \ |-foo |-bar |-xxx- |-... \ |-status |-text_xxx |-other_text_xxx and i would like that ONLY when i modify text_xxx my function sysctl_xxx_text_prg, it reads the content of text_prg, modify it and then write the results in other_text_xxx. Well, i know i'm wrong somewhere, but i don't know where... =P I read some sources of geom and random but i couldn't find where's my mistake, hope someone can help me... =P Thank you. -- Paolo Italian FreeBSD User Group: http://www.gufi.org