Print this page
10229 Some man pages have incorrect cross-references
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man3c/memset_s.3c
+++ new/usr/src/man/man3c/memset_s.3c
1 1 .\"
2 2 .\" This file and its contents are supplied under the terms of the
3 3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 4 .\" You may only use this file in accordance with the terms of version
5 5 .\" 1.0 of the CDDL.
6 6 .\"
7 7 .\" A full copy of the text of the CDDL should have accompanied this
8 8 .\" source. A copy of the CDDL is also available via the Internet at
9 9 .\" http://www.illumos.org/license/CDDL.
10 10 .\"
11 11 .\"
12 12 .\" Copyright 2018 Nexenta Systems, Inc.
13 13 .\"
14 14 .Dd August 12, 2017
15 15 .Dt MEMSET_S 3C
16 16 .Os
17 17 .Sh NAME
18 18 .Nm memset_s
19 19 .Nd copy a value to all bytes of a memory buffer
20 20 .Sh LIBRARY
21 21 .Lb libc
22 22 .Sh SYNOPSIS
23 23 .Fd #define __STDC_WANT_LIB_EXT1__ 1
24 24 .In string.h
25 25 .Ft errno_t
26 26 .Fo memset_s
27 27 .Fa "void *s"
28 28 .Fa "rsize_t smax"
29 29 .Fa "int c"
30 30 .Fa "rsize_t n"
31 31 .Fc
32 32 .Sh DESCRIPTION
33 33 The
34 34 .Fn memset_s
35 35 function copies the value of
36 36 .Fa c
37 37 .Po converted to an
38 38 .Vt unsigned char
39 39 .Pc
40 40 into each of the first
41 41 .Fa n
42 42 bytes of the memory buffer pointed to by
43 43 .Fa s .
44 44 .Pp
45 45 Unlike the
46 46 .Xr memset 3C ,
47 47 .Fn memset_s
48 48 is guaranteed to never be optimized away by the compiler.
49 49 .Pp
50 50 The
51 51 .Fn memset_s
52 52 function detects the following runtime-constraint violations:
53 53 .Bl -enum
54 54 .It
55 55 .Fa s
56 56 is a
57 57 .Dv NULL
58 58 pointer.
59 59 .It
60 60 .Fa smax
61 61 or
62 62 .Fa n
63 63 is greater than
64 64 .Dv RSIZE_MAX .
65 65 .It
66 66 .Fa n
67 67 is greater than
68 68 .Fa smax
69 69 .Pq buffer overflow .
70 70 .El
71 71 .Pp
72 72 If runtime-constraint violation is detected, and if
73 73 .Fa s
74 74 and
75 75 .Fa smax
76 76 are valid, the
77 77 .Fn memset_s
78 78 function copies the value of
79 79 .Fa c
80 80 .Po converted to an
81 81 .Vt unsigned char
82 82 .Pc
83 83 into each of the first
84 84 .Fa smax
85 85 bytes of the memory buffer pointed to by
86 86 .Fa s
87 87 before calling the runtime-constraint handler.
88 88 .Sh RETURN VALUES
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
89 89 The
90 90 .Fn memset_s
91 91 function returns 0 if there was no runtime-constraint violation.
92 92 Otherwise, a non-zero value is returned.
93 93 .Sh INTERFACE STABILITY
94 94 .Sy Standard
95 95 .Sh MT-LEVEL
96 96 .Sy Safe
97 97 .Sh SEE ALSO
98 98 .Xr memset 3C ,
99 -.Xr set_constraint_handler 3C
99 +.Xr set_constraint_handler_s 3C
100 100 .Sh STANDARDS
101 101 The
102 102 .Fn memset_s
103 103 function conforms to
104 104 .St -isoC-2011 .
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX