Date: Tue, 16 Aug 2005 16:29:02 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: m.ehinger@ltur.de Cc: Poul-Henning Kamp <phk@phk.freebsd.dk>, freebsd-arch@FreeBSD.org Subject: Re: sysctl_proc calls handler twice Message-ID: <20050816142902.GE3944@garage.freebsd.pl> In-Reply-To: <OF7B953787.91394C4F-ONC125705F.004D6DAB-C125705F.004EBBE9@gateway-inter.net> References: <11638.1124199342@phk.freebsd.dk> <OF7B953787.91394C4F-ONC125705F.004D6DAB-C125705F.004EBBE9@gateway-inter.net>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Tue, Aug 16, 2005 at 04:19:26PM +0200, m.ehinger@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@FreeBSD.org http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)
iD8DBQFDAfguForvXbEpPzQRAryPAKDlbatvQesnPIATjEjubSieLtv3nwCfXJaZ
QSU6G93hw020ZljtTNMeFHk=
=87Wc
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050816142902.GE3944>
