Date: Wed, 15 Nov 1995 19:06:56 +1100 From: Bruce Evans <bde@zeta.org.au> To: davidg@Root.COM, peter@haywire.dialix.com Cc: freebsd-hackers@freebsd.org Subject: Re: Can't NFS mount with latest -current Message-ID: <199511150806.TAA25412@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>>Anyway, Poul-Henning has created two sysctl types.. one is a >>null-terminated "C-style" string, and the other is an "opaque" chunk >>of byte counted memory. IMHO, the string version should always return >>the correct amount of characters that the string actually uses. If >>the whole block is to be returned, that's what the opaque type is for. > Yes, the "size" argument should be used to limit the copy, not prevent it >from happening. We should be using copyoutstr() for this. We shouldn't be using copyoutstr() for this. It returns ENAMETOOLONG, which would need to be converted to ENOMEM. Together with managing the indirect count, this would take about the same amount of code as calling strlen() and calculating the amount that fits. I think sysctl_handle_string() essentially does this. Does it have bugs? Why does it return E2BIG? This errno isn't documented for sysctl(). The current (i386) implementation of copyoutstr() is poor. strlen() followed by copyout() would be much faster. strlen() followed by memcpy() is close to the fastest method of implementing strcpy() on the i386. copyoutstr() is the most complicated routine in support.s, but is currently unused. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511150806.TAA25412>