2 * Copyright 2016 Facebook, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 // MAP_ANONYMOUS is named MAP_ANON on OSX/BSD.
23 #if defined(__APPLE__) || defined(__FreeBSD__)
24 # if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
25 # define MAP_ANONYMOUS MAP_ANON
30 #include <sys/types.h>
32 #define MAP_ANONYMOUS 1
33 #define MAP_ANON MAP_ANONYMOUS
36 #define MAP_POPULATE 8
37 #define MAP_NORESERVE 16
40 #define MAP_FAILED ((void*)-1)
47 #define MADV_DONTNEED 0
48 #define MADV_SEQUENTIAL 0
51 int madvise(const void* addr, size_t len, int advise);
52 int mlock(const void* addr, size_t len);
53 void* mmap(void* addr, size_t length, int prot, int flags, int fd, off_t off);
54 int mprotect(void* addr, size_t size, int prot);
55 int munlock(const void* addr, size_t length);
56 int munmap(void* addr, size_t length);