6#include "tests/vm/sample.inc"
13 char *actual = (
char *) 0x54321000;
18 CHECK ((handle =
open (
"sample.txt")) > 1,
"open \"sample.txt\"");
21 fail (
"read of mmap'd file reported bad data");
24 CHECK ((child =
exec (
"child-inherit")) != -1,
"exec \"child-inherit\"");
26 CHECK (
wait (child) == -1,
"wait for child (should return -1)");
31 "checking that mmap'd file still has same data");
static void wait(struct intq *q, struct thread **waiter)
mapid_t mmap(int fd, void *addr)
Project 3 and optionally project 4.
int open(const char *file)
pid_t exec(const char *file)
int pid_t
Process identifier.
void fail(const char *format,...)
#define CHECK(SUCCESS,...)
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
void test_main(void)
Maps a file into memory and runs child-inherit to verify that mappings are not inherited.
int memcmp(const void *a_, const void *b_, size_t size)
Find the first differing byte in the two blocks of SIZE bytes at A and B.
size_t strlen(const char *string)
Returns the length of STRING.