sysctl_proc calls handler twice

Pawel Jakub Dawidek pjd at FreeBSD.org
Tue Aug 16 14:29:25 GMT 2005


On Tue, Aug 16, 2005 at 04:19:26PM +0200, m.ehinger at ltur.de wrote:
+> 
+> Thanks for all answers,
+> 
+> that more details than i needed.
+> 
+> I got around the problem by checking an external variable.
+> 
+> Here comes the hole story if somebody cares. (but be warned my english isn't the best)
+> 
+>       I wrote an driver for the Accelerometers used in Thinkpad and just want to see the data returned.
+>       So i created an sysctl proc which will read the data and return it.
+>       The problem was that the two calls to the proc are to close, i forgot to check if the Accelerometer
+>       has already finished its last run. So i want to write to the Accelerometer although he wasn't ready for that.
+>       With sysctlbyname i got no errors because the program itself took enough time between the calls.
+>       I now check if the previous command has finished before i send the new one so the double call isn't
+>        a probleme anymore.
+>       Any questions?

You can recognize if userland is asking for the size only by checking if
req->oldptr is NULL. If it is, you should only return size, if it is != NULL
then it requests for real data.

BTW. Do you have any docs for what you are doing? Or can you send me what
     you got already? I was interested in this subject as well, but didn't
     found anything useful.

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20050816/602181bc/attachment.bin


More information about the freebsd-arch mailing list