gonzui


Format: Advanced Search

t2ex/bsd_source/lib/libc/src_bsd/include/sys/mman.hbare sourcepermlink (0.01 seconds)

Search this content:

    1: /*      $OpenBSD: mman.h,v 1.21 2010/07/04 20:16:41 guenther 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: #ifndef _KERNEL
   36: #include <sys/cdefs.h>
   37: #endif
   38: 
   39: /*
   40:  * Protections are chosen from these bits, or-ed together
   41:  */
   42: #define PROT_NONE       0x00  /* no permissions */
   43: #define PROT_READ       0x01  /* pages can be read */
   44: #define PROT_WRITE      0x02 /* pages can be written */
   45: #define PROT_EXEC       0x04  /* pages can be executed */
   46: 
   47: /*
   48:  * Flags contain sharing type and options.
   49:  * Sharing types; choose one.
   50:  */
   51: #define MAP_SHARED      0x0001       /* share changes */
   52: #define MAP_PRIVATE     0x0002      /* changes are private */
   53: #define MAP_COPY        0x0004 /* "copy" region at mmap time */
   54: 
   55: /*
   56:  * Other flags
   57:  */
   58: #define MAP_FIXED        0x0010       /* map addr must be exactly as requested */
   59: #define MAP_RENAME       0x0020      /* Sun: rename private pages to file */
   60: #define MAP_NORESERVE    0x0040   /* Sun: don't reserve needed swap area */
   61: #define MAP_INHERIT      0x0080     /* region is retained after exec */
   62: #define MAP_NOEXTEND     0x0100    /* for MAP_FILE, don't change file size */
   63: #define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
   64: #define MAP_TRYFIXED     0x0400 /* attempt hint address, even within heap */
   65: 
   66: /*
   67:  * Error return from mmap()
   68:  */
   69: #define MAP_FAILED      ((void *)-1)
   70: 
   71: /*
   72:  * Mapping type
   73:  */
   74: #define MAP_FILE        0x0000 /* map from file (default) */
   75: #define MAP_ANON        0x1000 /* allocated from memory, swap space */
   76: #define MAP_FLAGMASK    0x17f7
   77: 
   78: /*
   79:  * POSIX memory advisory values.
   80:  * Note: keep consistent with the original definitions below.
   81:  */
   82: #define POSIX_MADV_NORMAL       0     /* no further special treatment */
   83: #define POSIX_MADV_RANDOM       1     /* expect random page references */
   84: #define POSIX_MADV_SEQUENTIAL   2 /* expect sequential page references */
   85: #define POSIX_MADV_WILLNEED     3   /* will need these pages */
   86: #define POSIX_MADV_DONTNEED     4   /* don't need these pages */
   87: 
   88: #if __BSD_VISIBLE
   89: /*
   90:  * Original advice values, equivalent to POSIX definitions,
   91:  * and few implementation-specific ones.
   92:  */
   93: #define MADV_NORMAL             POSIX_MADV_NORMAL
   94: #define MADV_RANDOM             POSIX_MADV_RANDOM
   95: #define MADV_SEQUENTIAL         POSIX_MADV_SEQUENTIAL
   96: #define MADV_WILLNEED           POSIX_MADV_WILLNEED
   97: #define MADV_DONTNEED           POSIX_MADV_DONTNEED
   98: #define MADV_SPACEAVAIL         5      /* insure that resources are reserved */
   99: #define MADV_FREE               6    /* pages are empty, free them */
  100: #endif
  101: 
  102: /*
  103:  * Flags to minherit
  104:  */
  105: #define MAP_INHERIT_SHARE       0     /* share with child */
  106: #define MAP_INHERIT_COPY        1      /* copy into child */
  107: #define MAP_INHERIT_NONE        2      /* absent from child */
  108: #define MAP_INHERIT_DONATE_COPY 3       /* copy and delete -- not
  109:                                            implemented in UVM */
  110: 
  111: /*
  112:  * Flags to msync
  113:  */
  114: #define MS_ASYNC        0x01   /* perform asynchronous writes */
  115: #define MS_SYNC         0x02   /* perform synchronous writes */
  116: #define MS_INVALIDATE   0x04      /* invalidate cached data */
  117: 
  118: /*
  119:  * Flags to mlockall
  120:  */
  121: #define MCL_CURRENT     0x01        /* lock all pages currently mapped */
  122: #define MCL_FUTURE      0x02 /* lock all pages mapped in the future */
  123: 
  124: #ifndef _KERNEL
  125: #include <sys/_types.h>
  126: 
  127: #ifndef _SIZE_T_DEFINED_
  128: #define _SIZE_T_DEFINED_
  129: typedef __size_t        size_t;
  130: #endif
  131: 
  132: #ifndef _OFF_T_DEFINED_
  133: #define _OFF_T_DEFINED_
  134: typedef __off_t         off_t;
  135: #endif
  136: 
  137: __BEGIN_DECLS
  138: void *  mmap(void *, size_t, int, int, int, off_t);
  139: int     mprotect(void *, size_t, int);
  140: int     munmap(void *, size_t);
  141: int     msync(void *, size_t, int);
  142: int     mlock(const void *, size_t);
  143: int     munlock(const void *, size_t);
  144: int     mlockall(int);
  145: int     munlockall(void);
  146: #if __BSD_VISIBLE
  147: int     madvise(void *, size_t, int);
  148: int     mincore(void *, size_t, char *);
  149: int     minherit(void *, size_t, int);
  150: void *  mquery(void *, size_t, int, int, int, off_t);
  151: #endif
  152: int     posix_madvise(void *, size_t, int);
  153: __END_DECLS
  154: 
  155: #endif /* !_KERNEL */