Date: Wed, 15 Nov 1995 10:29:44 +0100 From: Poul-Henning Kamp <phk@critter.tfs.com> To: Bruce Evans <bde@zeta.org.au> Cc: davidg@Root.COM, peter@haywire.dialix.com, freebsd-hackers@freebsd.org Subject: Re: Can't NFS mount with latest -current Message-ID: <2643.816427784@critter.tfs.com> In-Reply-To: Your message of "Wed, 15 Nov 1995 19:06:56 %2B1100." <199511150806.TAA25412@godzilla.zeta.org.au>
next in thread | previous 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. (well actually we cannot with the current structure of the code :-) > 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(). That's a liberty on my part, the manpage will need updating later anyway. > 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. Huh ? -- Poul-Henning Kamp | phk@FreeBSD.ORG FreeBSD Core-team. http://www.freebsd.org/~phk | phk@login.dknet.dk Private mailbox. whois: [PHK] | phk@ref.tfs.com TRW Financial Systems, Inc. Future will arrive by its own means, progress not so.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2643.816427784>