modernc.org/cc@v1.0.1/v2/headers/linux_386/usr/include/i386-linux-gnu/sys/mman.h (about)

     1  /* Definitions for BSD-style memory management.
     2     Copyright (C) 1994-2018 Free Software Foundation, Inc.
     3     This file is part of the GNU C Library.
     4  
     5     The GNU C Library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9  
    10     The GNU C Library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14  
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with the GNU C Library; if not, see
    17     <http://www.gnu.org/licenses/>.  */
    18  
    19  #ifndef	_SYS_MMAN_H
    20  #define	_SYS_MMAN_H	1
    21  
    22  #include <features.h>
    23  #include <bits/types.h>
    24  #define __need_size_t
    25  #include <stddef.h>
    26  
    27  #ifndef __off_t_defined
    28  # ifndef __USE_FILE_OFFSET64
    29  typedef __off_t off_t;
    30  # else
    31  typedef __off64_t off_t;
    32  # endif
    33  # define __off_t_defined
    34  #endif
    35  
    36  #ifndef __mode_t_defined
    37  typedef __mode_t mode_t;
    38  # define __mode_t_defined
    39  #endif
    40  
    41  #include <bits/mman.h>
    42  
    43  /* Return value of `mmap' in case of an error.  */
    44  #define MAP_FAILED	((void *) -1)
    45  
    46  __BEGIN_DECLS
    47  /* Map addresses starting near ADDR and extending for LEN bytes.  from
    48     OFFSET into the file FD describes according to PROT and FLAGS.  If ADDR
    49     is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
    50     set in FLAGS, the mapping will be at ADDR exactly (which must be
    51     page-aligned); otherwise the system chooses a convenient nearby address.
    52     The return value is the actual mapping address chosen or MAP_FAILED
    53     for errors (in which case `errno' is set).  A successful `mmap' call
    54     deallocates any previous mapping for the affected region.  */
    55  #ifndef __USE_FILE_OFFSET64
    56  extern void *mmap(void *__addr, size_t __len, int __prot, int __flags, int __fd, __off_t __offset) __THROW;
    57  #else
    58  # ifdef __REDIRECT_NTH
    59  extern void *__REDIRECT_NTH(mmap, (void *__addr, size_t __len, int __prot, int __flags, int __fd, __off64_t __offset), mmap64);
    60  # else
    61  #  define mmap mmap64
    62  # endif
    63  #endif
    64  #ifdef __USE_LARGEFILE64
    65  extern void *mmap64(void *__addr, size_t __len, int __prot, int __flags, int __fd, __off64_t __offset) __THROW;
    66  #endif
    67  
    68  /* Deallocate any mapping for the region starting at ADDR and extending LEN
    69     bytes.  Returns 0 if successful, -1 for errors (and sets errno).  */
    70  extern int munmap(void *__addr, size_t __len) __THROW;
    71  
    72  /* Change the memory protection of the region starting at ADDR and
    73     extending LEN bytes to PROT.  Returns 0 if successful, -1 for errors
    74     (and sets errno).  */
    75  extern int mprotect(void *__addr, size_t __len, int __prot) __THROW;
    76  
    77  /* Synchronize the region starting at ADDR and extending LEN bytes with the
    78     file it maps.  Filesystem operations on a file being mapped are
    79     unpredictable before this is done.  Flags are from the MS_* set.
    80  
    81     This function is a cancellation point and therefore not marked with
    82     __THROW.  */
    83  extern int msync(void *__addr, size_t __len, int __flags);
    84  
    85  #ifdef __USE_MISC
    86  /* Advise the system about particular usage patterns the program follows
    87     for the region starting at ADDR and extending LEN bytes.  */
    88  extern int madvise(void *__addr, size_t __len, int __advice) __THROW;
    89  #endif
    90  #ifdef __USE_XOPEN2K
    91  /* This is the POSIX name for this function.  */
    92  extern int posix_madvise(void *__addr, size_t __len, int __advice) __THROW;
    93  #endif
    94  
    95  /* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
    96     be memory resident.  */
    97  extern int mlock(const void *__addr, size_t __len) __THROW;
    98  
    99  /* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN).  */
   100  extern int munlock(const void *__addr, size_t __len) __THROW;
   101  
   102  /* Cause all currently mapped pages of the process to be memory resident
   103     until unlocked by a call to the `munlockall', until the process exits,
   104     or until the process calls `execve'.  */
   105  extern int mlockall(int __flags) __THROW;
   106  
   107  /* All currently mapped pages of the process' address space become
   108     unlocked.  */
   109  extern int munlockall(void) __THROW;
   110  
   111  #ifdef __USE_MISC
   112  /* mincore returns the memory residency status of the pages in the
   113     current process's address space specified by [start, start + len).
   114     The status is returned in a vector of bytes.  The least significant
   115     bit of each byte is 1 if the referenced page is in memory, otherwise
   116     it is zero.  */
   117  extern int mincore(void *__start, size_t __len, unsigned char *__vec) __THROW;
   118  #endif
   119  
   120  #ifdef __USE_GNU
   121  /* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length
   122     NEW_LEN.  If MREMAP_MAYMOVE is set in FLAGS the returned address
   123     may differ from ADDR.  If MREMAP_FIXED is set in FLAGS the function
   124     takes another parameter which is a fixed address at which the block
   125     resides after a successful call.  */
   126  extern void *mremap(void *__addr, size_t __old_len, size_t __new_len, int __flags, ...) __THROW;
   127  
   128  /* Remap arbitrary pages of a shared backing store within an existing
   129     VMA.  */
   130  extern int remap_file_pages(void *__start, size_t __size, int __prot, size_t __pgoff, int __flags) __THROW;
   131  #endif
   132  
   133  /* Open shared memory segment.  */
   134  extern int shm_open(const char *__name, int __oflag, mode_t __mode);
   135  
   136  /* Remove shared memory segment.  */
   137  extern int shm_unlink(const char *__name);
   138  
   139  __END_DECLS
   140  #endif				/* sys/mman.h */