This repository has been archived on 2021-05-26. You can view files and clone it, but cannot push or open issues or pull requests.
OS/pintos-env/pintos/tests/vm/child-mm-wrt.c

24 lines
656 B
C
Executable file

/* Child process of mmap-exit.
Mmaps a file and writes to it via the mmap'ing, then exits
without calling munmap. The data in the mapped region must be
written out at program termination. */
#include <string.h>
#include <syscall.h>
#include "tests/vm/sample.inc"
#include "tests/lib.h"
#include "tests/main.h"
#define ACTUAL ((void *) 0x10000000)
void
test_main (void)
{
int handle;
CHECK (create ("sample.txt", sizeof sample), "create \"sample.txt\"");
CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
CHECK (mmap (handle, ACTUAL) != MAP_FAILED, "mmap \"sample.txt\"");
memcpy (ACTUAL, sample, sizeof sample);
}