static int testaddr(void *addr, volatile void *want)
{
+ /* Some architectures (e.g. s390) just provide enough information to
+ resolve the page fault, but do not provide the offset within a page */
+#if defined(__s390__)
+ if (addr != (void *) ((unsigned long) want & ~0xffful)) {
+#else
if (addr != want) {
+#endif
fprintf(stderr, " FAIL: expected si_addr==%p, not %p\n", want, addr);
return 0;
}
for(i = 0; i < sizeof(sigs)/sizeof(*sigs); i++)
sigaction(sigs[i], &sa, NULL);
- fd = open("faultstatus.tmp", O_CREAT|O_TRUNC|O_EXCL, 0600);
+ /* we need O_RDWR for the truncate below */
+ fd = open("faultstatus.tmp", O_CREAT|O_TRUNC|O_EXCL|O_RDWR, 0600);
if (fd == -1) {
perror("tmpfile");
exit(1);