From owner-freebsd-hackers Wed Nov 15 01:29:55 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id BAA11277 for hackers-outgoing; Wed, 15 Nov 1995 01:29:55 -0800 Received: from tfs.com (tfs.com [140.145.250.1]) by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id BAA11257 for ; Wed, 15 Nov 1995 01:29:50 -0800 Received: from critter.tfs.com by tfs.com (smail3.1.28.1) with SMTP id m0tFeA6-0003vlC; Wed, 15 Nov 95 01:29 PST Received: from localhost (localhost [127.0.0.1]) by critter.tfs.com (8.6.11/8.6.9) with SMTP id KAA02645; Wed, 15 Nov 1995 10:29:44 +0100 X-Authentication-Warning: localhost.tfs.com: Host localhost didn't use HELO protocol To: Bruce Evans cc: davidg@Root.COM, peter@haywire.dialix.com, freebsd-hackers@freebsd.org Subject: Re: Can't NFS mount with latest -current In-reply-to: Your message of "Wed, 15 Nov 1995 19:06:56 +1100." <199511150806.TAA25412@godzilla.zeta.org.au> Date: Wed, 15 Nov 1995 10:29:44 +0100 Message-ID: <2643.816427784@critter.tfs.com> From: Poul-Henning Kamp Sender: owner-hackers@freebsd.org Precedence: bulk > >>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.