xref: /original-bsd/sys/sys/mman.h (revision 95407d66)
1 /*-
2  * Copyright (c) 1982, 1986 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)mman.h	7.4 (Berkeley) 02/22/91
8  */
9 
10 /*
11  * Protections are chosen from these bits, or-ed together
12  */
13 #define	PROT_READ	0x04	/* pages can be read */
14 #define	PROT_WRITE	0x02	/* pages can be written */
15 #define	PROT_EXEC	0x01	/* pages can be executed */
16 
17 /*
18  * Flags contain mapping type, sharing type and options.
19  * Mapping type; choose one
20  */
21 #define	MAP_FILE	0x0001	/* mapped from a file or device */
22 #define	MAP_ANON	0x0002	/* allocated from memory, swap space */
23 #define	MAP_TYPE	0x000f	/* mask for type field */
24 
25 /*
26  * Sharing types; choose one
27  */
28 #define	MAP_COPY	0x0020	/* "copy" region at mmap time */
29 #define	MAP_SHARED	0x0010	/* share changes */
30 #define	MAP_PRIVATE	0x0000	/* changes are private */
31 
32 /*
33  * Other flags
34  */
35 #define	MAP_FIXED	0x0100	/* map addr must be exactly as requested */
36 #define	MAP_NOEXTEND	0x0200	/* for MAP_FILE, don't change file size */
37 #define	MAP_HASSEMPHORE	0x0400	/* region may contain semaphores */
38 #define	MAP_INHERIT	0x0800	/* region is retained after exec */
39 
40 /*
41  * Advice to madvise
42  */
43 #define	MADV_NORMAL	0	/* no further special treatment */
44 #define	MADV_RANDOM	1	/* expect random page references */
45 #define	MADV_SEQUENTIAL	2	/* expect sequential page references */
46 #define	MADV_WILLNEED	3	/* will need these pages */
47 #define	MADV_DONTNEED	4	/* dont need these pages */
48 
49 #ifndef KERNEL
50 
51 #include <sys/cdefs.h>
52 
53 __BEGIN_DECLS
54 /* Some of these int's should probably be size_t's */
55 int	mmap __P((caddr_t, int, int, int, int, off_t));
56 int	mprotect __P((caddr_t, int, int));
57 int	munmap __P((caddr_t, int));
58 int	msync __P((caddr_t, int));
59 __END_DECLS
60 
61 #endif /* !KERNEL */
62