8 #include <parlib/parlib.h>
9 #include <parlib/timing.h>
15 pFile = open ("hello.txt", O_RDWR | O_CREAT, (mode_t)0600);
16 /* this mmap will give you a Bus Error on linux if you try to map more
17 * pages than the file contains (i think)... */
18 first = (int*)mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, pFile, 0);
19 if (first == MAP_FAILED) {
20 fprintf(stderr, "Unable to mmap the file (%d), aborting!\n", errno);
24 printf("the first number after initialization is %d at %08p\n", first[0],
26 if ((pid = fork()) < 0) {
31 /* delay here, to avoid the race a bit */
33 printf("After fork in the parent, the first number is %d\n", first[0]);
35 printf("Pid 0 sees value %d at mmapped address %08p\n", first[0],
38 printf("After fork in the child, the first number is %d\n", first[0]);
40 printf("Child pid %d sees value %d at mmapped address %08p\n", pid,