Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jun 2003 09:12:11 +0200
From:      Pawel Jakub Dawidek <nick@garage.freebsd.pl>
To:        freebsd-hackers@freebsd.org
Subject:   Sysctls and mutexes.
Message-ID:  <20030629071211.GR7587@garage.freebsd.pl>

next in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030629071211.GR7587>