From owner-freebsd-arch Fri Aug 16 15:29:41 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 6D60A37B400 for ; Fri, 16 Aug 2002 15:29:39 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8924043E65 for ; Fri, 16 Aug 2002 15:29:38 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.3/8.12.3) with ESMTP id g7GMTZQe004273; Fri, 16 Aug 2002 16:29:35 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 16 Aug 2002 16:29:31 -0600 (MDT) Message-Id: <20020816.162931.25827842.imp@bsdimp.com> To: nate@root.org Cc: brooks@one-eyed-alien.net, arch@FreeBSD.ORG Subject: Re: kernel strlcpy From: "M. Warner Losh" In-Reply-To: References: <20020816.141548.17599527.imp@bsdimp.com> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 In message: Nate Lawson writes: : 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). Right, but strn* is almost always used wrong. There are very few fixed length fields like this compared to the number of bogus useages of strn*. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message