4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /* Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved. */
23 /*
24 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
30
31 /*
32 * University Copyright- Copyright (c) 1982, 1986, 1988
33 * The Regents of the University of California
34 * All Rights Reserved
35 *
36 * University Acknowledgment- Portions of this document are derived from
37 * software developed by the University of California, Berkeley, and its
38 * contributors.
39 */
40
41 #ifndef _SYS_MMAN_H
42 #define _SYS_MMAN_H
43
204 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
205
206 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
207 #ifdef __PRAGMA_REDEFINE_EXTNAME
208 #pragma redefine_extname mmap64 mmap
209 #else
210 #define mmap64 mmap
211 #endif
212 #endif /* _LP64 && _LARGEFILE64_SOURCE */
213
214 #ifdef __PRAGMA_REDEFINE_EXTNAME
215 #pragma redefine_extname getpagesizes getpagesizes2
216 #else
217 #define getpagesizes getpagesizes2
218 #endif
219
220 /*
221 * Except for old binaries mmap() will return the resultant
222 * address of mapping on success and (caddr_t)-1 on error.
223 */
224 #ifdef __STDC__
225 #if (_POSIX_C_SOURCE > 2) || defined(_XPG4_2)
226 extern void *mmap(void *, size_t, int, int, int, off_t);
227 extern int munmap(void *, size_t);
228 extern int mprotect(void *, size_t, int);
229 extern int msync(void *, size_t, int);
230 #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__)
231 extern int mlock(const void *, size_t);
232 extern int munlock(const void *, size_t);
233 #endif /* (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2))... */
234 /* transitional large file interface version */
235 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
236 !defined(__PRAGMA_REDEFINE_EXTNAME))
237 extern void *mmap64(void *, size_t, int, int, int, off64_t);
238 #endif /* _LARGEFILE64_SOURCE... */
239 #else /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */
240 extern caddr_t mmap(caddr_t, size_t, int, int, int, off_t);
241 extern int munmap(caddr_t, size_t);
242 extern int mprotect(caddr_t, size_t, int);
243 extern int msync(caddr_t, size_t, int);
244 extern int mlock(caddr_t, size_t);
259 /* transitional large file interface version */
260 #ifdef _LARGEFILE64_SOURCE
261 extern caddr_t mmap64(caddr_t, size_t, int, int, int, off64_t);
262 #endif
263 #endif /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */
264
265 #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__)
266 extern int mlockall(int);
267 extern int munlockall(void);
268 extern int shm_open(const char *, int, mode_t);
269 extern int shm_unlink(const char *);
270 #endif
271
272 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
273 extern int posix_madvise(void *, size_t, int);
274 #endif
275
276 /* mmap failure value */
277 #define MAP_FAILED ((void *) -1)
278
279 #else /* __STDC__ */
280 extern caddr_t mmap();
281 extern int munmap();
282 extern int mmapobj();
283 extern int mprotect();
284 extern int mincore();
285 extern int memcntl();
286 extern int msync();
287 extern int madvise();
288 extern int posix_madvise();
289 extern int getpagesizes();
290 extern int getpagesizes2();
291 extern int mlock();
292 extern int mlockall();
293 extern int munlock();
294 extern int munlockall();
295 extern int meminfo();
296 extern int shm_open();
297 extern int shm_unlink();
298
299 /* transitional large file interface version */
300 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
301 !defined(__PRAGMA_REDEFINE_EXTNAME))
302 extern caddr_t mmap64();
303 #endif /* _LARGEFILE64_SOURCE... */
304 #endif /* __STDC__ */
305
306
307 #endif /* !_ASM && !_KERNEL */
308
309 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
310 #if !defined(_ASM)
311 /*
312 * structure for memcntl hat advise operations.
313 */
314 struct memcntl_mha {
315 uint_t mha_cmd; /* command(s) */
316 uint_t mha_flags;
317 size_t mha_pagesize;
318 };
319
320 #if defined(_SYSCALL32)
321 struct memcntl_mha32 {
322 uint_t mha_cmd; /* command(s) */
323 uint_t mha_flags;
324 size32_t mha_pagesize;
325 };
326 #endif /* _SYSCALL32 */
371 #define MHA_MAPSIZE_VA 0x1 /* set preferred page size */
372 #define MHA_MAPSIZE_BSSBRK 0x2 /* set preferred page size */
373 /* for last bss adjacent to */
374 /* brk area and brk area itself */
375 #define MHA_MAPSIZE_STACK 0x4 /* set preferred page size */
376 /* processes main stack */
377
378 #endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) ... */
379
380 #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__)
381 /* flags to mlockall */
382 #define MCL_CURRENT 0x1 /* lock current mappings */
383 #define MCL_FUTURE 0x2 /* lock future mappings */
384 #endif /* (!defined(_XPG4_2) || (_POSIX_C_SOURCE)) || defined(__EXTENSIONS__) */
385
386 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
387
388 /* definitions for meminfosys syscall */
389 #define MISYS_MEMINFO 0x0
390
391 #if !defined(_ASM) && defined(__STDC__)
392
393 #if defined(_INT64_TYPE)
394 /* private structure for meminfo */
395 typedef struct meminfo {
396 const uint64_t *mi_inaddr; /* array of input addresses */
397 const uint_t *mi_info_req; /* array of types of info requested */
398 uint64_t *mi_outdata; /* array of results are placed */
399 uint_t *mi_validity; /* array of bitwise result codes */
400 int mi_info_count; /* number of pieces of info requested */
401 } meminfo_t;
402 #endif /* defined(_INT64_TYPE) */
403
404 #if defined(_SYSCALL32)
405 typedef struct meminfo32 {
406 caddr32_t mi_inaddr; /* array of input addresses */
407 caddr32_t mi_info_req; /* array of types of information requested */
408 caddr32_t mi_outdata; /* array of results are placed */
409 caddr32_t mi_validity; /* array of bitwise result codes */
410 int32_t mi_info_count; /* number of pieces of information requested */
411 } meminfo32_t;
412 #endif /* defined(_SYSCALL32) */
413
414 #endif /* !defined(_ASM) && defined(__STDC__) */
415
416 /*
417 * info_req request type definitions for meminfo
418 * request types starting with MEMINFO_V are used for Virtual addresses
419 * and should not be mixed with MEMINFO_PLGRP which is targeted for Physical
420 * addresses
421 */
422 #define MEMINFO_SHIFT 16
423 #define MEMINFO_MASK (0xFF << MEMINFO_SHIFT)
424 #define MEMINFO_VPHYSICAL (0x01 << MEMINFO_SHIFT) /* get physical addr */
425 #define MEMINFO_VLGRP (0x02 << MEMINFO_SHIFT) /* get lgroup */
426 #define MEMINFO_VPAGESIZE (0x03 << MEMINFO_SHIFT) /* size of phys page */
427 #define MEMINFO_VREPLCNT (0x04 << MEMINFO_SHIFT) /* no. of replica */
428 #define MEMINFO_VREPL (0x05 << MEMINFO_SHIFT) /* physical replica */
429 #define MEMINFO_VREPL_LGRP (0x06 << MEMINFO_SHIFT) /* lgrp of replica */
430 #define MEMINFO_PLGRP (0x07 << MEMINFO_SHIFT) /* lgroup for paddr */
431
432 /* maximum number of addresses meminfo() can process at a time */
433 #define MAX_MEMINFO_CNT 256
434
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /* Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved. */
23 /*
24 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
25 *
26 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
31 /* All Rights Reserved */
32
33 /*
34 * University Copyright- Copyright (c) 1982, 1986, 1988
35 * The Regents of the University of California
36 * All Rights Reserved
37 *
38 * University Acknowledgment- Portions of this document are derived from
39 * software developed by the University of California, Berkeley, and its
40 * contributors.
41 */
42
43 #ifndef _SYS_MMAN_H
44 #define _SYS_MMAN_H
45
206 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
207
208 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
209 #ifdef __PRAGMA_REDEFINE_EXTNAME
210 #pragma redefine_extname mmap64 mmap
211 #else
212 #define mmap64 mmap
213 #endif
214 #endif /* _LP64 && _LARGEFILE64_SOURCE */
215
216 #ifdef __PRAGMA_REDEFINE_EXTNAME
217 #pragma redefine_extname getpagesizes getpagesizes2
218 #else
219 #define getpagesizes getpagesizes2
220 #endif
221
222 /*
223 * Except for old binaries mmap() will return the resultant
224 * address of mapping on success and (caddr_t)-1 on error.
225 */
226 #if (_POSIX_C_SOURCE > 2) || defined(_XPG4_2)
227 extern void *mmap(void *, size_t, int, int, int, off_t);
228 extern int munmap(void *, size_t);
229 extern int mprotect(void *, size_t, int);
230 extern int msync(void *, size_t, int);
231 #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__)
232 extern int mlock(const void *, size_t);
233 extern int munlock(const void *, size_t);
234 #endif /* (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2))... */
235 /* transitional large file interface version */
236 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
237 !defined(__PRAGMA_REDEFINE_EXTNAME))
238 extern void *mmap64(void *, size_t, int, int, int, off64_t);
239 #endif /* _LARGEFILE64_SOURCE... */
240 #else /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */
241 extern caddr_t mmap(caddr_t, size_t, int, int, int, off_t);
242 extern int munmap(caddr_t, size_t);
243 extern int mprotect(caddr_t, size_t, int);
244 extern int msync(caddr_t, size_t, int);
245 extern int mlock(caddr_t, size_t);
260 /* transitional large file interface version */
261 #ifdef _LARGEFILE64_SOURCE
262 extern caddr_t mmap64(caddr_t, size_t, int, int, int, off64_t);
263 #endif
264 #endif /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */
265
266 #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__)
267 extern int mlockall(int);
268 extern int munlockall(void);
269 extern int shm_open(const char *, int, mode_t);
270 extern int shm_unlink(const char *);
271 #endif
272
273 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
274 extern int posix_madvise(void *, size_t, int);
275 #endif
276
277 /* mmap failure value */
278 #define MAP_FAILED ((void *) -1)
279
280
281 #endif /* !_ASM && !_KERNEL */
282
283 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
284 #if !defined(_ASM)
285 /*
286 * structure for memcntl hat advise operations.
287 */
288 struct memcntl_mha {
289 uint_t mha_cmd; /* command(s) */
290 uint_t mha_flags;
291 size_t mha_pagesize;
292 };
293
294 #if defined(_SYSCALL32)
295 struct memcntl_mha32 {
296 uint_t mha_cmd; /* command(s) */
297 uint_t mha_flags;
298 size32_t mha_pagesize;
299 };
300 #endif /* _SYSCALL32 */
345 #define MHA_MAPSIZE_VA 0x1 /* set preferred page size */
346 #define MHA_MAPSIZE_BSSBRK 0x2 /* set preferred page size */
347 /* for last bss adjacent to */
348 /* brk area and brk area itself */
349 #define MHA_MAPSIZE_STACK 0x4 /* set preferred page size */
350 /* processes main stack */
351
352 #endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) ... */
353
354 #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__)
355 /* flags to mlockall */
356 #define MCL_CURRENT 0x1 /* lock current mappings */
357 #define MCL_FUTURE 0x2 /* lock future mappings */
358 #endif /* (!defined(_XPG4_2) || (_POSIX_C_SOURCE)) || defined(__EXTENSIONS__) */
359
360 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
361
362 /* definitions for meminfosys syscall */
363 #define MISYS_MEMINFO 0x0
364
365 #if !defined(_ASM)
366
367 #if defined(_INT64_TYPE)
368 /* private structure for meminfo */
369 typedef struct meminfo {
370 const uint64_t *mi_inaddr; /* array of input addresses */
371 const uint_t *mi_info_req; /* array of types of info requested */
372 uint64_t *mi_outdata; /* array of results are placed */
373 uint_t *mi_validity; /* array of bitwise result codes */
374 int mi_info_count; /* number of pieces of info requested */
375 } meminfo_t;
376 #endif /* defined(_INT64_TYPE) */
377
378 #if defined(_SYSCALL32)
379 typedef struct meminfo32 {
380 caddr32_t mi_inaddr; /* array of input addresses */
381 caddr32_t mi_info_req; /* array of types of information requested */
382 caddr32_t mi_outdata; /* array of results are placed */
383 caddr32_t mi_validity; /* array of bitwise result codes */
384 int32_t mi_info_count; /* number of pieces of information requested */
385 } meminfo32_t;
386 #endif /* defined(_SYSCALL32) */
387
388 #endif /* !defined(_ASM) */
389
390 /*
391 * info_req request type definitions for meminfo
392 * request types starting with MEMINFO_V are used for Virtual addresses
393 * and should not be mixed with MEMINFO_PLGRP which is targeted for Physical
394 * addresses
395 */
396 #define MEMINFO_SHIFT 16
397 #define MEMINFO_MASK (0xFF << MEMINFO_SHIFT)
398 #define MEMINFO_VPHYSICAL (0x01 << MEMINFO_SHIFT) /* get physical addr */
399 #define MEMINFO_VLGRP (0x02 << MEMINFO_SHIFT) /* get lgroup */
400 #define MEMINFO_VPAGESIZE (0x03 << MEMINFO_SHIFT) /* size of phys page */
401 #define MEMINFO_VREPLCNT (0x04 << MEMINFO_SHIFT) /* no. of replica */
402 #define MEMINFO_VREPL (0x05 << MEMINFO_SHIFT) /* physical replica */
403 #define MEMINFO_VREPL_LGRP (0x06 << MEMINFO_SHIFT) /* lgrp of replica */
404 #define MEMINFO_PLGRP (0x07 << MEMINFO_SHIFT) /* lgroup for paddr */
405
406 /* maximum number of addresses meminfo() can process at a time */
407 #define MAX_MEMINFO_CNT 256
408
|