mman.h revision 1822
160786Sps/*-
2221715Sdelphij * Copyright (c) 1982, 1986, 1993
360786Sps *	The Regents of the University of California.  All rights reserved.
460786Sps *
560786Sps * Redistribution and use in source and binary forms, with or without
660786Sps * modification, are permitted provided that the following conditions
760786Sps * are met:
860786Sps * 1. Redistributions of source code must retain the above copyright
960786Sps *    notice, this list of conditions and the following disclaimer.
1060786Sps * 2. Redistributions in binary form must reproduce the above copyright
1160786Sps *    notice, this list of conditions and the following disclaimer in the
1260786Sps *    documentation and/or other materials provided with the distribution.
1360786Sps * 3. All advertising materials mentioning features or use of this software
1460786Sps *    must display the following acknowledgement:
1560786Sps *	This product includes software developed by the University of
1660786Sps *	California, Berkeley and its contributors.
1760786Sps * 4. Neither the name of the University nor the names of its contributors
1860786Sps *    may be used to endorse or promote products derived from this software
1960786Sps *    without specific prior written permission.
2060786Sps *
2160786Sps * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2260786Sps * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2360786Sps * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24128345Stjr * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2560786Sps * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2660786Sps * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2760786Sps * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2860786Sps * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2960786Sps * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3060786Sps * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31170256Sdelphij * SUCH DAMAGE.
32170256Sdelphij *
3360786Sps *	@(#)mman.h	8.1 (Berkeley) 6/2/93
3460786Sps * $Id: mman.h,v 1.2 1994/08/02 07:53:14 davidg Exp $
35221715Sdelphij */
36221715Sdelphij
37221715Sdelphij/*
38221715Sdelphij * Protections are chosen from these bits, or-ed together
39221715Sdelphij */
40221715Sdelphij#define	PROT_READ	0x01	/* pages can be read */
41221715Sdelphij#define	PROT_WRITE	0x02	/* pages can be written */
42221715Sdelphij#define	PROT_EXEC	0x04	/* pages can be executed */
43221715Sdelphij
44221715Sdelphij/*
45221715Sdelphij * Flags contain sharing type and options.
46221715Sdelphij * Sharing types; choose one.
47221715Sdelphij */
48221715Sdelphij#define	MAP_SHARED	0x0001	/* share changes */
49221715Sdelphij#define	MAP_PRIVATE	0x0002	/* changes are private */
50221715Sdelphij#define	MAP_COPY	0x0004	/* "copy" region at mmap time */
51221715Sdelphij
52221715Sdelphij/*
53221715Sdelphij * Other flags
54221715Sdelphij */
55221715Sdelphij#define	MAP_FIXED	 0x0010	/* map addr must be exactly as requested */
56221715Sdelphij#define	MAP_RENAME	 0x0020	/* Sun: rename private pages to file */
57221715Sdelphij#define	MAP_NORESERVE	 0x0040	/* Sun: don't reserve needed swap area */
58221715Sdelphij#define	MAP_INHERIT	 0x0080	/* region is retained after exec */
59221715Sdelphij#define	MAP_NOEXTEND	 0x0100	/* for MAP_FILE, don't change file size */
60221715Sdelphij#define	MAP_HASSEMAPHORE 0x0200	/* region may contain semaphores */
61221715Sdelphij
62221715Sdelphij/*
63221715Sdelphij * Mapping type; default is map from file.
6460786Sps */
6560786Sps#define MAP_FILE	0x0000	/* for backward source compatibility */
6660786Sps#define	MAP_ANON	0x1000	/* allocated from memory, swap space */
6760786Sps
6860786Sps/*
6960786Sps * Advice to madvise
7060786Sps */
7160786Sps#define	MADV_NORMAL	0	/* no further special treatment */
72128345Stjr#define	MADV_RANDOM	1	/* expect random page references */
7360786Sps#define	MADV_SEQUENTIAL	2	/* expect sequential page references */
7460786Sps#define	MADV_WILLNEED	3	/* will need these pages */
7560786Sps#define	MADV_DONTNEED	4	/* dont need these pages */
7660786Sps
7760786Sps#ifndef KERNEL
7860786Sps
7960786Sps#include <sys/cdefs.h>
8060786Sps
8160786Sps__BEGIN_DECLS
8260786Sps/* Some of these int's should probably be size_t's */
8360786Spscaddr_t	mmap __P((caddr_t, size_t, int, int, int, off_t));
8460786Spsint	mprotect __P((caddr_t, size_t, int));
8560786Spsint	munmap __P((caddr_t, size_t));
8660786Spsint	msync __P((caddr_t, size_t));
8760786Spsint	mlock __P((caddr_t, size_t));
8860786Spsint	munlock __P((caddr_t, size_t));
8960786Sps__END_DECLS
9060786Sps
9160786Sps#endif /* !KERNEL */
9260786Sps