Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Aug 2002 14:46:56 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        mjacob@freebsd.org, brooks@one-eyed-alien.net, arch@freebsd.org
Subject:   Re: kernel strlcpy
Message-ID:  <20020816144656.A24332@Odin.AC.HMC.Edu>
In-Reply-To: <20020816.141548.17599527.imp@bsdimp.com>; from imp@bsdimp.com on Fri, Aug 16, 2002 at 02:15:48PM -0600
References:  <20020815122641.B21334@Odin.AC.HMC.Edu> <20020816.141548.17599527.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <brooks@one-eyed-alien.net> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020816144656.A24332>