]> sourceware.org Git - glibc.git/blob - misc/sys/mman.h
Update.
[glibc.git] / misc / sys / mman.h
1 /* Definitions for BSD-style memory management.
2 Copyright (C) 1994, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
19
20 #ifndef _SYS_MMAN_H
21 #define _SYS_MMAN_H 1
22
23 #include <features.h>
24 #include <bits/types.h>
25 #define __need_size_t
26 #include <stddef.h>
27
28 #include <bits/mman.h>
29
30 /* Return value of `mmap' in case of an error. */
31 #define MAP_FAILED ((void *) -1)
32
33 __BEGIN_DECLS
34 /* Map addresses starting near ADDR and extending for LEN bytes. from
35 OFFSET into the file FD describes according to PROT and FLAGS. If ADDR
36 is nonzero, it is the desired mapping address. If the MAP_FIXED bit is
37 set in FLAGS, the mapping will be at ADDR exactly (which must be
38 page-aligned); otherwise the system chooses a convenient nearby address.
39 The return value is the actual mapping address chosen or MAP_FAILED
40 for errors (in which case `errno' is set). A successful `mmap' call
41 deallocates any previous mapping for the affected region. */
42
43 #ifndef __USE_FILE_OFFSET64
44 extern void *mmap (void *__addr, size_t __len, int __prot,
45 int __flags, int __fd, __off_t __offset) __THROW;
46 #else
47 # ifdef __REDIRECT
48 extern void * __REDIRECT (mmap,
49 (void *__addr, size_t __len, int __prot,
50 int __flags, int __fd, __off64_t __offset) __THROW,
51 mmap64);
52 # else
53 # define mmap mmap64
54 # endif
55 #endif
56 #ifdef __USE_LARGEFILE64
57 extern void *mmap64 (void *__addr, size_t __len, int __prot,
58 int __flags, int __fd, __off64_t __offset) __THROW;
59 #endif
60
61 /* Deallocate any mapping for the region starting at ADDR and extending LEN
62 bytes. Returns 0 if successful, -1 for errors (and sets errno). */
63 extern int munmap (void *__addr, size_t __len) __THROW;
64
65 /* Change the memory protection of the region starting at ADDR and
66 extending LEN bytes to PROT. Returns 0 if successful, -1 for errors
67 (and sets errno). */
68 extern int mprotect (void *__addr, size_t __len, int __prot) __THROW;
69
70 /* Synchronize the region starting at ADDR and extending LEN bytes with the
71 file it maps. Filesystem operations on a file being mapped are
72 unpredictable before this is done. Flags are from the MS_* set. */
73 extern int msync (void *__addr, size_t __len, int __flags) __THROW;
74
75 #ifdef __USE_BSD
76 /* Advise the system about particular usage patterns the program follows
77 for the region starting at ADDR and extending LEN bytes. */
78 extern int madvise (void *__addr, size_t __len, int __advice) __THROW;
79 #endif
80
81 /* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
82 be memory resident. */
83 extern int mlock (__const void *__addr, size_t __len) __THROW;
84
85 /* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). */
86 extern int munlock (__const void *__addr, size_t __len) __THROW;
87
88 /* Cause all currently mapped pages of the process to be memory resident
89 until unlocked by a call to the `munlockall', until the process exits,
90 or until the process calls `execve'. */
91 extern int mlockall (int __flags) __THROW;
92
93 /* All currently mapped pages of the process' address space become
94 unlocked. */
95 extern int munlockall (void) __THROW;
96
97 #ifdef __USE_MISC
98 /* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length
99 NEW_LEN. If MAY_MOVE is MREMAP_MAYMOVE the returned address may
100 differ from ADDR. */
101 extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
102 int __may_move) __THROW;
103 #endif
104
105 __END_DECLS
106
107 #endif /* sys/mman.h */
This page took 0.208538 seconds and 5 git commands to generate.