Subject: Re: dynamic sysctl
To: David Young <dyoung@pobox.com>
From: Greywolf <greywolf@starwolf.com>
List: tech-kern
Date: 11/15/2003 12:22:49
Thus spake David Young ("DY> ") sometime Today...
DY> I am not sure I understand how sysctlnametomib works. Tell me if this is
DY> right: my program calls sysctlnametomib("/a/b/c"). sysctlnametomib uses
DY> sysctl to record the version number stored at the top of the tree. It
DY> resolves "/a/b" to 13.27 using two sysctl calls. In the mean time, the
DY> kernel deletes the path "/a/b/d", which increases the version number
DY> at 13.27, at 13, and at the root. Now, sysctlnametomib resolves "c"
DY> at 13.27 to 4. It compares the version number at the root with the
DY> version number it recorded. Finding that the versions are different,
DY> it sets errno to EAGAIN (say) and returns -1. My program has to try
DY> again to resolve /a/b/c to a number.
DY>
DY> Assuming that is the way it works, I will worry that my program will
DY> sometimes have to try again forever to resolve "/a/b/c" to a numeric path.
Perhaps there should be a lock of some sort...?
--*greywolf;
--
NetBSD: Beyond Windows