From owner-freebsd-arch Fri Aug 16 15:25: 9 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DCB2737B400 for ; Fri, 16 Aug 2002 15:25:04 -0700 (PDT) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 4223343E42 for ; Fri, 16 Aug 2002 15:25:04 -0700 (PDT) (envelope-from nate@rootlabs.com) Received: (qmail 43890 invoked by uid 1000); 16 Aug 2002 22:25:05 -0000 Date: Fri, 16 Aug 2002 15:25:05 -0700 (PDT) From: Nate Lawson To: "M. Warner Losh" Cc: brooks@one-eyed-alien.net, arch@FreeBSD.ORG Subject: Re: kernel strlcpy In-Reply-To: <20020816.141548.17599527.imp@bsdimp.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, 16 Aug 2002, M. Warner Losh wrote: > : I am not advocating introducing strlcat because strncat is bairly used > : (only 9 times in the whole kernel.) > > I think it would be reasonable. > > In fact, if we ELIMINATE strncat and strncpy in the kernel, then that > would be enough to justify bringing them in. Since this isn't a > hosted environment, we can do that if we want. > > Warner One useful thing about strncpy is that it overwrites the remainder of its length with zeroes, not just null-terminating the string with a single zero. This is useful for fixed-length fields that aren't interpreted as null-terminated strings but can be a huge performance hit when all you wanted was single null termination (i.e. path). -Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message