home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / mman.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  3.9 KB  |  111 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_MMAN_H
  11. #define _SYS_MMAN_H
  12.  
  13. #ident    "@(#)/usr/include/sys/mman.h.sl 1.1 4.0 12/08/90 19626 AT&T-USL"
  14.  
  15. /*
  16.  * Protections are chosen from these bits, or-ed together.
  17.  * Note - not all implementations literally provide all possible
  18.  * combinations.  PROT_WRITE is often implemented as (PROT_READ |
  19.  * PROT_WRITE) and (PROT_EXECUTE as PROT_READ | PROT_EXECUTE).
  20.  * However, no implementation will permit a write to succeed
  21.  * where PROT_WRITE has not been set.  Also, no implementation will
  22.  * allow any access to succeed where prot is specified as PROT_NONE.
  23.  */
  24. #define    PROT_READ    0x1        /* pages can be read */
  25. #define    PROT_WRITE    0x2        /* pages can be written */
  26. #define    PROT_EXEC    0x4        /* pages can be executed */
  27.  
  28. #ifdef _KERNEL
  29. #define    PROT_USER    0x8        /* pages are user accessable */
  30. #define    PROT_ALL    (PROT_READ | PROT_WRITE | PROT_EXEC | PROT_USER)
  31. #endif /* _KERNEL */
  32.  
  33. #define    PROT_NONE    0x0        /* pages cannot be accessed */
  34.  
  35. /* sharing types:  must choose either SHARED or PRIVATE */
  36. #define    MAP_SHARED    1        /* share changes */
  37. #define    MAP_PRIVATE    2        /* changes are private */
  38. #define    MAP_TYPE    0xf        /* mask for share type */
  39.  
  40. /* other flags to mmap (or-ed in to MAP_SHARED or MAP_PRIVATE) */
  41. #define    MAP_FIXED    0x10        /* user assigns address */
  42.  
  43. /* these flags not yet implemented */
  44. #define    MAP_RENAME    0x20        /* rename private pages to file */
  45. #define    MAP_NORESERVE    0x40        /* don't reserve needed swap area */
  46.  
  47. /* these flags are used by memcntl */
  48. #define PROC_TEXT    (PROT_EXEC | PROT_READ)
  49. #define PROC_DATA    (PROT_READ | PROT_WRITE | PROT_EXEC)
  50. #define SHARED        0x10
  51. #define PRIVATE        0x20
  52.  
  53. #ifdef _KERNEL
  54. #define PROT_EXCL    0x20
  55. #endif /* _KERNEL */
  56.  
  57. #define VALID_ATTR  (PROT_READ|PROT_WRITE|PROT_EXEC|SHARED|PRIVATE)
  58. #ifdef notdef
  59. /*
  60.  * Not clear that this flag will ever be implemented
  61.  */
  62. #define    MAP_INHERIT    0x80        /* inherit this mapping accross exec */
  63. #endif /* notdef */
  64.  
  65. /*
  66.  * For the sake of backward object compatibility, we use the _MAP_NEW flag.
  67.  * This flag will be automatically or'ed in by the C library for all
  68.  * new mmap calls.  Previous binaries with old mmap calls with continue
  69.  * to get 0 or -1 for return values.  New mmap calls will get the mapped
  70.  * address as the return value if successful and -1 on errors.  By default,
  71.  * new mmap calls automatically have the kernel assign the map address
  72.  * unless the MAP_FIXED flag is given.
  73.  */
  74. #define    _MAP_NEW    0x80000000    /* user's should not need to use this */
  75.  
  76. #if !defined(LOCORE) && !defined(_KERNEL)
  77. #include <sys/types.h>
  78.  
  79. /*
  80.  * Except for old binaries mmap() will return the resultant
  81.  * address of mapping on success and (caddr_t)-1 on error.
  82.  */
  83. extern caddr_t mmap();
  84. #endif /* !LOCORE && !_KERNEL */
  85.  
  86. /* advice to madvise */
  87. #define    MADV_NORMAL    0        /* no further special treatment */
  88. #define    MADV_RANDOM    1        /* expect random page references */
  89. #define    MADV_SEQUENTIAL    2        /* expect sequential page references */
  90. #define    MADV_WILLNEED    3        /* will need these pages */
  91. #define    MADV_DONTNEED    4        /* don't need these pages */
  92.  
  93. /* flags to msync */
  94. #define    MS_SYNC        0x0        /* wait for msync */
  95. #define    MS_ASYNC    0x1        /* return immediately */
  96. #define    MS_INVALIDATE    0x2        /* invalidate caches */
  97.  
  98. /* functions to mctl */
  99. #define    MC_SYNC        1        /* sync with backing store */
  100. #define    MC_LOCK        2        /* lock pages in memory */
  101. #define    MC_UNLOCK    3        /* unlock pages from memory */
  102. #define    MC_ADVISE    4        /* give advice to management */
  103. #define    MC_LOCKAS    5        /* lock address space in memory */
  104. #define    MC_UNLOCKAS    6        /* unlock address space from memory */
  105.  
  106. /* flags to mlockall */
  107. #define    MCL_CURRENT    0x1        /* lock current mappings */
  108. #define    MCL_FUTURE    0x2        /* lock future mappings */
  109.  
  110. #endif    /* _SYS_MMAN_H */
  111.