git: b94f43890645 - main - Add kernel manpages for bcopy, memcpy, and memmove

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Thu, 25 Jun 2026 10:07:58 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=b94f438906451d4826d190d36b07e870443439ac

commit b94f438906451d4826d190d36b07e870443439ac
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-06-25 10:05:02 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-06-25 10:05:02 +0000

    Add kernel manpages for bcopy, memcpy, and memmove
    
    We will add variants of memcpy and memmove to support CHERI so
    bootstrap the manpages from section 3.
    
    Mark bcopy as deprecated.
    
    Reviewed by:    imp, kib, emaste
    Effort:         CHERI upstreaming
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D57661
---
 share/man/man9/Makefile  |  3 ++
 share/man/man9/bcopy.9   | 98 ++++++++++++++++++++++++++++++++++++++++++++++++
 share/man/man9/memcpy.9  | 78 ++++++++++++++++++++++++++++++++++++++
 share/man/man9/memmove.9 | 66 ++++++++++++++++++++++++++++++++
 4 files changed, 245 insertions(+)

diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 894a9971295c..fb9f5bca72c5 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -12,6 +12,7 @@ MAN=	accept_filter.9 \
 	altq.9 \
 	atomic.9 \
 	backlight.9 \
+	bcopy.9 \
 	bhnd.9 \
 	bhnd_erom.9 \
 	bios.9 \
@@ -228,7 +229,9 @@ MAN=	accept_filter.9 \
 	mbuf_tags.9 \
 	mdchain.9 \
 	memcchr.9 \
+	memcpy.9 \
 	memguard.9 \
+	memmove.9 \
 	microseq.9 \
 	microtime.9 \
 	microuptime.9 \
diff --git a/share/man/man9/bcopy.9 b/share/man/man9/bcopy.9
new file mode 100644
index 000000000000..a82c66c66965
--- /dev/null
+++ b/share/man/man9/bcopy.9
@@ -0,0 +1,98 @@
+.\" Copyright (c) 1990, 1991, 1993
+.\"	The Regents of the University of California.  All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Chris Torek.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd June 19, 2026
+.Dt BCOPY 9
+.Os
+.Sh NAME
+.Nm bcopy
+.Nd copy bytes in object
+.Sh SYNOPSIS
+.In sys/systm.h
+.Ft void
+.Fn bcopy "const void *src" "void *dst" "size_t len"
+.Sh DESCRIPTION
+The
+.Fn bcopy
+function copies
+.Fa len
+bytes from object
+.Fa src
+to object
+.Fa dst .
+The two objects may overlap.
+If
+.Fa len
+is zero, no bytes are copied.
+.Pp
+The
+.Fn bcopy
+function is deprecated and
+.Fn memcpy
+or
+.Fn memmove
+should be used as appropriate in new code.
+.Sh SEE ALSO
+.Xr memcpy 9 ,
+.Xr memmove 9
+.Sh HISTORY
+A
+.Fn bcopy
+function appeared in
+.Bx 4.2 .
+.Pp
+.St -p1003.1-2008
+removes the specification of
+.Fn bcopy
+and it is marked as LEGACY in
+.St -p1003.1-2004 .
+New programs should use
+.Xr memmove 3 .
+If the input and output buffer do not overlap, then
+.Xr memcpy 3
+is more efficient.
+Note that
+.Fn bcopy
+takes
+.Ar src
+and
+.Ar dst
+in the opposite order from
+.Fn memmove
+and
+.Fn memcpy .
+In practice,
+.In sys/systm.h
+defines
+.Fn bcopy
+as a macro that calls
+.Fn memmove
+since
+.Fx 12.0 .
diff --git a/share/man/man9/memcpy.9 b/share/man/man9/memcpy.9
new file mode 100644
index 000000000000..e9675a55cf13
--- /dev/null
+++ b/share/man/man9/memcpy.9
@@ -0,0 +1,78 @@
+.\" Copyright (c) 1990, 1991, 1993
+.\"	The Regents of the University of California.  All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Chris Torek and the American National Standards Committee X3,
+.\" on Information Processing Systems.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd June 19, 2026
+.Dt MEMCPY 9
+.Os
+.Sh NAME
+.Nm memcpy
+.Nd copy bytes in memory
+.Sh SYNOPSIS
+.In sys/systm.h
+.Ft void *
+.Fn memcpy "void *dst" "const void *src" "size_t len"
+.Sh DESCRIPTION
+The
+.Fn memcpy
+function copies
+.Fa len
+bytes from object
+.Fa src
+to object
+.Fa dst .
+If
+.Fa src
+and
+.Fa dst
+overlap, the results are not defined.
+.Sh RETURN VALUES
+The
+.Fn memcpy
+function
+returns the original value of
+.Fa dst .
+.Pp
+.Sh SEE ALSO
+.Xr bcopy 9 ,
+.Xr memmove 9
+.Sh STANDARDS
+The
+.Fn memcpy
+function
+conforms to
+.St -isoC .
+.Sh HISTORY
+The
+.Fn memcpy
+function first appeared in
+.At V
+and was reimplemented for
+.Bx 4.3 Tahoe .
diff --git a/share/man/man9/memmove.9 b/share/man/man9/memmove.9
new file mode 100644
index 000000000000..54031dc37d96
--- /dev/null
+++ b/share/man/man9/memmove.9
@@ -0,0 +1,66 @@
+.\" Copyright (c) 1990, 1991, 1993
+.\"	The Regents of the University of California.  All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Chris Torek and the American National Standards Committee X3,
+.\" on Information Processing Systems.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd June 19, 2026
+.Dt MEMMOVE 9
+.Os
+.Sh NAME
+.Nm memmove
+.Nd copy bytes in memory
+.Sh SYNOPSIS
+.In sys/systm.h
+.Ft void *
+.Fn memmove "void *dst" "const void *src" "size_t len"
+.Sh DESCRIPTION
+The
+.Fn memmove
+function copies
+.Fa len
+bytes from object
+.Fa src
+to object
+.Fa dst .
+The two objects may overlap;
+the copy is always done in a non-destructive manner.
+.Sh RETURN VALUES
+The
+.Fn memmove
+function returns the original value of
+.Fa dst .
+.Sh SEE ALSO
+.Xr bcopy 9 ,
+.Xr memcpy 9
+.Sh STANDARDS
+The
+.Fn memmove
+function
+conforms to
+.St -isoC .