From owner-freebsd-arch Fri Aug 16 14:47: 4 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 64D4937B400; Fri, 16 Aug 2002 14:47:01 -0700 (PDT) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id D873843E77; Fri, 16 Aug 2002 14:47:00 -0700 (PDT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (IDENT:brdavis@localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.12.3/8.12.3) with ESMTP id g7GLkuwu028231; Fri, 16 Aug 2002 14:46:56 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.12.3/8.12.3/Submit) id g7GLkukp028230; Fri, 16 Aug 2002 14:46:56 -0700 Date: Fri, 16 Aug 2002 14:46:56 -0700 From: Brooks Davis To: "M. Warner Losh" Cc: mjacob@freebsd.org, brooks@one-eyed-alien.net, arch@freebsd.org Subject: Re: kernel strlcpy Message-ID: <20020816144656.A24332@Odin.AC.HMC.Edu> References: <20020815122641.B21334@Odin.AC.HMC.Edu> <20020816.141548.17599527.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020816.141548.17599527.imp@bsdimp.com>; from imp@bsdimp.com on Fri, Aug 16, 2002 at 02:15:48PM -0600 X-Virus-Scanned: by amavisd-milter (http://amavis.org/) on odin.ac.hmc.edu 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 --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 16, 2002 at 02:15:48PM -0600, M. Warner Losh wrote: > In message: <20020815122641.B21334@Odin.AC.HMC.Edu> > Brooks Davis writes: > : I'd like to import strlcpy into libkern. >=20 > YES YES YES! >=20 > : I am not advocating introducing strlcat because strncat is bairly used > : (only 9 times in the whole kernel.) It's a bit more then that due to a macro, but those are all in one function. > I think it would be reasonable. >=20 > 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. Removing strncat is probably not too hard. A quick look shows the following users: - ficl uses it correctly but would probably be happier with strlcat - ACPI goes to a lot of trouble to define an ACPI_STRNCAT macro and then doesn't use it. I think ACPI would compile fine without strncat defined, but it would break if someone started using it. ACPI does provide a way to use internal versions of standard functions, but the granularity is use libc or don't so we'd have to patch to use their functions only when our libkern lacks them. Perhaps someone should talk to Intel about that. - isp(4) uses it where it should use strlcat. This one is problematic because mjacob needs portable source. Simply changing the existing STRNCAT macro to use strlcat would correct the minor bug under FreeBSD and would work. It would be evil though. Removing strncpy is more then I want to do at this point. I'd be happy to do part of it, but I'd like to get if_xname done first. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --7AUc2qLy4jB3hD7Z Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9XXLNXY6L6fI4GtQRArPKAJ9ywiTC5EBTRx64Cd7FH8lMZYJ2qQCfUe/a 4S4O0/gUjleHgwiF7KAkgQU= =vSCR -----END PGP SIGNATURE----- --7AUc2qLy4jB3hD7Z-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message