]>
sourceware.org Git - glibc.git/blob - 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.
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.
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.
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. */
24 #include <bits/types.h>
28 #include <bits/mman.h>
30 /* Return value of `mmap' in case of an error. */
31 #define MAP_FAILED ((void *) -1)
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. */
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
;
48 extern void * __REDIRECT (mmap
,
49 (void *__addr
, size_t __len
, int __prot
,
50 int __flags
, int __fd
, __off64_t __offset
) __THROW
,
56 #ifdef __USE_LARGEFILE64
57 extern void *mmap64 (void *__addr
, size_t __len
, int __prot
,
58 int __flags
, int __fd
, __off64_t __offset
) __THROW
;
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
;
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
68 extern int mprotect (void *__addr
, size_t __len
, int __prot
) __THROW
;
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
;
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
;
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
;
85 /* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). */
86 extern int munlock (__const
void *__addr
, size_t __len
) __THROW
;
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
;
93 /* All currently mapped pages of the process' address space become
95 extern int munlockall (void) __THROW
;
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
101 extern void *mremap (void *__addr
, size_t __old_len
, size_t __new_len
,
102 int __may_move
) __THROW
;
107 #endif /* sys/mman.h */
This page took 0.208538 seconds and 5 git commands to generate.