28c28
< __FBSDID("$FreeBSD: head/tests/sys/posixshm/posixshm_test.c 289441 2015-10-17 04:32:21Z ngie $");
---
> __FBSDID("$FreeBSD: head/tests/sys/posixshm/posixshm_test.c 298304 2016-04-19 23:15:47Z ngie $");
53d52
< char *tmpdir = getenv("TMPDIR");
55,58c54,55
< if (tmpdir == NULL)
< tmpdir = "/tmp";
<
< snprintf(test_path, sizeof(test_path), "%s/tmp.XXXXXX", tmpdir);
---
> snprintf(test_path, sizeof(test_path), "%s/tmp.XXXXXX",
> getenv("TMPDIR") == NULL ? "/tmp" : getenv("TMPDIR"));
102c99
< int fd;
---
> int fd, pagesize;
105a103,104
> ATF_REQUIRE(0 < (pagesize = getpagesize()));
>
114c113
< if (ftruncate(fd, getpagesize()) < 0)
---
> if (ftruncate(fd, pagesize) < 0)
117,118c116
< page = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED, fd,
< 0);
---
> page = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
123,124c121,122
< if (munmap(page, getpagesize()) < 0)
< atf_tc_fail("munmap failed; errno=%d", errno);
---
> ATF_REQUIRE_MSG(munmap(page, pagesize) == 0, "munmap failed; errno=%d",
> errno);
133c131
< int fd;
---
> int fd, pagesize;
134a133,134
> ATF_REQUIRE(0 < (pagesize = getpagesize()));
>
137,138c137
< page = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED, fd,
< 0);
---
> page = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
146,147c145,146
< if (munmap(page, getpagesize()) < 0)
< atf_tc_fail("munmap failed; errno=%d", errno);
---
> ATF_REQUIRE_MSG(munmap(page, pagesize) == 0, "munmap failed; errno=%d",
> errno);
157c156
< int fd;
---
> int fd, pagesize;
158a158,159
> ATF_REQUIRE(0 < (pagesize = getpagesize()));
>
166c167
< page = mmap(0, getpagesize(), PROT_READ, MAP_SHARED, fd, 0);
---
> page = mmap(0, pagesize, PROT_READ, MAP_SHARED, fd, 0);
173c174,175
< munmap(page, getpagesize());
---
> ATF_REQUIRE_MSG(munmap(page, pagesize) == 0, "munmap failed; errno=%d",
> errno);
183c185
< int fd;
---
> int fd, pagesize;
184a187,188
> ATF_REQUIRE(0 < (pagesize = getpagesize()));
>
191,192c195
< page = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED, fd,
< 0);
---
> page = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
362,363c365,366
< char err_buf[1024], *page;
< int fd, status;
---
> char *page;
> int fd, pagesize, status;
364a368,369
> ATF_REQUIRE(0 < (pagesize = getpagesize()));
>
370c375
< if (ftruncate(fd, getpagesize()) < 0)
---
> if (ftruncate(fd, pagesize) < 0)
376c381
< if (sb.st_size != getpagesize())
---
> if (sb.st_size != pagesize)
378c383
< (int)sb.st_size, getpagesize());
---
> (int)sb.st_size, pagesize);
381,382c386
< page = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd,
< 0);
---
> page = mmap(0, pagesize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
388,389c392,393
< if (munmap(page, getpagesize()) < 0)
< atf_tc_fail("munmap(1) failed; errno=%d", errno);
---
> ATF_REQUIRE_MSG(munmap(page, pagesize) == 0, "munmap failed; errno=%d",
> errno);
392c396
< if (ftruncate(fd, getpagesize() * 2) < 0)
---
> if (ftruncate(fd, pagesize * 2) < 0)
398c402
< if (sb.st_size != getpagesize() * 2)
---
> if (sb.st_size != pagesize * 2)
400c404
< (int)sb.st_size, getpagesize() * 2);
---
> (int)sb.st_size, pagesize * 2);
403,404c407
< page = mmap(0, getpagesize() * 2, PROT_READ|PROT_WRITE, MAP_SHARED,
< fd, 0);
---
> page = mmap(0, pagesize * 2, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
412c415
< page[getpagesize()] = '2';
---
> page[pagesize] = '2';
415c418
< if (ftruncate(fd, getpagesize()) < 0)
---
> if (ftruncate(fd, pagesize) < 0)
421c424
< if (sb.st_size != getpagesize())
---
> if (sb.st_size != pagesize)
423c426
< (int)sb.st_size, getpagesize());
---
> (int)sb.st_size, pagesize);
438c441
< getrlimit(RLIMIT_CORE, &lim);
---
> ATF_REQUIRE(getrlimit(RLIMIT_CORE, &lim) == 0);
440c443
< setrlimit(RLIMIT_CORE, &lim);
---
> ATF_REQUIRE(setrlimit(RLIMIT_CORE, &lim) == 0);
447c450
< c = page[getpagesize()];
---
> c = page[pagesize];
459c462
< if (ftruncate(fd, getpagesize() * 2) < 0)
---
> if (ftruncate(fd, pagesize * 2) < 0)
465c468
< if (sb.st_size != getpagesize() * 2)
---
> if (sb.st_size != pagesize * 2)
467c470
< (int)sb.st_size, getpagesize());
---
> (int)sb.st_size, pagesize);
478c481
< if (page[getpagesize()] != 0)
---
> if (page[pagesize] != 0)
480c483
< getpagesize(), (int)page[getpagesize()]);
---
> pagesize, (int)page[pagesize]);
527c530
< } else if (scval <= 0 || (size_t)psize != psize) {
---
> } else if (scval <= 0) {
545,546c548
< region = mmap((void *)0, psize, PROT_READ | PROT_WRITE, MAP_SHARED,
< desc, (off_t)0);
---
> region = mmap(NULL, psize, PROT_READ | PROT_WRITE, MAP_SHARED, desc, 0);
603a606,609
>
> ATF_REQUIRE_MSG(munmap(region, psize) == 0, "munmap failed; errno=%d",
> errno);
> shm_unlink(test_path);
< __FBSDID("$FreeBSD: head/tests/sys/posixshm/posixshm_test.c 289441 2015-10-17 04:32:21Z ngie $");
---
> __FBSDID("$FreeBSD: head/tests/sys/posixshm/posixshm_test.c 298304 2016-04-19 23:15:47Z ngie $");
53d52
< char *tmpdir = getenv("TMPDIR");
55,58c54,55
< if (tmpdir == NULL)
< tmpdir = "/tmp";
<
< snprintf(test_path, sizeof(test_path), "%s/tmp.XXXXXX", tmpdir);
---
> snprintf(test_path, sizeof(test_path), "%s/tmp.XXXXXX",
> getenv("TMPDIR") == NULL ? "/tmp" : getenv("TMPDIR"));
102c99
< int fd;
---
> int fd, pagesize;
105a103,104
> ATF_REQUIRE(0 < (pagesize = getpagesize()));
>
114c113
< if (ftruncate(fd, getpagesize()) < 0)
---
> if (ftruncate(fd, pagesize) < 0)
117,118c116
< page = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED, fd,
< 0);
---
> page = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
123,124c121,122
< if (munmap(page, getpagesize()) < 0)
< atf_tc_fail("munmap failed; errno=%d", errno);
---
> ATF_REQUIRE_MSG(munmap(page, pagesize) == 0, "munmap failed; errno=%d",
> errno);
133c131
< int fd;
---
> int fd, pagesize;
134a133,134
> ATF_REQUIRE(0 < (pagesize = getpagesize()));
>
137,138c137
< page = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED, fd,
< 0);
---
> page = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
146,147c145,146
< if (munmap(page, getpagesize()) < 0)
< atf_tc_fail("munmap failed; errno=%d", errno);
---
> ATF_REQUIRE_MSG(munmap(page, pagesize) == 0, "munmap failed; errno=%d",
> errno);
157c156
< int fd;
---
> int fd, pagesize;
158a158,159
> ATF_REQUIRE(0 < (pagesize = getpagesize()));
>
166c167
< page = mmap(0, getpagesize(), PROT_READ, MAP_SHARED, fd, 0);
---
> page = mmap(0, pagesize, PROT_READ, MAP_SHARED, fd, 0);
173c174,175
< munmap(page, getpagesize());
---
> ATF_REQUIRE_MSG(munmap(page, pagesize) == 0, "munmap failed; errno=%d",
> errno);
183c185
< int fd;
---
> int fd, pagesize;
184a187,188
> ATF_REQUIRE(0 < (pagesize = getpagesize()));
>
191,192c195
< page = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED, fd,
< 0);
---
> page = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
362,363c365,366
< char err_buf[1024], *page;
< int fd, status;
---
> char *page;
> int fd, pagesize, status;
364a368,369
> ATF_REQUIRE(0 < (pagesize = getpagesize()));
>
370c375
< if (ftruncate(fd, getpagesize()) < 0)
---
> if (ftruncate(fd, pagesize) < 0)
376c381
< if (sb.st_size != getpagesize())
---
> if (sb.st_size != pagesize)
378c383
< (int)sb.st_size, getpagesize());
---
> (int)sb.st_size, pagesize);
381,382c386
< page = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd,
< 0);
---
> page = mmap(0, pagesize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
388,389c392,393
< if (munmap(page, getpagesize()) < 0)
< atf_tc_fail("munmap(1) failed; errno=%d", errno);
---
> ATF_REQUIRE_MSG(munmap(page, pagesize) == 0, "munmap failed; errno=%d",
> errno);
392c396
< if (ftruncate(fd, getpagesize() * 2) < 0)
---
> if (ftruncate(fd, pagesize * 2) < 0)
398c402
< if (sb.st_size != getpagesize() * 2)
---
> if (sb.st_size != pagesize * 2)
400c404
< (int)sb.st_size, getpagesize() * 2);
---
> (int)sb.st_size, pagesize * 2);
403,404c407
< page = mmap(0, getpagesize() * 2, PROT_READ|PROT_WRITE, MAP_SHARED,
< fd, 0);
---
> page = mmap(0, pagesize * 2, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
412c415
< page[getpagesize()] = '2';
---
> page[pagesize] = '2';
415c418
< if (ftruncate(fd, getpagesize()) < 0)
---
> if (ftruncate(fd, pagesize) < 0)
421c424
< if (sb.st_size != getpagesize())
---
> if (sb.st_size != pagesize)
423c426
< (int)sb.st_size, getpagesize());
---
> (int)sb.st_size, pagesize);
438c441
< getrlimit(RLIMIT_CORE, &lim);
---
> ATF_REQUIRE(getrlimit(RLIMIT_CORE, &lim) == 0);
440c443
< setrlimit(RLIMIT_CORE, &lim);
---
> ATF_REQUIRE(setrlimit(RLIMIT_CORE, &lim) == 0);
447c450
< c = page[getpagesize()];
---
> c = page[pagesize];
459c462
< if (ftruncate(fd, getpagesize() * 2) < 0)
---
> if (ftruncate(fd, pagesize * 2) < 0)
465c468
< if (sb.st_size != getpagesize() * 2)
---
> if (sb.st_size != pagesize * 2)
467c470
< (int)sb.st_size, getpagesize());
---
> (int)sb.st_size, pagesize);
478c481
< if (page[getpagesize()] != 0)
---
> if (page[pagesize] != 0)
480c483
< getpagesize(), (int)page[getpagesize()]);
---
> pagesize, (int)page[pagesize]);
527c530
< } else if (scval <= 0 || (size_t)psize != psize) {
---
> } else if (scval <= 0) {
545,546c548
< region = mmap((void *)0, psize, PROT_READ | PROT_WRITE, MAP_SHARED,
< desc, (off_t)0);
---
> region = mmap(NULL, psize, PROT_READ | PROT_WRITE, MAP_SHARED, desc, 0);
603a606,609
>
> ATF_REQUIRE_MSG(munmap(region, psize) == 0, "munmap failed; errno=%d",
> errno);
> shm_unlink(test_path);