Lines Matching +full:1 +full:p1
10 # 1. Redistributions of source code must retain the above copyright
37 sed '1,/^EOF/d' < $odir/$0 > $dir/wire_no_page.c
38 mycc -o mmap6 -Wall -Wextra wire_no_page.c || exit 1
47 sleep .1
48 done > /dev/null 2>&1
75 char *p1, *p2;
79 if ((fd = open(file, O_RDONLY)) == -1)
80 err(1, "open %s", file);
81 if ((error = fstat(fd, &st)) == -1)
82 err(1, "stat(%s)", file);
84 if ((p1 = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED)
85 err(1, "mmap");
87 err(1, "mmap");
88 c = p1[arc4random() % len];
91 if ((error = mlock(p1, len)) == -1)
92 err(1, "mlock");
93 c = p1[arc4random() % len];
94 if (munmap(p2, len) == -1)
95 err(1, "unmap()");
96 if (munmap(p1, len) == -1)
97 err(1, "unmap()");
105 char *p1, *p2;
109 if ((fd = open(file, O_RDWR)) == -1)
110 err(1, "open %s", file);
111 if ((error = fstat(fd, &st)) == -1)
112 err(1, "stat(%s)", file);
114 if ((p1 = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) ==
116 err(1, "mmap");
119 err(1, "mmap");
120 p1[arc4random() % len] = 1;
121 p2[arc4random() % len] = 1;
123 if ((error = mlock(p1, len)) == -1)
124 err(1, "mlock");
125 p1[arc4random() % len] = 1;
127 if ((error = msync(p1, len, MS_SYNC | MS_INVALIDATE)) == -1)
129 err(1, "msync");
130 if (munmap(p2, len) == -1)
131 err(1, "unmap()");
132 if (munmap(p1, len) == -1)
133 err(1, "unmap()");
168 errx(1, "Usage: %s <file>", argv[0]);
169 file = argv[1];