xref: /illumos-gate/usr/src/head/memory.h (revision aecc710ab066150d47e5e9e7269e2e0d69107b4e)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2026 Gordon Ross <gordon.w.ross@gmail.com>
24  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
25  */
26 /*	Copyright (c) 1988 AT&T	*/
27 /*	  All Rights Reserved	*/
28 
29 #ifndef	_MEMORY_H
30 #define	_MEMORY_H
31 
32 #include <sys/types.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 extern void *memccpy(void *, const void *, int, size_t);
39 
40 #if __cplusplus >= 199711L
41 namespace std {
42 #endif
43 
44 extern int memcmp(const void *, const void *, size_t);
45 extern void *memcpy(void *_RESTRICT_KYWD, const void *_RESTRICT_KYWD, size_t);
46 extern void *memset(void *, int, size_t);
47 
48 /* See similar in string_iso.h */
49 #if __cplusplus >= 199711L
50 extern const void *memchr(const void *, int, size_t);
51 #ifndef	_MEMCHR_INLINE
52 #define	_MEMCHR_INLINE
53 extern "C++" {
54 	inline void *memchr(void * __s, int __c, size_t __n) {
55 		return (void *)memchr((const void *)__s, __c, __n);
56 	}
57 }
58 #endif	/* _MEMCHR_INLINE */
59 
60 #else	/* __cplusplus >= 199711L */
61 
62 extern void *memchr(const void *, int, size_t);
63 
64 #endif	/* __cplusplus >= 199711L */
65 
66 #if __cplusplus >= 199711L
67 }	/* end of namespace std */
68 #endif	/* __cplusplus >= 199711L */
69 
70 #ifdef	__cplusplus
71 }
72 #endif
73 
74 #if __cplusplus >= 199711L
75 using std::memcmp;
76 using std::memcpy;
77 using std::memset;
78 using std::memchr;
79 #endif	/* __cplusplus >= 199711L */
80 
81 #endif	/* _MEMORY_H */
82