Lines Matching +full:close +full:- +full:range

1 /*-
50 #include <atf-c.h>
66 ATF_REQUIRE_MSG(mkstemp(path) != -1, in gen_a_test_path()
93 ATF_CHECK_MSG(fd == -1, "shm_open didn't fail"); in shm_open_should_fail()
106 ATF_CHECK_MSG(shm_unlink(path) == -1, "shm_unlink didn't fail"); in shm_unlink_should_fail()
114 * on success and -1 on failure.
175 close(fd); in verify_object()
201 len -= blen; in shm_fill()
228 hole_len = shm_sz - hole_start; in check_content_dealloc()
245 resid -= blen; in check_content_dealloc()
266 resid -= blen; in check_content_dealloc()
274 resid = shm_sz - offset; in check_content_dealloc()
285 resid -= blen; in check_content_dealloc()
292 if (fstat(fd, &statbuf) == -1) in check_content_dealloc()
293 error = -1; in check_content_dealloc()
295 error = -1; in check_content_dealloc()
319 close(fd); in ATF_TC_BODY()
323 ATF_REQUIRE_MSG(shm_unlink(test_path) != -1, in ATF_TC_BODY()
334 if (rc != -1) in ATF_TC_BODY()
348 if (rc != -1) in ATF_TC_BODY()
352 if (rc != -1) in ATF_TC_BODY()
364 if (rc != -1) in ATF_TC_BODY()
379 if (rc != -1) in ATF_TC_BODY()
395 close(fd); in ATF_TC_BODY()
400 close(fd2); in ATF_TC_BODY()
422 close(fd_from); in ATF_TC_BODY()
428 close(fd_to); in ATF_TC_BODY()
431 ATF_REQUIRE_MSG((rc == -1) && (errno == EEXIST), in ATF_TC_BODY()
451 close(fd_from); in ATF_TC_BODY()
457 close(fd_to); in ATF_TC_BODY()
478 close(fd_from); in ATF_TC_BODY()
500 close(fd); in ATF_TC_BODY()
518 close(fd); in ATF_TC_BODY()
520 close(fd); in ATF_TC_BODY()
527 ATF_REQUIRE_MSG((rc == -1) && (errno == EINVAL), in ATF_TC_BODY()
542 close(fd); in ATF_TC_BODY()
557 close(fd); in ATF_TC_BODY()
558 ATF_REQUIRE_MSG(shm_unlink(test_path) != -1, in ATF_TC_BODY()
584 close(fd); in ATF_TC_BODY()
585 ATF_REQUIRE_MSG(shm_unlink(test_path) != -1, in ATF_TC_BODY()
598 close(fd); in ATF_TC_BODY()
600 ATF_REQUIRE_MSG(shm_unlink(test_path) != -1, "shm_unlink failed: %d", in ATF_TC_BODY()
638 close(fd); in ATF_TC_BODY()
683 close(fd); in ATF_TC_BODY()
688 ATF_REQUIRE_MSG(shm_unlink(test_path) != -1, in ATF_TC_BODY()
703 ATF_REQUIRE_MSG(ftruncate(fd, 1024) != -1, in ATF_TC_BODY()
705 ATF_REQUIRE_MSG(fstat(fd, &sb) != -1, in ATF_TC_BODY()
708 close(fd); in ATF_TC_BODY()
713 ATF_REQUIRE_MSG(fstat(fd, &sb) != -1, in ATF_TC_BODY()
717 close(fd); in ATF_TC_BODY()
718 ATF_REQUIRE_MSG(shm_unlink(test_path) != -1, in ATF_TC_BODY()
814 if (pid == -1) in ATF_TC_BODY()
860 * grown are zero-filled. in ATF_TC_BODY()
866 close(fd); in ATF_TC_BODY()
891 (long)_POSIX_SHARED_MEMORY_OBJECTS - 0); in ATF_TC_BODY()
892 if (_POSIX_SHARED_MEMORY_OBJECTS - 0 == -1) in ATF_TC_BODY()
897 if (scval == -1 && errno != 0) { in ATF_TC_BODY()
903 if (scval == -1) in ATF_TC_BODY()
909 if (scval == -1 && errno != 0) { in ATF_TC_BODY()
926 ATF_REQUIRE_MSG(ftruncate(desc, (off_t)psize) != -1, in ATF_TC_BODY()
945 ATF_REQUIRE_MSG(rv != -1, "fork failed; errno=%d", errno); in ATF_TC_BODY()
954 if (lseek(desc, 0, SEEK_SET) == -1) in ATF_TC_BODY()
965 memset(region, '\151', psize - 2); in ATF_TC_BODY()
966 error = pwrite(desc, region, 2, psize - 2); in ATF_TC_BODY()
1004 close(fd); in ATF_TC_BODY()
1010 close(fd); in ATF_TC_BODY()
1028 close(fd); in ATF_TC_BODY()
1035 close(fd); in ATF_TC_BODY()
1042 close(fd); in ATF_TC_BODY()
1057 * as needed in a race-free way. in ATF_TC_BODY()
1083 close(fd); in ATF_TC_BODY()
1089 struct spacectl_range range; in ATF_TC_BODY() local
1104 range.r_offset = offset = page_size; in ATF_TC_BODY()
1105 range.r_len = length = ((shm_max_pages - 1) * page_size) - in ATF_TC_BODY()
1106 range.r_offset; in ATF_TC_BODY()
1107 ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, in ATF_TC_BODY()
1114 range.r_offset = offset = page_size / 2; in ATF_TC_BODY()
1115 range.r_len = length = (shm_max_pages - 1) * page_size + in ATF_TC_BODY()
1116 (page_size / 2) - offset; in ATF_TC_BODY()
1117 ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, in ATF_TC_BODY()
1124 range.r_offset = offset = page_size; in ATF_TC_BODY()
1125 range.r_len = length = OFF_MAX - offset; in ATF_TC_BODY()
1126 ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, in ATF_TC_BODY()
1133 range.r_offset = offset = page_size / 2; in ATF_TC_BODY()
1134 range.r_len = length = OFF_MAX - offset; in ATF_TC_BODY()
1135 ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, in ATF_TC_BODY()
1142 range.r_offset = offset = page_size; in ATF_TC_BODY()
1143 range.r_len = length = (shm_max_pages + 1) * page_size - offset; in ATF_TC_BODY()
1144 ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, in ATF_TC_BODY()
1151 range.r_offset = offset = page_size / 2; in ATF_TC_BODY()
1152 range.r_len = length = (shm_max_pages + 1) * page_size - offset; in ATF_TC_BODY()
1153 ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, in ATF_TC_BODY()
1158 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1164 struct spacectl_range range; in ATF_TC_BODY() local
1182 range.r_offset = page_size; in ATF_TC_BODY()
1183 range.r_len = len = (shm_max_pages - 1) * page_size - in ATF_TC_BODY()
1184 range.r_offset; in ATF_TC_BODY()
1185 ATF_CHECK_MSG(fspacectl(fd, SPACECTL_DEALLOC, &range, 0, &range) == 0, in ATF_TC_BODY()
1188 ATF_REQUIRE(st.st_blksize * st.st_blocks == (blkcnt_t)(shm_sz - len)); in ATF_TC_BODY()
1190 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1216 ATF_REQUIRE_MSG(close(fd) == 0, in ATF_TC_BODY()
1217 "close failed; errno=%d", errno); in ATF_TC_BODY()
1236 atf_tc_skip("failed to allocate %zu-byte superpage", sz); in shm_open_large()
1248 ATF_REQUIRE_MSG(pscnt != -1, "getpagesizes failed; errno=%d", errno); in pagesizes()
1274 ATF_REQUIRE_MSG(((uintptr_t)addr & (ps[i] - 1)) == 0, in ATF_TC_BODY()
1292 "page %zu is not in a %zu-byte superpage", in ATF_TC_BODY()
1304 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1335 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1360 ATF_REQUIRE(write(fd, buf, ps[0]) == -1); in ATF_TC_BODY()
1365 ATF_REQUIRE(write(fd, buf, ps[1]) == -1); in ATF_TC_BODY()
1372 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1393 addr = mmap(NULL, ps[i - 1], PROT_READ | PROT_WRITE, MAP_SHARED, in ATF_TC_BODY()
1396 "mmap(%zu bytes) succeeded", ps[i - 1]); in ATF_TC_BODY()
1398 "mmap(%zu bytes) failed; error=%d", ps[i - 1], errno); in ATF_TC_BODY()
1407 ATF_REQUIRE_MSG(((uintptr_t)addr & (ps[i] - 1)) == 0, in ATF_TC_BODY()
1412 addr1 = mmap(addr, ps[i - 1], PROT_READ | PROT_WRITE, in ATF_TC_BODY()
1413 MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0); in ATF_TC_BODY()
1415 "anon mmap(%zu bytes) succeeded", ps[i - 1]); in ATF_TC_BODY()
1438 MAP_ANON | MAP_PRIVATE | MAP_ALIGNED(ffsl(ps[i]) - 1), -1, in ATF_TC_BODY()
1460 * Copy-on-write mappings are not permitted. in ATF_TC_BODY()
1467 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1481 ps1 = ps[i - 1]; in ATF_TC_BODY()
1492 ATF_REQUIRE(munmap(addr, ps[i] - ps1)); in ATF_TC_BODY()
1503 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1564 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1600 if (ps[i] / ps[0] > max_wired - wired) { in ATF_TC_BODY()
1614 ATF_REQUIRE(mlock(addr, ps[i] - ps[0]) != 0); in ATF_TC_BODY()
1630 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1652 * "Sync" requests are no-ops for SHM objects, so small in ATF_TC_BODY()
1653 * PAGE_SIZE-sized requests succeed. in ATF_TC_BODY()
1674 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1707 MAP_ANON | MAP_ALIGNED(ffsl(ps[i]) - 1), -1, 0); in ATF_TC_BODY()
1719 * These should be no-ops from the pmap perspective since the in ATF_TC_BODY()
1750 largepage_protect(addr1 - ps[0], ps[0] * 2, in ATF_TC_BODY()
1758 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1783 ATF_REQUIRE_MSG(child != -1, "fork failed; error=%d", errno); in ATF_TC_BODY()
1804 ATF_REQUIRE_MSG(child != -1, "fork failed; error=%d", errno); in ATF_TC_BODY()
1819 /* Copy-on-write is not supported for static large pages. */ in ATF_TC_BODY()
1826 ATF_REQUIRE_MSG(child != -1, "fork failed; error=%d", errno); in ATF_TC_BODY()
1845 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1872 ATF_REQUIRE_MSG(child != -1, "fork() failed; error=%d", errno); in ATF_TC_BODY()
1877 (void)close(pfd[0]); in ATF_TC_BODY()
1878 for (resid = (size_t)ps[i]; resid > 0; resid -= len) { in ATF_TC_BODY()
1885 ATF_REQUIRE(close(pfd[1]) == 0); in ATF_TC_BODY()
1890 ATF_REQUIRE(close(pfd[0]) == 0); in ATF_TC_BODY()
1900 ATF_REQUIRE(close(fd) == 0); in ATF_TC_BODY()
1924 ATF_REQUIRE_MSG(close(fd) == 0, "close failed; error=%d", errno); in ATF_TC_BODY()
1940 "page not mapped into a %zu-byte superpage", ps[psind]); in ATF_TC_BODY()
1944 ATF_REQUIRE_MSG(close(fd) == 0, in ATF_TC_BODY()
1945 "close failed; errno=%d", errno); in ATF_TC_BODY()