mman.h revision 8519
110907Sbde/*- 210907Sbde * Copyright (c) 1982, 1986, 1993 310907Sbde * The Regents of the University of California. All rights reserved. 410907Sbde * 528400Speter * Redistribution and use in source and binary forms, with or without 610907Sbde * modification, are permitted provided that the following conditions 710907Sbde * are met: 810907Sbde * 1. Redistributions of source code must retain the above copyright 910907Sbde * notice, this list of conditions and the following disclaimer. 1010907Sbde * 2. Redistributions in binary form must reproduce the above copyright 1121777Sbde * notice, this list of conditions and the following disclaimer in the 1210907Sbde * documentation and/or other materials provided with the distribution. 1311331Sswallace * 3. All advertising materials mentioning features or use of this software 1411331Sswallace * must display the following acknowledgement: 1511331Sswallace * This product includes software developed by the University of 1611295Sswallace * California, Berkeley and its contributors. 1711295Sswallace * 4. Neither the name of the University nor the names of its contributors 1811295Sswallace * may be used to endorse or promote products derived from this software 1911331Sswallace * without specific prior written permission. 2011331Sswallace * 2111331Sswallace * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2211295Sswallace * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2311295Sswallace * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2411295Sswallace * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2511295Sswallace * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2611295Sswallace * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2711295Sswallace * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2811295Sswallace * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2911295Sswallace * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3011295Sswallace * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3111295Sswallace * SUCH DAMAGE. 3211295Sswallace * 3311295Sswallace * @(#)mman.h 8.1 (Berkeley) 6/2/93 3411295Sswallace * $Id: mman.h,v 1.6 1995/03/25 17:28:30 davidg Exp $ 3511295Sswallace */ 3611295Sswallace 3711295Sswallace#ifndef _SYS_MMAN_H_ 3811295Sswallace#define _SYS_MMAN_H_ 3911295Sswallace 4011295Sswallace/* 4111295Sswallace * Protections are chosen from these bits, or-ed together 4211295Sswallace */ 4311295Sswallace#define PROT_READ 0x01 /* pages can be read */ 4411295Sswallace#define PROT_WRITE 0x02 /* pages can be written */ 4511295Sswallace#define PROT_EXEC 0x04 /* pages can be executed */ 4611295Sswallace 4711295Sswallace/* 4811295Sswallace * Flags contain sharing type and options. 4911295Sswallace * Sharing types; choose one. 5011295Sswallace */ 5111295Sswallace#define MAP_SHARED 0x0001 /* share changes */ 5211295Sswallace#define MAP_PRIVATE 0x0002 /* changes are private */ 5311295Sswallace#define MAP_COPY 0x0004 /* "copy" region at mmap time */ 5411295Sswallace 5511295Sswallace/* 5611295Sswallace * Other flags 5711295Sswallace */ 5811295Sswallace#define MAP_FIXED 0x0010 /* map addr must be exactly as requested */ 5911295Sswallace#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */ 6011295Sswallace#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */ 6111295Sswallace#define MAP_INHERIT 0x0080 /* region is retained after exec */ 6211295Sswallace#define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */ 6311295Sswallace#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */ 6411295Sswallace 6511295Sswallace/* 6611295Sswallace * msync() flags 6711295Sswallace */ 6811295Sswallace#define MS_ASYNC 0x0001 /* return immediately */ 6911295Sswallace#define MS_INVALIDATE 0x0002 /* invalidate all cached data */ 7011295Sswallace 7111295Sswallace/* 7211295Sswallace * Mapping type; default is map from file. 7311295Sswallace */ 7411295Sswallace#define MAP_FILE 0x0000 /* for backward source compatibility */ 7511295Sswallace#define MAP_ANON 0x1000 /* allocated from memory, swap space */ 7611295Sswallace 7711295Sswallace/* 7811295Sswallace * Advice to madvise 7911295Sswallace */ 8011295Sswallace#define MADV_NORMAL 0 /* no further special treatment */ 8111331Sswallace#define MADV_RANDOM 1 /* expect random page references */ 8211331Sswallace#define MADV_SEQUENTIAL 2 /* expect sequential page references */ 8311331Sswallace#define MADV_WILLNEED 3 /* will need these pages */ 8411295Sswallace#define MADV_DONTNEED 4 /* dont need these pages */ 8522521Sdyson 8611295Sswallace#ifndef KERNEL 8711295Sswallace 8811295Sswallace#include <sys/cdefs.h> 8911295Sswallace 9011295Sswallace__BEGIN_DECLS 9111295Sswallace/* Some of these int's should probably be size_t's */ 9211295Sswallacecaddr_t mmap __P((caddr_t, size_t, int, int, int, off_t)); 9311295Sswallaceint madvise __P((caddr_t, int, int)); 9411295Sswallaceint mprotect __P((caddr_t, size_t, int)); 9511295Sswallaceint munmap __P((caddr_t, size_t)); 9611295Sswallaceint msync __P((caddr_t, size_t, int)); 9711331Sswallaceint mlock __P((caddr_t, size_t)); 9811331Sswallaceint munlock __P((caddr_t, size_t)); 9911331Sswallace__END_DECLS 10011331Sswallace 10111331Sswallace#endif /* !KERNEL */ 10211331Sswallace 10311295Sswallace#endif 10411295Sswallace