xref: /freebsd/share/man/man9/bcopy.9 (revision 7f55dbe6ae89c356db1bc4fb2c42d9d007ae5da1)
1.\" Copyright (c) 1990, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.Dd July 1, 2026
32.Dt BCOPY 9
33.Os
34.Sh NAME
35.Nm bcopy
36.Nd copy bytes in object
37.Sh SYNOPSIS
38.In sys/systm.h
39.Ft void
40.Fn bcopy "const void *src" "void *dst" "size_t len"
41.Sh DESCRIPTION
42The
43.Fn bcopy
44function copies
45.Fa len
46bytes from object
47.Fa src
48to object
49.Fa dst
50preserving the provenance of pointers in the copied object
51.Pq see Xr memory_model 7 for further information .
52The two objects may overlap.
53If
54.Fa len
55is zero, no bytes are copied.
56.Pp
57The
58.Fn bcopy
59function is deprecated and
60.Fn memcpy
61or
62.Fn memmove
63should be used as appropriate in new code.
64.Sh SEE ALSO
65.Xr memcpy 9 ,
66.Xr memmove 9
67.Sh HISTORY
68A
69.Fn bcopy
70function appeared in
71.Bx 4.2 .
72.Pp
73.St -p1003.1-2008
74removes the specification of
75.Fn bcopy
76and it is marked as LEGACY in
77.St -p1003.1-2004 .
78New programs should use
79.Xr memmove 3 .
80If the input and output buffer do not overlap, then
81.Xr memcpy 3
82is more efficient.
83Note that
84.Fn bcopy
85takes
86.Ar src
87and
88.Ar dst
89in the opposite order from
90.Fn memmove
91and
92.Fn memcpy .
93In practice,
94.In sys/systm.h
95defines
96.Fn bcopy
97as a macro that calls
98.Fn memmove
99since
100.Fx 12.0 .
101