blob: 8419788f79866df3db1f2b396e8c2092ebfdf1f2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/* 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);
}
|