1memchr(9F) Kernel Functions for Drivers memchr(9F)
2
3
4
6 memchr, memcmp, memcpy, memmove, memset - Memory operations
7
9 #include <sys/ddi.h>
10
11
12
13 void *memchr(const void *s, int c, size_t n);
14
15
16 int memcmp(const void *s1, const void *s2, size_t n);
17
18
19 void *memcpy(void *restrict s1, const void *restrict s2, size_t n);
20
21
22 void *memmove(void *s1, const void *s2, size_t n);
23
24
25 void *memset(void *s, int c, size_t n);
26
27
29 Solaris DDI specific (Solaris DDI).
30
32 dst Pointers to character strings.
33
34
35 n Count of characters to be copied.
36
37
38 s1, s2 Pointers to character strings.
39
40
42 These functions operate as efficiently as possible on memory areas
43 (arrays of bytes bounded by a count, not terminated by a null charac‐
44 ter). They do not check for the overflow of any receiving memory area.
45
46
47 The memchr() function returns a pointer to the first occurrence of c
48 (converted to an unsigned char) in the first n bytes (each interpreted
49 as an unsigned char) of memory area s, or a null pointer if c does not
50 occur.
51
52
53 The memcmp() function compares its arguments, looking at the first n
54 bytes (each interpreted as an unsigned char), and returns an integer
55 less than, equal to, or greater than 0, according as s1 is lexicograph‐
56 ically less than, equal to, or greater than s2 when taken to be
57 unsigned characters.
58
59
60 The memcpy() function copies n bytes from memory area s2 to s1. It
61 returns s1. If copying takes place between objects that overlap, the
62 behavior is undefined.
63
64
65 The memmove() function copies n bytes from memory area s2 to memory
66 area s1. Copying between objects that overlap will take place cor‐
67 rectly. It returns s1.
68
69
70 The memset() function sets the first n bytes in memory area s to the
71 value of c (converted to an unsigned char). It returns s.
72
74 Using memcpy() might be faster than using memmove() if the application
75 knows that the objects being copied do not overlap.
76
78 These functions can be called from user, interrupt, or kernel context.
79
81 bcopy(9F), ddi_copyin(9F), strcpy(9F)
82
83
84 Writing Device Drivers
85
86
87
88SunOS 5.11 16 Jan 2006 memchr(9F)