1 /* $NetBSD: linux_mmap.h,v 1.20 2007/12/20 23:02:55 dsl Exp $ */
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden and Eric Haszlakiewicz.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
35 #define LINUX_PROT_NONE 0x00
36 #define LINUX_PROT_READ 0x01
37 #define LINUX_PROT_WRITE 0x02
38 #define LINUX_PROT_EXEC 0x04
39 #define LINUX_PROT_GROWSDOWN 0x01000000
40 #define LINUX_PROT_GROWSUP 0x02000000
42 #define LINUX_MAP_SHARED 0x0001
43 #define LINUX_MAP_PRIVATE 0x0002
46 #include <compat/linux/arch/i386/linux_mmap.h>
47 #elif defined(__m68k__)
48 #include <compat/linux/arch/m68k/linux_mmap.h>
49 #elif defined(__alpha__)
50 #include <compat/linux/arch/alpha/linux_mmap.h>
51 #elif defined(__powerpc__)
52 #include <compat/linux/arch/powerpc/linux_mmap.h>
53 #elif defined(__mips__)
54 #include <compat/linux/arch/mips/linux_mmap.h>
55 #elif defined(__arm__)
56 #include <compat/linux/arch/arm/linux_mmap.h>
57 #elif defined(__amd64__)
58 #include <compat/linux/arch/amd64/linux_mmap.h>
60 * XXX ERH: All below here are guesses. The header
61 * XXX ERH: files are correct but the defined(*)
62 * XXX ERH: probably aren't
64 * XXX ERH: Can probably drop some of these headers: linux
65 * XXX ERH: is stupid about compat stuff. It doesn't really
66 * XXX ERH: use all the defines, but I don't want to go looking
67 * XXX ERH: through all the kernel sources right now.
69 #elif defined(__sparc__)
70 #include <compat/linux/arch/sparc/linux_mmap.h>
72 #error Undefined linux_mmap.h machine type.
76 * Ensure the linux_sys_mmap syscall appears to exist:
78 struct linux_sys_mmap_args
;
79 struct linux_sys_mmap_args
{
80 syscallarg(unsigned long) addr
;
81 syscallarg(size_t) len
;
83 syscallarg(int) flags
;
85 syscallarg(linux_off_t
) offset
;
89 * Same arguments, but different meaning for "offset".
90 * See linux_misc.c:linux_sys_mmap2().
92 #define linux_sys_mmap2_args linux_sys_mmap_args
96 int linux_sys_mmap(struct lwp
*p
, const struct linux_sys_mmap_args
*v
, register_t
*retval
);
97 int linux_sys_mmap2(struct lwp
*p
, const struct linux_sys_mmap2_args
*v
, register_t
*retval
);
100 #endif /* !_KERNEL */
102 #endif /* !_LINUX_MMAP_H */