CS318 - Pintos
Pintos source browser for JHU CS318 course
src
tests
vm
child-mm-wrt.c
Go to the documentation of this file.
1
/** Child process of mmap-exit.
2
Mmaps a file and writes to it via the mmap'ing, then exits
3
without calling munmap. The data in the mapped region must be
4
written out at program termination. */
5
6
#include <
string.h
>
7
#include <syscall.h>
8
#include "tests/vm/sample.inc"
9
#include "
tests/lib.h
"
10
#include "
tests/main.h
"
11
12
#define ACTUAL ((void *) 0x10000000)
13
14
void
15
test_main
(
void
)
16
{
17
int
handle;
18
19
CHECK
(
create
(
"sample.txt"
,
sizeof
sample),
"create \"sample.txt\""
);
20
CHECK
((handle =
open
(
"sample.txt"
)) > 1,
"open \"sample.txt\""
);
21
CHECK
(
mmap
(handle,
ACTUAL
) !=
MAP_FAILED
,
"mmap \"sample.txt\""
);
22
memcpy
(
ACTUAL
, sample,
sizeof
sample);
23
}
24
lib.h
string.h
memcpy
void * memcpy(void *dst_, const void *src_, size_t size)
Copies SIZE bytes from SRC to DST, which must not overlap.
Definition:
string.c:7
CHECK
#define CHECK(SUCCESS,...)
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
Definition:
lib.h:29
ACTUAL
#define ACTUAL
Child process of mmap-exit.
Definition:
child-mm-wrt.c:12
test_main
void test_main(void)
tests/main.h
Definition:
child-mm-wrt.c:15
MAP_FAILED
#define MAP_FAILED
Definition:
syscall.h:13
open
int open(const char *file)
Definition:
syscall.c:103
main.h
mmap
mapid_t mmap(int fd, void *addr)
Project 3 and optionally project 4.
Definition:
syscall.c:145
create
bool create(const char *file, unsigned initial_size)
Definition:
syscall.c:91
Generated on Thu Aug 22 2019 10:19:15 for CS318 - Pintos by
1.8.16