![]() |
|
Message-ID: <3wvtym2olgfr6px42jsjhmtkb3gyo65jnjxvm6npv365g2fn3y@c5bkzi5zejzs>
Date: Sat, 5 Jul 2025 02:43:44 +0200
From: Alejandro Colomar <alx@...nel.org>
To: Collin Funk <collin.funk1@...il.com>
Cc: Eric Blake <eblake@...hat.com>, Rich Felker <dalias@...c.org>,
enh <enh@...gle.com>, Florian Weimer <fweimer@...hat.com>,
Adhemerval Zanella Netto <adhemerval.zanella@...aro.org>, musl@...ts.openwall.com, libc-alpha@...rceware.org,
Joseph Myers <josmyers@...hat.com>, наб <nabijaczleweli@...ijaczleweli.xyz>,
Paul Eggert <eggert@...ucla.edu>, Robert Seacord <rcseacord@...il.com>,
Bruno Haible <bruno@...sp.org>, bug-gnulib@....org, JeanHeyd Meneide <phdofthehouse@...il.com>
Subject: Re: Re: BUG: realloc(p,0) should be consistent with malloc(0)
Hi Collin,
On Fri, Jul 04, 2025 at 05:15:27PM -0700, Collin Funk wrote:
> Alejandro Colomar <alx@...nel.org> writes:
>
> > BTW, I was trying to find out the history of memccpy(3), and why it was
> > introduced in 4.4BSD. Does anyone know the history? I find it a weird
> > function that doesn't have any good use case, or I don't seem to see it.
> > Every use case I see, such as a poor-man's strlcpy(3), seems to be prone
> > to off-by-one errors, or have other APIs that would be more ergonomic.
> > What were the original uses in 4.4BSD?
>
> In the sources for 2.11 BSD you can find the following in
> include/strings.h:
>
> /* Routines described in memory(BA_LIB); System V compatibility */
> char *memccpy(), *memchr(), *memcpy(), *memset(), *strchr(),
> *strdup(), *strpbrk(), *strrchr(), *strsep(), *strtok();
>
> The first time I can see the function defined is in Eigth Edition Unix.
Hmmm, so the FreeBSD manual page seems incorrect:
$ find -type f | grep memccpy.3 | MANWIDTH=72 xargs man 2>/dev/null | sed -n '/HISTORY/,$p'
HISTORY
The memccpy() function first appeared in 4.4BSD and was first
specified in the . The restrict keyword was added to the proto‐
type in FreeBSD 5.0.0 in accordance with the updated specifica‐
tion of IEEE Std 1003.1-2004 (“POSIX.1”).
Debian December 5, 2023 MEMCCPY(3)
Okay, I'll look into V8 Unix. At least now I know where to search.
Thanks! :)
> You can look for yourself here, <https://www.tuhs.org/cgi-bin/utree.pl>.
>
Yup, thanks! I was thinking it would be in 4.4BSD, according to
FreeBSD. Unix should be easier to search.
Have a lovely day!
Alex
--
<https://www.alejandro-colomar.es/>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.