Print this page
OS-4028 need a priv for meminfo and disallow by default for a zone
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/man/man2/meminfo.2.man.txt
+++ new/usr/src/man/man2/meminfo.2.man.txt
1 1 MEMINFO(2) System Calls MEMINFO(2)
2 2
3 3
4 4
5 5 NAME
6 6 meminfo - provide information about memory
7 7
8 8 SYNOPSIS
9 9 #include <sys/types.h>
10 10 #include <sys/mman.h>
11 11
12 12 int meminfo(const uint64_t inaddr[], int addr_count,
13 13 const uint_t info_req[], int info_count, uint64_t outdata[],
14 14 uint_t validity[]);
15 15
16 16
17 17 PARAMETERS
18 18 inaddr
19 19 array of input addresses; the maximum number of addresses
20 20 that can be processed for each call is MAX_MEMINFO_CNT
21 21
22 22
23 23 addr_count
24 24 number of addresses
25 25
26 26
27 27 info_req
28 28 array of types of information requested
29 29
30 30
31 31 info_count
32 32 number of pieces of information requested for each
33 33 address in inaddr
34 34
35 35
36 36 outdata
37 37 array into which results are placed; array size must be
38 38 the product of info_count and addr_count
39 39
40 40
41 41 validity
42 42 array of size addr_count containing bitwise result codes;
43 43 0th bit evaluates validity of corresponding input
44 44 address, 1st bit validity of response to first member of
45 45 info_req, and so on
46 46
47 47
48 48 DESCRIPTION
49 49 The meminfo() function provides information about virtual and physical
50 50 memory particular to the calling process. The user or developer of
51 51 performance utilities can use this information to analyze system memory
52 52 allocations and develop a better understanding of the factors affecting
53 53 application performance.
54 54
55 55
56 56 The caller of meminfo() can obtain the following types of information
57 57 about both virtual and physical memory.
58 58
59 59 MEMINFO_VPHYSICAL
60 60 physical address corresponding to virtual
61 61 address
62 62
63 63
64 64 MEMINFO_VLGRP
65 65 locality group of physical page corresponding
66 66 to virtual address
67 67
68 68
69 69 MEMINFO_VPAGESIZE
70 70 size of physical page corresponding to
71 71 virtual address
72 72
73 73
74 74 MEMINFO_VREPLCNT
75 75 number of replicated physical pages
76 76 corresponding to specified virtual address
77 77
78 78
79 79 MEMINFO_VREPL | n
80 80 nth physical replica of specified virtual
81 81 address
82 82
83 83
84 84 MEMINFO_VREPL_LGRP | n
85 85 lgrp of nth physical replica of specified
86 86 virtual address
87 87
88 88
|
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
89 89 MEMINFO_PLGRP
90 90 locality group of specified physical address
91 91
92 92
93 93
94 94 All but MEMINFO_VLGRP and MEMINFO_VPAGESIZE require the
95 95 PRIV_PROC_MEMINFO privilege.
96 96
97 97
98 98 RETURN VALUES
99 + All but MEMINFO_VLGRP and MEMINFO_VPAGESIZE require the
100 + PRIV_PROC_MEMINFO privilege.
101 +
102 +
103 +RETURN VALUES
99 104 Upon successful completion meminfo() returns 0. Otherwise -1 is
100 105 returned and errno is set to indicate the error.
101 106
102 107 ERRORS
103 108 The meminfo() function will fail if:
104 109
105 110 EFAULT
106 111 The area pointed to by outdata or validity could not be
107 112 written, or the data pointed to by info_req or inaddr could
108 113 not be read.
109 114
110 115
111 116 EINVAL
112 117 The value of info_count is greater than 31 or less than 1, or
113 118 the value of addr_count is less than 1.
114 119
115 120
116 121 EXAMPLES
117 122 Example 1 Print physical pages and page sizes corresponding to a set of
118 123 virtual addresses.
119 124
120 125
121 126 The following example prints the physical pages and page sizes
122 127 corresponding to a set of virtual addresses.
123 128
124 129
125 130 void
126 131 print_info(void **addrvec, int how_many)
127 132 {
128 133 static const uint_t info[] = {
129 134 MEMINFO_VPHYSICAL,
130 135 MEMINFO_VPAGESIZE
131 136 };
132 137
133 138 int info_num = sizeof (info) / sizeof (info[0]);
134 139 int i;
135 140
136 141 uint64_t *inaddr = alloca(sizeof (uint64_t) * how_many);
137 142 uint64_t *outdata = alloca(sizeof (uint64_t) * how_many * info_num);
138 143 uint_t *validity = alloca(sizeof (uint_t) * how_many);
139 144
140 145 for (i = 0; i < how_many; i++)
141 146 inaddr[i] = (uint64_t)addrvec[i];
142 147
143 148 if (meminfo(inaddr, how_many, info, info_num, outdata,
144 149 validity) < 0) {
145 150 perror("meminfo");
146 151 return;
147 152 }
148 153
149 154 for (i = 0; i < how_many; i++) {
150 155 if ((validity[i] & 1) == 0)
151 156 printf("address 0x%llx not part of address space\n",
152 157 inaddr[i]);
153 158
154 159 else if ((validity[i] & 2) == 0)
155 160 printf("address 0x%llx has no physical page "
156 161 "associated with it\n", inaddr[i]);
157 162
158 163 else {
159 164 char buff[80];
160 165 if ((validity[i] & 4) == 0)
161 166 strcpy(buff, "<Unknown>");
162 167 else
163 168 sprintf(buff, "%lld",
164 169 outdata[i * info_num + 1]);
165 170
166 171 printf("address 0x%llx is backed by physical "
167 172 "page 0x%llx of size %s\n",
168 173 inaddr[i], outdata[i * info_num], buff);
169 174 }
170 175 }
171 176 }
172 177
173 178
174 179 ATTRIBUTES
175 180 See attributes(5) for descriptions of the following attributes:
176 181
177 182
178 183
179 184
180 185 +--------------------+-------------------+
181 186 | ATTRIBUTE TYPE | ATTRIBUTE VALUE |
182 187 +--------------------+-------------------+
183 188 |Interface Stability | Stable |
184 189 +--------------------+-------------------+
185 190 |MT-Level | Async-Signal-Safe |
186 191 +--------------------+-------------------+
187 192
188 193 SEE ALSO
189 194 memcntl(2), mmap(2), gethomelgroup(3C), getpagesize(3C), madvise(3C),
190 195 sysconf(3C), attributes(5), privileges(5)
191 196
192 197
193 198
194 199 March 10, 2015 MEMINFO(2)
|
↓ open down ↓ |
86 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX