Subject: does sysctl(2) always return NUL-terminated strings?
To: NetBSD Kernel Technical Discussion List <tech-kern@NetBSD.org>
From: Greg A. Woods <woods@planix.com>
List: tech-kern
Date: 07/17/2007 19:41:27
--pgp-sign-Multipart_Tue_Jul_17_19:41:27_2007-1
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
This doesn't seem to be very clearly documented but it would seem to me
that sysctl(3) must always find room (in "oldp", with a maximum length
given by "*oldplen") for the terminating NUL byte when returning a
string. Is this really true?
If I've got this right then I think I can submit a documentation PR to
correct at least sysctl(3), getdomainname(3) and gethostname(3).
(looks to me as though ENOMEM isn't fully documented in sysctl(3) either)
--=20
Greg A. Woods
H:+1 416 218-0098 W:+1 416 489-5852 x122 VE3TCP RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com> Secrets of the Weird <woods@weird.com>
--pgp-sign-Multipart_Tue_Jul_17_19:41:27_2007-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
MessageID: yfpc4HdiarLIQ1yuQM/xBTAy6BJmlVmq
iQA/AwUBRp1Tp2Z9cbd4v/R/EQLDJQCg5sqQ3Bl12VRwgGRc25aieMqEA6IAoNsI
7XCn7QElt4HBS69UeHFK7lYU
=kOpg
-----END PGP SIGNATURE-----
--pgp-sign-Multipart_Tue_Jul_17_19:41:27_2007-1--