Annotation of sys/sys/mman.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: mman.h,v 1.18 2003/07/21 22:52:19 tedu Exp $ */
! 2: /* $NetBSD: mman.h,v 1.11 1995/03/26 20:24:23 jtc Exp $ */
! 3:
! 4: /*-
! 5: * Copyright (c) 1982, 1986, 1993
! 6: * The Regents of the University of California. All rights reserved.
! 7: *
! 8: * Redistribution and use in source and binary forms, with or without
! 9: * modification, are permitted provided that the following conditions
! 10: * are met:
! 11: * 1. Redistributions of source code must retain the above copyright
! 12: * notice, this list of conditions and the following disclaimer.
! 13: * 2. Redistributions in binary form must reproduce the above copyright
! 14: * notice, this list of conditions and the following disclaimer in the
! 15: * documentation and/or other materials provided with the distribution.
! 16: * 3. Neither the name of the University nor the names of its contributors
! 17: * may be used to endorse or promote products derived from this software
! 18: * without specific prior written permission.
! 19: *
! 20: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 21: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 22: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 23: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 24: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 25: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 26: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 27: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 28: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 29: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 30: * SUCH DAMAGE.
! 31: *
! 32: * @(#)mman.h 8.1 (Berkeley) 6/2/93
! 33: */
! 34:
! 35: /*
! 36: * Protections are chosen from these bits, or-ed together
! 37: */
! 38: #define PROT_NONE 0x00 /* no permissions */
! 39: #define PROT_READ 0x01 /* pages can be read */
! 40: #define PROT_WRITE 0x02 /* pages can be written */
! 41: #define PROT_EXEC 0x04 /* pages can be executed */
! 42:
! 43: /*
! 44: * Flags contain sharing type and options.
! 45: * Sharing types; choose one.
! 46: */
! 47: #define MAP_SHARED 0x0001 /* share changes */
! 48: #define MAP_PRIVATE 0x0002 /* changes are private */
! 49: #define MAP_COPY 0x0004 /* "copy" region at mmap time */
! 50:
! 51: /*
! 52: * Other flags
! 53: */
! 54: #define MAP_FIXED 0x0010 /* map addr must be exactly as requested */
! 55: #define MAP_RENAME 0x0020 /* Sun: rename private pages to file */
! 56: #define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */
! 57: #define MAP_INHERIT 0x0080 /* region is retained after exec */
! 58: #define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */
! 59: #define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
! 60: #define MAP_TRYFIXED 0x0400 /* attempt hint address, even within heap */
! 61:
! 62: /*
! 63: * Error return from mmap()
! 64: */
! 65: #define MAP_FAILED ((void *)-1)
! 66:
! 67: /*
! 68: * Mapping type
! 69: */
! 70: #define MAP_FILE 0x0000 /* map from file (default) */
! 71: #define MAP_ANON 0x1000 /* allocated from memory, swap space */
! 72: #define MAP_FLAGMASK 0x17f7
! 73:
! 74: /*
! 75: * Advice to madvise
! 76: */
! 77: #define MADV_NORMAL 0 /* no further special treatment */
! 78: #define MADV_RANDOM 1 /* expect random page references */
! 79: #define MADV_SEQUENTIAL 2 /* expect sequential page references */
! 80: #define MADV_WILLNEED 3 /* will need these pages */
! 81: #define MADV_DONTNEED 4 /* dont need these pages */
! 82: #define MADV_SPACEAVAIL 5 /* insure that resources are reserved */
! 83: #define MADV_FREE 6 /* pages are empty, free them */
! 84:
! 85: /*
! 86: * Flags to minherit
! 87: */
! 88: #define MAP_INHERIT_SHARE 0 /* share with child */
! 89: #define MAP_INHERIT_COPY 1 /* copy into child */
! 90: #define MAP_INHERIT_NONE 2 /* absent from child */
! 91: #define MAP_INHERIT_DONATE_COPY 3 /* copy and delete -- not
! 92: implemented in UVM */
! 93:
! 94: /*
! 95: * Flags to msync
! 96: */
! 97: #define MS_ASYNC 0x01 /* perform asynchronous writes */
! 98: #define MS_SYNC 0x02 /* perform synchronous writes */
! 99: #define MS_INVALIDATE 0x04 /* invalidate cached data */
! 100:
! 101: /*
! 102: * Flags to mlockall
! 103: */
! 104: #define MCL_CURRENT 0x01 /* lock all pages currently mapped */
! 105: #define MCL_FUTURE 0x02 /* lock all pages mapped in the future */
! 106:
! 107: #ifndef _KERNEL
! 108:
! 109: #include <sys/cdefs.h>
! 110:
! 111: __BEGIN_DECLS
! 112: /* Some of these int's should probably be size_t's */
! 113: void * mmap(void *, size_t, int, int, int, off_t);
! 114: int mprotect(void *, size_t, int);
! 115: int munmap(void *, size_t);
! 116: int msync(void *, size_t, int);
! 117: int mlock(const void *, size_t);
! 118: int munlock(const void *, size_t);
! 119: int mlockall(int);
! 120: int munlockall(void);
! 121: int madvise(void *, size_t, int);
! 122: int mincore(void *, size_t, char *);
! 123: int minherit(void *, size_t, int);
! 124: void * mquery(void *, size_t, int, int, int, off_t);
! 125: __END_DECLS
! 126:
! 127: #endif /* !_KERNEL */
CVSweb