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