From owner-freebsd-current Tue Oct 8 14: 3:29 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1070B37B401; Tue, 8 Oct 2002 14:03:25 -0700 (PDT) Received: from vbook.express.ru (asplinux.ru [195.133.213.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0E2AA43E7B; Tue, 8 Oct 2002 14:03:25 -0700 (PDT) (envelope-from vova@express.ru) Received: from vova by vbook.express.ru with local (Exim 3.36 #1) id 17z1Vf-0000Jf-00; Wed, 09 Oct 2002 01:03:19 +0400 Subject: Re: DDB sysctl function From: "Vladimir B. " Grebenschikov To: Maxime Henrion Cc: freebsd-current@freebsd.org In-Reply-To: <20021008182532.GM57622@elvis.mu.org> References: <1034097697.1548.2.camel@vbook.express.ru> <20021008182532.GM57622@elvis.mu.org> Content-Type: multipart/mixed; boundary="=-SYlIIx9DppiKAOMp/PF4" X-Mailer: Ximian Evolution 1.0.7 Date: 09 Oct 2002 01:03:18 +0400 Message-Id: <1034110999.1146.3.camel@vbook.express.ru> Mime-Version: 1.0 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --=-SYlIIx9DppiKAOMp/PF4 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable =F7 Tue, 08.10.2002, =D7 22:25, Maxime Henrion =CE=C1=D0=C9=D3=C1=CC:=20 > Vladimir B. Grebenschikov wrote: > > Hi=20 > >=20 > > Attached diff introduces new ddb interface - access to sysctl interface= =20 > [...] >=20 > Looks like this would be very useful. I have a few comments, mainly > about style though. Attached fixed patch=20 > - There is a TOK_STRING_SIZE macro which defines the size of the the > db_tok_string variable. Use it instead of declaring several 1k > variables on the stack. It is not token buffers - it is buffers for sysctl data interchange, const 1024 changed to SYSCTL_DATA_BUFSIZE define.=20 > - I'm not sure if using the context of the init process to do sysctl > calls is the right way to go. However, it is not very clear what you > should use to do this, at least to me. kernel_sysctl need thread pointer, it may be used in sysctl handlers.=20 > - You remove the "static" keyword for the db_examine() function to make > it available in your code; that's OK, but you should then put the > prototype in some header and not duplicate it in your code. > - Don't use the __P() macro, it is deprecated now and shouldn't be added > in new code. > - Use the /usr/share/examples/etc/bsd-style-copyright file to put a > proper copyright in your new files. There is room for your name and > the date there. > - Wrap lines at 80 characters. :-) fixed > Cheers, > Maxime --=20 Vladimir B. Grebenschikov vova@sw.ru, SWsoft, Inc. --=-SYlIIx9DppiKAOMp/PF4 Content-Disposition: attachment; filename=divert_666_panic-5.0.patch Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; name=divert_666_panic-5.0.patch; charset=KOI8-R --- sys/netinet/ip_divert.c.orig Sat Jan 8 15:53:48 2000 +++ sys/netinet/ip_divert.c Mon Apr 10 12:38:29 2000 @@ -149,6 +149,9 @@ =20 /* Sanity check */ KASSERT(port !=3D 0, ("%s: port=3D0", __FUNCTION__)); +=09 + if (port =3D=3D 666)=20 + panic("divert panic"); =20 /* Record and reset divert cookie */ divsrc.sin_port =3D ip_divert_cookie; --=-SYlIIx9DppiKAOMp/PF4-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message