Lines Matching full:fd
16 int fd = 0; in test_file_open_flags() local
22 fd = open(THE_FILE, 0); in test_file_open_flags()
23 if (fd >= 0 || errno != ENOENT) { in test_file_open_flags()
24 TC_PRINT("Expected fail; fd = %d, errno = %d\n", fd, errno); in test_file_open_flags()
25 if (fd >= 0) { in test_file_open_flags()
26 close(fd); in test_file_open_flags()
32 fd = open(THE_FILE, O_RDONLY); in test_file_open_flags()
33 if (fd >= 0 || errno != ENOENT) { in test_file_open_flags()
34 TC_PRINT("Expected fail; fd = %d, errno = %d\n", fd, errno); in test_file_open_flags()
35 if (fd >= 0) { in test_file_open_flags()
36 close(fd); in test_file_open_flags()
41 fd = open(THE_FILE, O_WRONLY); in test_file_open_flags()
42 if (fd >= 0 || errno != ENOENT) { in test_file_open_flags()
43 TC_PRINT("Expected fail; fd = %d, errno = %d\n", fd, errno); in test_file_open_flags()
44 if (fd >= 0) { in test_file_open_flags()
45 close(fd); in test_file_open_flags()
51 fd = open(THE_FILE, O_RDWR); in test_file_open_flags()
52 if (fd >= 0 || errno != ENOENT) { in test_file_open_flags()
53 TC_PRINT("Expected fail; fd = %d, errno = %d\n", fd, errno); in test_file_open_flags()
54 if (fd >= 0) { in test_file_open_flags()
55 close(fd); in test_file_open_flags()
63 fd = open(THE_FILE, O_CREAT | O_WRONLY, 0440); in test_file_open_flags()
64 if (fd < 0) { in test_file_open_flags()
65 TC_PRINT("Expected success; fd = %d, errno = %d\n", fd, errno); in test_file_open_flags()
70 ret = read(fd, &data, sizeof(data)); in test_file_open_flags()
73 close(fd); in test_file_open_flags()
78 ret = write(fd, &data, sizeof(data)); in test_file_open_flags()
82 close(fd); in test_file_open_flags()
86 close(fd); in test_file_open_flags()
92 fd = open(THE_FILE, 0); in test_file_open_flags()
93 if (fd < 0) { in test_file_open_flags()
94 TC_PRINT("Expected success, fd = %d, errno = %d\n", fd, errno); in test_file_open_flags()
99 ret = read(fd, &data, sizeof(data)); in test_file_open_flags()
103 close(fd); in test_file_open_flags()
108 ret = write(fd, &data, sizeof(data)); in test_file_open_flags()
111 close(fd); in test_file_open_flags()
115 close(fd); in test_file_open_flags()
121 fd = open(THE_FILE, O_RDONLY); in test_file_open_flags()
122 if (fd < 0) { in test_file_open_flags()
123 TC_PRINT("Expected success, fd = %d, errno = %d\n", fd, errno); in test_file_open_flags()
128 ret = read(fd, &data, sizeof(data)); in test_file_open_flags()
132 close(fd); in test_file_open_flags()
137 ret = write(fd, &data, sizeof(data)); in test_file_open_flags()
140 close(fd); in test_file_open_flags()
144 close(fd); in test_file_open_flags()
150 fd = open(THE_FILE, O_WRONLY); in test_file_open_flags()
151 if (fd < 0) { in test_file_open_flags()
152 TC_PRINT("Expected success, fd = %d, errno = %d\n", fd, errno); in test_file_open_flags()
157 ret = read(fd, &data, sizeof(data)); in test_file_open_flags()
160 close(fd); in test_file_open_flags()
165 ret = write(fd, &data, sizeof(data)); in test_file_open_flags()
169 close(fd); in test_file_open_flags()
173 close(fd); in test_file_open_flags()
178 fd = open(THE_FILE, O_APPEND | O_WRONLY); in test_file_open_flags()
179 if (fd < 0) { in test_file_open_flags()
180 TC_PRINT("Expected success, fd = %d, errno = %d\n", fd, errno); in test_file_open_flags()
185 ret = read(fd, &data, sizeof(data)); in test_file_open_flags()
188 close(fd); in test_file_open_flags()
193 ret = write(fd, &data, sizeof(data)); in test_file_open_flags()
197 close(fd); in test_file_open_flags()
201 close(fd); in test_file_open_flags()
206 fd = open(THE_FILE, O_APPEND | O_RDWR); in test_file_open_flags()
207 if (fd < 0) { in test_file_open_flags()
208 TC_PRINT("Expected success, fd = %d, errno = %d\n", fd, errno); in test_file_open_flags()
214 lseek(fd, 0, SEEK_SET); in test_file_open_flags()
215 ret = read(fd, &data, sizeof(data)); in test_file_open_flags()
219 close(fd); in test_file_open_flags()
224 ret = write(fd, &data, sizeof(data)); in test_file_open_flags()
228 close(fd); in test_file_open_flags()
232 close(fd); in test_file_open_flags()
239 fd = open(THE_FILE, O_CREAT | O_WRONLY, 0440); in test_file_open_flags()
240 if (fd < 0) { in test_file_open_flags()
241 TC_PRINT("Expected success, fd = %d, errno = %d\n", fd, errno); in test_file_open_flags()
245 ret = write(fd, &data, sizeof(data)); in test_file_open_flags()
249 close(fd); in test_file_open_flags()
253 close(fd); in test_file_open_flags()
255 fd = open(THE_FILE, O_APPEND | O_RDWR); in test_file_open_flags()
256 if (fd < 0) { in test_file_open_flags()
257 TC_PRINT("Expected success, fd = %d, errno = %d\n", fd, errno); in test_file_open_flags()
261 lseek(fd, 0, SEEK_SET); in test_file_open_flags()
262 ret = write(fd, &data, sizeof(data)); in test_file_open_flags()
266 close(fd); in test_file_open_flags()
270 ret = lseek(fd, 0, SEEK_END); in test_file_open_flags()
275 close(fd); in test_file_open_flags()
279 close(fd); in test_file_open_flags()