CS代考计算机代写 Carnegie Mellon

Carnegie Mellon
User-Level Memory Mapping
void *mmap(void *start, int len,
int prot, int flags, int fd, int offset)
 Map len bytes starting at offset offset of the file specified by file description fd, preferably at address start
 start: may be 0 for “pick an address”
 prot: PROT_READ, PROT_WRITE, …
 flags: MAP_ANON, MAP_PRIVATE, MAP_SHARED, …
 Return a pointer to start of mapped area (may not be start)
1

Carnegie Mellon
User-Level Memory Mapping
void *mmap(void *start, int len,
int prot, int flags, int fd, int offset)
len bytes offset
(bytes)
len bytes start
(or address chosen by kernel)
0
0
Disk file specified by file descriptor fd
Process virtual memory
2