Lines Matching refs:fd
41 void* map = mmap(nullptr, 100, PROT_READ, MAP_SHARED, tf.fd, 1); in TEST()
48 void* map = mmap64(nullptr, 100, PROT_READ, MAP_SHARED, tf.fd, 1); in TEST()
60 ASSERT_EQ(STR_SSIZE(STRING_MSG), write(tf.fd, STRING_MSG, sizeof(STRING_MSG))); in TEST()
62 void* map = mmap(nullptr, sizeof(STRING_MSG), PROT_READ, MAP_SHARED, tf.fd, 0); in TEST()
74 ASSERT_EQ(STR_SSIZE(INITIAL_MSG), write(tf.fd, INITIAL_MSG, sizeof(INITIAL_MSG))); in TEST()
75 lseek(tf.fd, 0, SEEK_SET); in TEST()
77 void* map = mmap(nullptr, sizeof(STRING_MSG), PROT_WRITE, MAP_SHARED, tf.fd, 0); in TEST()
79 close(tf.fd); in TEST()
85 tf.fd = open(tf.path, O_RDWR); in TEST()
88 ASSERT_EQ(STR_SSIZE(STRING_MSG), read(tf.fd, buf, sizeof(STRING_MSG))); in TEST()
103 ASSERT_EQ(STR_SSIZE(PAGE0_MSG), write(tf.fd, PAGE0_MSG, sizeof(PAGE0_MSG))); in TEST()
104 ASSERT_NE(-1, lseek(tf.fd, pagesize, SEEK_SET)); in TEST()
105 ASSERT_EQ(STR_SSIZE(PAGE1_MSG), write(tf.fd, PAGE1_MSG, sizeof(PAGE1_MSG))); in TEST()
106 ASSERT_NE(-1, lseek(tf.fd, 2 * pagesize, SEEK_SET)); in TEST()
107 ASSERT_EQ(STR_SSIZE(PAGE2_MSG), write(tf.fd, PAGE2_MSG, sizeof(PAGE2_MSG))); in TEST()
108 ASSERT_NE(-1, lseek(tf.fd, 3 * pagesize - sizeof(END_MSG), SEEK_SET)); in TEST()
109 ASSERT_EQ(STR_SSIZE(END_MSG), write(tf.fd, END_MSG, sizeof(END_MSG))); in TEST()
111 ASSERT_NE(-1, lseek(tf.fd, 0, SEEK_SET)); in TEST()
113 void* map = mmap(nullptr, pagesize, PROT_READ, MAP_SHARED, tf.fd, pagesize); in TEST()
121 map = mmap(nullptr, pagesize, PROT_READ, MAP_SHARED, tf.fd, 2 * pagesize); in TEST()
139 ASSERT_EQ(STR_SSIZE(PAGE0_MSG), write(tf.fd, PAGE0_MSG, sizeof(PAGE0_MSG))); in TEST()
140 ASSERT_NE(-1, lseek(tf.fd, pagesize, SEEK_SET)); in TEST()
141 ASSERT_EQ(STR_SSIZE(PAGE1_MSG), write(tf.fd, PAGE1_MSG, sizeof(PAGE1_MSG))); in TEST()
142 ASSERT_NE(-1, lseek(tf.fd, 2 * pagesize, SEEK_SET)); in TEST()
143 ASSERT_EQ(STR_SSIZE(PAGE2_MSG), write(tf.fd, PAGE2_MSG, sizeof(PAGE2_MSG))); in TEST()
144 ASSERT_NE(-1, lseek(tf.fd, 3 * pagesize - sizeof(END_MSG), SEEK_SET)); in TEST()
145 ASSERT_EQ(STR_SSIZE(END_MSG), write(tf.fd, END_MSG, sizeof(END_MSG))); in TEST()
147 ASSERT_NE(-1, lseek(tf.fd, 0, SEEK_SET)); in TEST()
149 void* map = mmap(nullptr, pagesize, PROT_WRITE, MAP_SHARED, tf.fd, pagesize); in TEST()
151 close(tf.fd); in TEST()
156 tf.fd = open(tf.path, O_RDWR); in TEST()
157 map = mmap(nullptr, pagesize, PROT_WRITE, MAP_SHARED, tf.fd, 2 * pagesize); in TEST()
159 close(tf.fd); in TEST()
164 tf.fd = open(tf.path, O_RDWR); in TEST()
166 ASSERT_EQ(static_cast<ssize_t>(pagesize), read(tf.fd, buf, pagesize)); in TEST()
168 ASSERT_NE(-1, lseek(tf.fd, pagesize, SEEK_SET)); in TEST()
169 ASSERT_EQ(static_cast<ssize_t>(pagesize), read(tf.fd, buf, pagesize)); in TEST()
171 ASSERT_NE(-1, lseek(tf.fd, 2 * pagesize, SEEK_SET)); in TEST()
172 ASSERT_EQ(static_cast<ssize_t>(pagesize), read(tf.fd, buf, pagesize)); in TEST()
183 ASSERT_EQ(static_cast<ssize_t>(pagesize), write(tempfile.fd, buf, pagesize)); in TEST()
184 void* map = mmap(nullptr, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, tempfile.fd, 0); in TEST()
276 int fd = memfd_create("doesn't matter", 0); in TEST()
277 if (fd == -1) { in TEST()
281 int f = fcntl(fd, F_GETFD); in TEST()
284 close(fd); in TEST()
287 fd = memfd_create("doesn't matter", MFD_CLOEXEC); in TEST()
288 f = fcntl(fd, F_GETFD); in TEST()
294 ASSERT_TRUE(android::base::WriteStringToFd(expected, fd)); in TEST()
295 ASSERT_EQ(0, lseek(fd, 0, SEEK_SET)); in TEST()
297 ASSERT_TRUE(android::base::ReadFdToString(fd, &actual)); in TEST()
300 close(fd); in TEST()