Rev 2541 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2541 | Rev 4601 | ||
|---|---|---|---|
| Line 35... | Line 35... | ||
| 35 | #include <sys/mman.h> |
35 | #include <sys/mman.h> |
| 36 | #include <sys/types.h> |
36 | #include <sys/types.h> |
| 37 | #include <as.h> |
37 | #include <as.h> |
| 38 | #include <unistd.h> |
38 | #include <unistd.h> |
| 39 | 39 | ||
| 40 | void *mmap(void *start, size_t length, int prot, int flags, int fd, |
40 | void *mmap(void *start, size_t length, int prot, int flags, int fd, |
| 41 | off_t offset) |
41 | off_t offset) |
| 42 | { |
42 | { |
| 43 | if (!start) |
43 | if (!start) |
| 44 | start = as_get_mappable_page(length); |
44 | start = as_get_mappable_page(length); |
| 45 | 45 | ||
| 46 | // if (! ((flags & MAP_SHARED) ^ (flags & MAP_PRIVATE))) |
46 | // if (!((flags & MAP_SHARED) ^ (flags & MAP_PRIVATE))) |
| 47 | // return MAP_FAILED; |
47 | // return MAP_FAILED; |
| - | 48 | ||
| 48 | if (! (flags & MAP_ANONYMOUS)) |
49 | if (!(flags & MAP_ANONYMOUS)) |
| 49 | return MAP_FAILED; |
50 | return MAP_FAILED; |
| 50 | 51 | ||
| 51 | return as_area_create(start, length, prot); |
52 | return as_area_create(start, length, prot); |
| 52 | } |
53 | } |
| 53 | 54 | ||
| 54 | int munmap(void *start, size_t length) |
55 | int munmap(void *start, size_t length) |
| 55 | { |
56 | { |