5#include "tests/vm/sample.inc"
12 char *actual = (
char *) 0x10000000;
17 CHECK ((handle =
open (
"sample.txt")) > 1,
"open \"sample.txt\"");
22 fail (
"read of mmap'd file reported bad data");
25 for (i =
strlen (sample); i < 4096; i++)
27 fail (
"byte %zu of mmap'd region has value %02hhx (should be 0)",
mapid_t mmap(int fd, void *addr)
Project 3 and optionally project 4.
int open(const char *file)
void munmap(mapid_t mapid)
int mapid_t
Map region 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)
Uses a memory mapping to read a file.
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.