Blame misc/sys/mman.h

Packit 6c4009
/* Definitions for BSD-style memory management.
Packit 6c4009
   Copyright (C) 1994-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef	_SYS_MMAN_H
Packit 6c4009
#define	_SYS_MMAN_H	1
Packit 6c4009
Packit 6c4009
#include <features.h>
Packit 6c4009
#include <bits/types.h>
Packit 6c4009
#define __need_size_t
Packit 6c4009
#include <stddef.h>
Packit 6c4009
Packit 6c4009
#ifndef __off_t_defined
Packit 6c4009
# ifndef __USE_FILE_OFFSET64
Packit 6c4009
typedef __off_t off_t;
Packit 6c4009
# else
Packit 6c4009
typedef __off64_t off_t;
Packit 6c4009
# endif
Packit 6c4009
# define __off_t_defined
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifndef __mode_t_defined
Packit 6c4009
typedef __mode_t mode_t;
Packit 6c4009
# define __mode_t_defined
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#include <bits/mman.h>
Packit 6c4009
Packit 6c4009
/* Return value of `mmap' in case of an error.  */
Packit 6c4009
#define MAP_FAILED	((void *) -1)
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
/* Map addresses starting near ADDR and extending for LEN bytes.  from
Packit 6c4009
   OFFSET into the file FD describes according to PROT and FLAGS.  If ADDR
Packit 6c4009
   is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
Packit 6c4009
   set in FLAGS, the mapping will be at ADDR exactly (which must be
Packit 6c4009
   page-aligned); otherwise the system chooses a convenient nearby address.
Packit 6c4009
   The return value is the actual mapping address chosen or MAP_FAILED
Packit 6c4009
   for errors (in which case `errno' is set).  A successful `mmap' call
Packit 6c4009
   deallocates any previous mapping for the affected region.  */
Packit 6c4009
Packit 6c4009
#ifndef __USE_FILE_OFFSET64
Packit 6c4009
extern void *mmap (void *__addr, size_t __len, int __prot,
Packit 6c4009
		   int __flags, int __fd, __off_t __offset) __THROW;
Packit 6c4009
#else
Packit 6c4009
# ifdef __REDIRECT_NTH
Packit 6c4009
extern void * __REDIRECT_NTH (mmap,
Packit 6c4009
			      (void *__addr, size_t __len, int __prot,
Packit 6c4009
			       int __flags, int __fd, __off64_t __offset),
Packit 6c4009
			      mmap64);
Packit 6c4009
# else
Packit 6c4009
#  define mmap mmap64
Packit 6c4009
# endif
Packit 6c4009
#endif
Packit 6c4009
#ifdef __USE_LARGEFILE64
Packit 6c4009
extern void *mmap64 (void *__addr, size_t __len, int __prot,
Packit 6c4009
		     int __flags, int __fd, __off64_t __offset) __THROW;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Deallocate any mapping for the region starting at ADDR and extending LEN
Packit 6c4009
   bytes.  Returns 0 if successful, -1 for errors (and sets errno).  */
Packit 6c4009
extern int munmap (void *__addr, size_t __len) __THROW;
Packit 6c4009
Packit 6c4009
/* Change the memory protection of the region starting at ADDR and
Packit 6c4009
   extending LEN bytes to PROT.  Returns 0 if successful, -1 for errors
Packit 6c4009
   (and sets errno).  */
Packit 6c4009
extern int mprotect (void *__addr, size_t __len, int __prot) __THROW;
Packit 6c4009
Packit 6c4009
/* Synchronize the region starting at ADDR and extending LEN bytes with the
Packit 6c4009
   file it maps.  Filesystem operations on a file being mapped are
Packit 6c4009
   unpredictable before this is done.  Flags are from the MS_* set.
Packit 6c4009
Packit 6c4009
   This function is a cancellation point and therefore not marked with
Packit 6c4009
   __THROW.  */
Packit 6c4009
extern int msync (void *__addr, size_t __len, int __flags);
Packit 6c4009
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
/* Advise the system about particular usage patterns the program follows
Packit 6c4009
   for the region starting at ADDR and extending LEN bytes.  */
Packit 6c4009
extern int madvise (void *__addr, size_t __len, int __advice) __THROW;
Packit 6c4009
#endif
Packit 6c4009
#ifdef __USE_XOPEN2K
Packit 6c4009
/* This is the POSIX name for this function.  */
Packit 6c4009
extern int posix_madvise (void *__addr, size_t __len, int __advice) __THROW;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
Packit 6c4009
   be memory resident.  */
Packit 6c4009
extern int mlock (const void *__addr, size_t __len) __THROW;
Packit 6c4009
Packit 6c4009
/* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN).  */
Packit 6c4009
extern int munlock (const void *__addr, size_t __len) __THROW;
Packit 6c4009
Packit 6c4009
/* Cause all currently mapped pages of the process to be memory resident
Packit 6c4009
   until unlocked by a call to the `munlockall', until the process exits,
Packit 6c4009
   or until the process calls `execve'.  */
Packit 6c4009
extern int mlockall (int __flags) __THROW;
Packit 6c4009
Packit 6c4009
/* All currently mapped pages of the process' address space become
Packit 6c4009
   unlocked.  */
Packit 6c4009
extern int munlockall (void) __THROW;
Packit 6c4009
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
/* mincore returns the memory residency status of the pages in the
Packit 6c4009
   current process's address space specified by [start, start + len).
Packit 6c4009
   The status is returned in a vector of bytes.  The least significant
Packit 6c4009
   bit of each byte is 1 if the referenced page is in memory, otherwise
Packit 6c4009
   it is zero.  */
Packit 6c4009
extern int mincore (void *__start, size_t __len, unsigned char *__vec)
Packit 6c4009
     __THROW;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
/* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length
Packit 6c4009
   NEW_LEN.  If MREMAP_MAYMOVE is set in FLAGS the returned address
Packit 6c4009
   may differ from ADDR.  If MREMAP_FIXED is set in FLAGS the function
Packit 6c4009
   takes another parameter which is a fixed address at which the block
Packit 6c4009
   resides after a successful call.  */
Packit 6c4009
extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
Packit 6c4009
		     int __flags, ...) __THROW;
Packit 6c4009
Packit 6c4009
/* Remap arbitrary pages of a shared backing store within an existing
Packit 6c4009
   VMA.  */
Packit 6c4009
extern int remap_file_pages (void *__start, size_t __size, int __prot,
Packit 6c4009
			     size_t __pgoff, int __flags) __THROW;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Open shared memory segment.  */
Packit 6c4009
extern int shm_open (const char *__name, int __oflag, mode_t __mode);
Packit 6c4009
Packit 6c4009
/* Remove shared memory segment.  */
Packit 6c4009
extern int shm_unlink (const char *__name);
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif	/* sys/mman.h */