Blame bits/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
/* These are the bits used by 4.4 BSD and its derivatives.  On systems
Packit 6c4009
   (such as GNU) where these facilities are not system services but can be
Packit 6c4009
   emulated in the C library, these are the definitions we emulate.  */
Packit 6c4009
Packit 6c4009
#ifndef _SYS_MMAN_H
Packit 6c4009
# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Protections are chosen from these bits, OR'd together.  The
Packit 6c4009
   implementation does not necessarily support PROT_EXEC or PROT_WRITE
Packit 6c4009
   without PROT_READ.  The only guarantees are that no writing will be
Packit 6c4009
   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
Packit 6c4009
Packit 6c4009
#define	PROT_NONE	 0x00	/* No access.  */
Packit 6c4009
#define	PROT_READ	 0x04	/* Pages can be read.  */
Packit 6c4009
#define	PROT_WRITE	 0x02	/* Pages can be written.  */
Packit 6c4009
#define	PROT_EXEC	 0x01	/* Pages can be executed.  */
Packit 6c4009
Packit 6c4009
/* Flags contain mapping type, sharing type and options.  */
Packit 6c4009
Packit 6c4009
/* Mapping type (must choose one and only one of these).  */
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
# define MAP_FILE	 0x0001	/* Mapped from a file or device.  */
Packit 6c4009
# define MAP_ANON	 0x0002	/* Allocated from anonymous virtual memory.  */
Packit 6c4009
# define MAP_TYPE	 0x000f	/* Mask for type field.  */
Packit 6c4009
# define MAP_ANONYMOUS	 MAP_ANON /* Linux name. */
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Sharing types (must choose one and only one of these).  */
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
# define MAP_COPY	 0x0020	/* Virtual copy of region at mapping time.  */
Packit 6c4009
#endif
Packit 6c4009
#define	MAP_SHARED	 0x0010	/* Share changes.  */
Packit 6c4009
#define	MAP_PRIVATE	 0x0000	/* Changes private; copy pages on write.  */
Packit 6c4009
Packit 6c4009
/* Other flags.  */
Packit 6c4009
#define	MAP_FIXED	 0x0100	/* Map address must be exactly as requested. */
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
# define MAP_NOEXTEND	 0x0200	/* For MAP_FILE, don't change file size.  */
Packit 6c4009
# define MAP_HASSEMPHORE 0x0400	/* Region may contain semaphores.  */
Packit 6c4009
# define MAP_INHERIT	 0x0800	/* Region is retained after exec.  */
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Advice to `madvise'.  */
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
# define MADV_NORMAL	 0	/* No further special treatment.  */
Packit 6c4009
# define MADV_RANDOM	 1	/* Expect random page references.  */
Packit 6c4009
# define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
Packit 6c4009
# define MADV_WILLNEED	 3	/* Will need these pages.  */
Packit 6c4009
# define MADV_DONTNEED	 4	/* Don't need these pages.  */
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* The POSIX people had to invent similar names for the same things.  */
Packit 6c4009
#ifdef __USE_XOPEN2K
Packit 6c4009
# define POSIX_MADV_NORMAL	0 /* No further special treatment.  */
Packit 6c4009
# define POSIX_MADV_RANDOM	1 /* Expect random page references.  */
Packit 6c4009
# define POSIX_MADV_SEQUENTIAL	2 /* Expect sequential page references.  */
Packit 6c4009
# define POSIX_MADV_WILLNEED	3 /* Will need these pages.  */
Packit 6c4009
# define POSIX_MADV_DONTNEED	4 /* Don't need these pages.  */
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Flags to `msync'.  */
Packit 6c4009
#define MS_ASYNC	1		/* Sync memory asynchronously.  */
Packit 6c4009
#define MS_SYNC		0		/* Synchronous memory sync.  */
Packit 6c4009
#define MS_INVALIDATE	2		/* Invalidate the caches.  */
Packit 6c4009
Packit 6c4009
/* Flags for `mremap'.  */
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
# define MREMAP_MAYMOVE	1		/* Mapping address may change.  */
Packit 6c4009
# define MREMAP_FIXED	2		/* Fifth argument sets new address.  */
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Flags for `mlockall' (can be OR'd together).  */
Packit 6c4009
#define MCL_CURRENT	1		/* Lock all currently mapped pages.  */
Packit 6c4009
#define MCL_FUTURE	2		/* Lock all additions to address
Packit 6c4009
					   space.  */