From owner-freebsd-arch Tue Dec 12 14:43:36 2000 From owner-freebsd-arch@FreeBSD.ORG Tue Dec 12 14:43:35 2000 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from critter.freebsd.dk (flutter.freebsd.dk [212.242.40.147]) by hub.freebsd.org (Postfix) with ESMTP id 1AAA637B400; Tue, 12 Dec 2000 14:43:34 -0800 (PST) Received: from critter (localhost [127.0.0.1]) by critter.freebsd.dk (8.11.1/8.11.1) with ESMTP id eBCMhNe55083; Tue, 12 Dec 2000 23:43:23 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: Warner Losh Cc: Dag-Erling Smorgrav , assar@FreeBSD.ORG, Matt Dillon , kris@citusc.usc.edu, arch@FreeBSD.ORG Subject: Re: Safe string formatting in the kernel In-Reply-To: Your message of "Tue, 12 Dec 2000 15:28:27 MST." <200012122228.PAA33203@harmony.village.org> Date: Tue, 12 Dec 2000 23:43:22 +0100 Message-ID: <55081.976661002@critter> From: Poul-Henning Kamp Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <200012122228.PAA33203@harmony.village.org>, Warner Losh writes: >In message Dag-Erling Smorgrav writes: >: Warner Losh writes: >: > Just be careful that your dynamic string growing things don't violate >: > the hard limit invariants in the kernel. If it produces paths longer >: > than 1023 characters, for example, it is wrong. >: >: Code manipulating path names would specify a hard upper limit of >: MAXPATHLEN. > >If there's a known, realtively small, upper limit, why does allocating >it dynamically buy you when you could have a static buffer? I know >that it costs you a trip into the kernel malloc routines which can be >quite high at times. I have not reread DES's implementation, but in my design doc you could initialize an sbuf with your own buffer, for exactly that reason. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message