xref: /freebsd/share/man/man9/memmove.9 (revision 7f55dbe6ae89c356db1bc4fb2c42d9d007ae5da1)
1b94f4389SBrooks Davis.\" Copyright (c) 1990, 1991, 1993
2b94f4389SBrooks Davis.\"	The Regents of the University of California.  All rights reserved.
3b94f4389SBrooks Davis.\"
4b94f4389SBrooks Davis.\" This code is derived from software contributed to Berkeley by
5b94f4389SBrooks Davis.\" Chris Torek and the American National Standards Committee X3,
6b94f4389SBrooks Davis.\" on Information Processing Systems.
7b94f4389SBrooks Davis.\"
8b94f4389SBrooks Davis.\" Redistribution and use in source and binary forms, with or without
9b94f4389SBrooks Davis.\" modification, are permitted provided that the following conditions
10b94f4389SBrooks Davis.\" are met:
11b94f4389SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright
12b94f4389SBrooks Davis.\"    notice, this list of conditions and the following disclaimer.
13b94f4389SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright
14b94f4389SBrooks Davis.\"    notice, this list of conditions and the following disclaimer in the
15b94f4389SBrooks Davis.\"    documentation and/or other materials provided with the distribution.
16b94f4389SBrooks Davis.\" 3. Neither the name of the University nor the names of its contributors
17b94f4389SBrooks Davis.\"    may be used to endorse or promote products derived from this software
18b94f4389SBrooks Davis.\"    without specific prior written permission.
19b94f4389SBrooks Davis.\"
20b94f4389SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21b94f4389SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22b94f4389SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23b94f4389SBrooks Davis.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24b94f4389SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25b94f4389SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26b94f4389SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27b94f4389SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28b94f4389SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29b94f4389SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30b94f4389SBrooks Davis.\" SUCH DAMAGE.
31b94f4389SBrooks Davis.\"
32*7f55dbe6SBrooks Davis.Dd July 1, 2026
33b94f4389SBrooks Davis.Dt MEMMOVE 9
34b94f4389SBrooks Davis.Os
35b94f4389SBrooks Davis.Sh NAME
36*7f55dbe6SBrooks Davis.Nm memmove ,
37*7f55dbe6SBrooks Davis.Nm memmove_data
38b94f4389SBrooks Davis.Nd copy bytes in memory
39b94f4389SBrooks Davis.Sh SYNOPSIS
40b94f4389SBrooks Davis.In sys/systm.h
41b94f4389SBrooks Davis.Ft void *
42b94f4389SBrooks Davis.Fn memmove "void *dst" "const void *src" "size_t len"
43*7f55dbe6SBrooks Davis.Ft void *
44*7f55dbe6SBrooks Davis.Fn memmove_data "void *dst" "const void *src" "size_t len"
45b94f4389SBrooks Davis.Sh DESCRIPTION
46b94f4389SBrooks DavisThe
47b94f4389SBrooks Davis.Fn memmove
48b94f4389SBrooks Davisfunction copies
49b94f4389SBrooks Davis.Fa len
50b94f4389SBrooks Davisbytes from object
51b94f4389SBrooks Davis.Fa src
52b94f4389SBrooks Davisto object
53b94f4389SBrooks Davis.Fa dst .
54b94f4389SBrooks DavisThe two objects may overlap;
55*7f55dbe6SBrooks Davisthe copy is always done in a non-destructive manner and preserves
56*7f55dbe6SBrooks Davisthe provenance of pointers in the copied object
57*7f55dbe6SBrooks Davis.Pq see Xr memory_model 7 for further information .
58*7f55dbe6SBrooks DavisThe
59*7f55dbe6SBrooks Davis.Fn memmove_data
60*7f55dbe6SBrooks Davisfunction does the same except that it does not preserve the provenance
61*7f55dbe6SBrooks Davisof pointers in the copied object.
62*7f55dbe6SBrooks DavisOn CHERI targets, the validity tag of any copied capability is
63*7f55dbe6SBrooks Davisexplicitly cleared.
64b94f4389SBrooks Davis.Sh RETURN VALUES
65b94f4389SBrooks DavisThe
66b94f4389SBrooks Davis.Fn memmove
67*7f55dbe6SBrooks Davisand
68*7f55dbe6SBrooks Davis.Fn memmove_data
69*7f55dbe6SBrooks Davisfunctions return the original value of
70b94f4389SBrooks Davis.Fa dst .
71b94f4389SBrooks Davis.Sh SEE ALSO
72b94f4389SBrooks Davis.Xr bcopy 9 ,
73*7f55dbe6SBrooks Davis.Xr memcpy 9 ,
74*7f55dbe6SBrooks Davis.Xr memcpy_data 9
75b94f4389SBrooks Davis.Sh STANDARDS
76b94f4389SBrooks DavisThe
77b94f4389SBrooks Davis.Fn memmove
78b94f4389SBrooks Davisfunction
79b94f4389SBrooks Davisconforms to
80b94f4389SBrooks Davis.St -isoC .
81*7f55dbe6SBrooks Davis.Sh HISTORY
82*7f55dbe6SBrooks DavisThe
83*7f55dbe6SBrooks Davis.Fn memmove_data
84*7f55dbe6SBrooks Davisfunction first appeared in
85*7f55dbe6SBrooks Davis.Fx 16.0 .
86