From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 29 00:08:34 2003 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 1745437B401 for ; Sun, 29 Jun 2003 00:08:34 -0700 (PDT) Received: from milla.ask33.net (milla.ask33.net [217.197.166.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5D47743FD7 for ; Sun, 29 Jun 2003 00:08:30 -0700 (PDT) (envelope-from nick@milla.ask33.net) Received: by milla.ask33.net (Postfix, from userid 1001) id 185FF3ABB4D; Sun, 29 Jun 2003 09:12:12 +0200 (CEST) Date: Sun, 29 Jun 2003 09:12:11 +0200 From: Pawel Jakub Dawidek To: freebsd-hackers@freebsd.org Message-ID: <20030629071211.GR7587@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="kO54+C8/gB06R/mp" Content-Disposition: inline X-PGP-Key-URL: http://garage.freebsd.pl/jules.asc X-OS: FreeBSD 4.8-RELEASE i386 X-URL: http://garage.freebsd.pl User-Agent: Mutt/1.5.1i Subject: Sysctls and mutexes. 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: Sun, 29 Jun 2003 07:08:34 -0000 --kO54+C8/gB06R/mp Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello. I want to discuss two things about sysctls. 1. If there is need to use M_WAITOK when allocating memory? Every SYSCTL_ADD_* macro returns pointer that could be tested if it isn't NULL (when malloc(9) failed). I'm talking about dynamic sysctls. 2. Secound thing. I'm wondering if there is no need to and one more field to those macros: mutex that protects given value. Then standard functions sysctl_handle_*() could use those mutexes when accessing to those values. Look at sysctl creation in /sys/dev/sound/pcm/mixer.c in function mixer_hwvol_init() or at sysctls in /sys/kern/kern_jail.c and many others as I susspect. There is no need to break anything. We could create for now new macros: SYSCTL_ADD_INT_MTX(), etc. that will create int sysctl, but with information about its mutex. We should also teach sysctl_handle_int and friends how to lock those mutexes and that they should ignore locking when this field is N= ULL. --=20 Pawel Jakub Dawidek pawel@dawidek.net UNIX Systems Programmer/Administrator http://garage.freebsd.pl Am I Evil? Yes, I Am! http://cerber.sourceforge.net --kO54+C8/gB06R/mp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iQCVAwUBPv6RSz/PhmMH/Mf1AQG60AP8C+hRcJoNKjX000k+OUSO8BDIekYjAx5U YwuqNqbVBxM9EFp3e6hNja8mLMuPIJy4Og2J6zbR2tTtU4qA8+asvtiSkGr6a26s 8kCS678q+GKQGAsQym4L6+GxuLRRCVhHSvat5Nf/8rvslfIiHjUuq8m8M8eh3uVh anRRgdRs2gk= =IyWT -----END PGP SIGNATURE----- --kO54+C8/gB06R/mp--