Lines Matching full:fd
41 int fd; in ATF_TC_BODY() local
44 ATF_REQUIRE((fd = memfd_create("...", 0)) != -1); in ATF_TC_BODY()
47 ATF_REQUIRE(write(fd, buf, sizeof(buf)) == sizeof(buf)); in ATF_TC_BODY()
48 ATF_REQUIRE(fstat(fd, &sb) == 0); in ATF_TC_BODY()
52 ATF_REQUIRE(ftruncate(fd, 2 * (sizeof(buf) - 1)) == 0); in ATF_TC_BODY()
55 ATF_REQUIRE(write(fd, buf, sizeof(buf)) == sizeof(buf)); in ATF_TC_BODY()
58 ATF_REQUIRE(fstat(fd, &sb) == 0); in ATF_TC_BODY()
61 close(fd); in ATF_TC_BODY()
82 int fd; in ATF_TC_BODY() local
84 ATF_REQUIRE((fd = memfd_create("...", 0)) != -1); in ATF_TC_BODY()
85 ATF_REQUIRE(fcntl(fd, F_GET_SEALS) == F_SEAL_SEAL); in ATF_TC_BODY()
86 ATF_REQUIRE(fcntl(fd, F_ADD_SEALS, F_SEAL_WRITE) == -1); in ATF_TC_BODY()
89 close(fd); in ATF_TC_BODY()
97 int fd; in ATF_TC_BODY() local
100 ATF_REQUIRE((fd = memfd_create("...", MFD_ALLOW_SEALING)) != -1); in ATF_TC_BODY()
101 ATF_REQUIRE(ftruncate(fd, BUF_SIZE) == 0); in ATF_TC_BODY()
104 ATF_REQUIRE(write(fd, buf, BUF_SIZE) == BUF_SIZE); in ATF_TC_BODY()
105 ATF_REQUIRE(lseek(fd, 0, SEEK_SET) == 0); in ATF_TC_BODY()
107 addr = mmap(0, BUF_SIZE, (PROT_READ | PROT_WRITE), MAP_PRIVATE, fd, 0); in ATF_TC_BODY()
111 ATF_REQUIRE(fcntl(fd, F_ADD_SEALS, F_SEAL_WRITE) == 0); in ATF_TC_BODY()
113 ATF_REQUIRE(write(fd, buf, BUF_SIZE) == -1); in ATF_TC_BODY()
117 fd, 0) == MAP_FAILED); in ATF_TC_BODY()
120 close(fd); in ATF_TC_BODY()
126 int fd; in ATF_TC_BODY() local
129 ATF_REQUIRE((fd = memfd_create("...", MFD_ALLOW_SEALING)) != -1); in ATF_TC_BODY()
130 ATF_REQUIRE(ftruncate(fd, BUF_SIZE) == 0); in ATF_TC_BODY()
133 addr = mmap(0, BUF_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0); in ATF_TC_BODY()
135 paddr = mmap(0, BUF_SIZE, (PROT_READ | PROT_WRITE), MAP_PRIVATE, fd, 0); in ATF_TC_BODY()
137 raddr = mmap(0, BUF_SIZE, PROT_READ, MAP_SHARED, fd, 0); in ATF_TC_BODY()
141 ATF_REQUIRE(fcntl(fd, F_ADD_SEALS, F_SEAL_WRITE) == -1); in ATF_TC_BODY()
148 * a r/w fd. in ATF_TC_BODY()
150 ATF_REQUIRE(fcntl(fd, F_ADD_SEALS, F_SEAL_WRITE) == -1); in ATF_TC_BODY()
155 ATF_REQUIRE(fcntl(fd, F_ADD_SEALS, F_SEAL_WRITE) == 0); in ATF_TC_BODY()
159 fd, 0) == MAP_FAILED); in ATF_TC_BODY()
163 paddr = mmap(0, BUF_SIZE, (PROT_READ | PROT_WRITE), MAP_PRIVATE, fd, 0); in ATF_TC_BODY()
165 raddr = mmap(0, BUF_SIZE, PROT_READ, MAP_SHARED, fd, 0); in ATF_TC_BODY()
170 close(fd); in ATF_TC_BODY()
176 int err, fd; in memfd_truncate_test() local
178 ATF_REQUIRE((fd = memfd_create("...", MFD_ALLOW_SEALING)) != -1); in memfd_truncate_test()
179 ATF_REQUIRE(ftruncate(fd, initial_size) == 0); in memfd_truncate_test()
181 ATF_REQUIRE(fcntl(fd, F_ADD_SEALS, seals) == 0); in memfd_truncate_test()
183 err = ftruncate(fd, dest_size); in memfd_truncate_test()
186 close(fd); in memfd_truncate_test()
210 int fd; in ATF_TC_BODY() local
213 ATF_REQUIRE((fd = memfd_create("...", MFD_ALLOW_SEALING)) != -1); in ATF_TC_BODY()
214 ATF_REQUIRE(fcntl(fd, F_GET_SEALS) == 0); in ATF_TC_BODY()
216 ATF_REQUIRE(fcntl(fd, F_ADD_SEALS, F_SEAL_WRITE | F_SEAL_GROW) == 0); in ATF_TC_BODY()
217 seals = fcntl(fd, F_GET_SEALS); in ATF_TC_BODY()
220 close(fd); in ATF_TC_BODY()
227 int fd, fdx; in ATF_TC_BODY() local
230 ATF_REQUIRE((fd = memfd_create("...", MFD_ALLOW_SEALING)) != -1); in ATF_TC_BODY()
231 ATF_REQUIRE((fdx = dup(fd)) != -1); in ATF_TC_BODY()
232 ATF_REQUIRE(fcntl(fd, F_GET_SEALS) == 0); in ATF_TC_BODY()
234 ATF_REQUIRE(fcntl(fd, F_ADD_SEALS, F_SEAL_WRITE | F_SEAL_GROW) == 0); in ATF_TC_BODY()
235 seals = fcntl(fd, F_GET_SEALS); in ATF_TC_BODY()
249 close(fd); in ATF_TC_BODY()
256 int fd; in ATF_TC_BODY() local
258 ATF_REQUIRE((fd = memfd_create("...", MFD_ALLOW_SEALING)) != -1); in ATF_TC_BODY()
260 ATF_REQUIRE(fcntl(fd, F_ADD_SEALS, F_SEAL_SEAL) == 0); in ATF_TC_BODY()
261 ATF_REQUIRE(fcntl(fd, F_ADD_SEALS, F_SEAL_GROW) == -1); in ATF_TC_BODY()
265 close(fd); in ATF_TC_BODY()
271 ATF_REQUIRE((fd = memfd_create("...", MFD_ALLOW_SEALING)) != -1); in ATF_TC_BODY()
273 ATF_REQUIRE(fcntl(fd, F_ADD_SEALS, F_SEAL_GROW | F_SEAL_SEAL) == 0); in ATF_TC_BODY()
274 ATF_REQUIRE(fcntl(fd, F_ADD_SEALS, F_SEAL_GROW) == -1); in ATF_TC_BODY()
277 close(fd); in ATF_TC_BODY()