Home
last modified time | relevance | path

Searched refs:fildes (Results 1 – 25 of 53) sorted by relevance

123

/third_party/ltp/testcases/kernel/syscalls/dup2/
Ddup205.c19 static int *fildes; variable
26 fildes = SAFE_MALLOC((min + 10) * sizeof(int)); in setup()
27 memset(fildes, -1, (min + 10) * sizeof(int)); in setup()
33 if (fildes != NULL) in cleanup()
34 free(fildes); in cleanup()
41 fildes[0] = SAFE_CREAT(pfilname, 0666); in run()
42 fildes[fildes[0]] = fildes[0]; in run()
43 for (ifile = fildes[0] + 1; ifile < min + 10; ifile++) { in run()
44 TEST(dup2(fildes[ifile - 1], ifile)); in run()
45 fildes[ifile] = TST_RET; in run()
[all …]
/third_party/ltp/testcases/kernel/syscalls/pread/
Dpread01.c28 static int fildes; variable
61 SAFE_PREAD(1, fildes, read_buf[2], K1, K2); in verify_pread()
62 l_seek(fildes, 0, SEEK_CUR, K4); in verify_pread()
63 l_seek(fildes, 0, SEEK_SET, 0); in verify_pread()
65 SAFE_PREAD(1, fildes, read_buf[3], K1, K3); in verify_pread()
66 l_seek(fildes, 0, SEEK_CUR, 0); in verify_pread()
68 SAFE_READ(1, fildes, read_buf[0], K1); in verify_pread()
69 l_seek(fildes, 0, SEEK_CUR, K1); in verify_pread()
71 SAFE_PREAD(1, fildes, read_buf[1], K1, K1); in verify_pread()
72 l_seek(fildes, 0, SEEK_CUR, K1); in verify_pread()
[all …]
/third_party/ltp/testcases/kernel/syscalls/pwrite/
Dpwrite01.c29 static int fildes; variable
49 l_seek(fildes, count * K1, SEEK_SET, count * K1); in check_file_contents()
51 SAFE_READ(1, fildes, read_buf[count], K1); in check_file_contents()
65 SAFE_PWRITE(1, fildes, write_buf[0], K1, 0); in verify_pwrite()
66 l_seek(fildes, 0, SEEK_CUR, 0); in verify_pwrite()
67 l_seek(fildes, K1 / 2, SEEK_SET, K1 / 2); in verify_pwrite()
69 SAFE_PWRITE(1, fildes, write_buf[2], K1, K2); in verify_pwrite()
70 l_seek(fildes, 0, SEEK_CUR, K1 / 2); in verify_pwrite()
71 l_seek(fildes, K3, SEEK_SET, K3); in verify_pwrite()
73 SAFE_WRITE(1, fildes, write_buf[3], K1); in verify_pwrite()
[all …]
/third_party/ltp/testcases/kernel/syscalls/open/
Dopen09.c45 int fildes; in main() local
57 fildes = open(tempfile, O_WRONLY); in main()
58 if (fildes == -1) in main()
61 ret = read(fildes, pbuf, 1); in main()
67 close(fildes); in main()
69 fildes = open(tempfile, O_RDONLY); in main()
70 if (fildes == -1) { in main()
73 ret = write(fildes, pbuf, 1); in main()
79 close(fildes); in main()
88 int fildes; in setup() local
[all …]
/third_party/ltp/testcases/kernel/syscalls/pipe/
Dpipe04.c57 int fildes[2]; /* fds for pipe read and write */ variable
88 maybe_run_child(&c1func, "ndd", 1, &fildes[0], &fildes[1]); in main()
89 maybe_run_child(&c2func, "ndd", 2, &fildes[0], &fildes[1]); in main()
99 SAFE_PIPE(cleanup, fildes); in main()
106 if (self_exec(av[0], "ndd", 1, fildes[0], fildes[1]) < in main()
118 if (self_exec(av[0], "ndd", 2, fildes[0], fildes[1]) < in main()
127 if (close(fildes[1]) == -1) in main()
134 bytesread = do_read(fildes[0], rbuf, sizeof(rbuf)); in main()
222 if (close(fildes[0]) == -1) in c1func()
225 if (write(fildes[1], "bbbbbbbbbbbbbbbbbbbbbbbbb", 25) == -1) in c1func()
[all …]
/third_party/ltp/include/
Dtst_safe_prw.h9 char len_strict, int fildes, void *buf, size_t nbyte, in safe_pread() argument
14 rval = pread(fildes, buf, nbyte, offset); in safe_pread()
19 fildes, buf, nbyte, (long long)offset); in safe_pread()
23 fildes, buf, nbyte, (long long)offset, rval); in safe_pread()
28 #define SAFE_PREAD(len_strict, fildes, buf, nbyte, offset) \ argument
29 safe_pread(__FILE__, __LINE__, (len_strict), (fildes), \
33 char len_strict, int fildes, const void *buf, size_t nbyte, in safe_pwrite() argument
38 rval = pwrite(fildes, buf, nbyte, offset); in safe_pwrite()
42 fildes, buf, nbyte, (long long)offset); in safe_pwrite()
46 fildes, buf, nbyte, (long long)offset, rval); in safe_pwrite()
[all …]
/third_party/ltp/testcases/kernel/syscalls/fork/
Dfork10.c61 int status, pid, fildes; in main() local
67 fildes = -1; in main()
76 fildes = SAFE_CREAT(cleanup, fnamebuf, 0600); in main()
77 write(fildes, "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 27); in main()
78 close(fildes); in main()
80 fildes = SAFE_OPEN(cleanup, fnamebuf, 0); in main()
88 if (lseek(fildes, 10L, 0) == -1L) { in main()
102 if (read(fildes, chilchar, 1) <= 0) { in main()
122 if (read(fildes, parchar, 1) <= 0) { in main()
127 write(fildes, parchar, 1); in main()
[all …]
Dfork01.c115 int fildes; in child_pid() local
118 fildes = creat(FILENAME, 0700); in child_pid()
120 write(fildes, tmp_line, LINE_SZ); in child_pid()
121 close(fildes); in child_pid()
133 int fildes; in parent_pid() local
137 fildes = open(FILENAME, O_RDWR); in parent_pid()
138 if (fildes == -1) { in parent_pid()
143 if (read(fildes, tmp_line, LINE_SZ) == 0) { in parent_pid()
159 close(fildes); in parent_pid()
Dfork04.c140 int fildes; in child_environment() local
145 fildes = creat(OUTPUT_FILE, 0700); in child_environment()
157 write(fildes, msg, sizeof(msg)); in child_environment()
160 close(fildes); in child_environment()
238 int fildes; in parent_environment() local
245 fildes = SAFE_OPEN(cleanup, OUTPUT_FILE, O_RDWR); in parent_environment()
247 ret = read(fildes, tmp_line, MAX_LINE_LENGTH); in parent_environment()
267 close(fildes); in parent_environment()
/third_party/ltp/testcases/kernel/syscalls/poll/
Dpoll01.c22 static int fildes[2]; variable
27 {.fd = fildes[1], .events = POLLOUT}, in verify_pollout()
51 {.fd = fildes[0], .events = POLLIN}, in verify_pollin()
54 SAFE_WRITE(1, fildes[1], write_buf, sizeof(write_buf)); in verify_pollin()
72 SAFE_READ(1, fildes[0], read_buf, sizeof(write_buf)); in verify_pollin()
89 SAFE_PIPE(fildes); in setup()
94 if (fildes[0] > 0) in cleanup()
95 SAFE_CLOSE(fildes[0]); in cleanup()
97 if (fildes[1] > 0) in cleanup()
98 SAFE_CLOSE(fildes[1]); in cleanup()
/third_party/ltp/testcases/kernel/syscalls/dup/
Ddup06.c56 int *fildes, i; in main() local
68 fildes = malloc((min + 5) * sizeof(int)); in main()
71 fildes[i] = 0; in main()
76 if ((fildes[0] = creat(pfilname, 0666)) == -1) { in main()
80 if ((fildes[i] = dup(fildes[i - 1])) == -1) in main()
95 if (fildes[i] != 0 && fildes[i] != -1) in main()
96 close(fildes[i]); in main()
98 fildes[i] = 0; in main()
/third_party/ltp/testcases/kernel/syscalls/mmap/
Dmmap04.c60 static int fildes; variable
83 MAP_FILE | MAP_SHARED, fildes, 0); in main()
95 if (read(fildes, dummy, page_sz) < 0) { in main()
144 if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { in setup()
150 if (write(fildes, tst_buff, page_sz) < (ssize_t)page_sz) { in setup()
159 if (fchmod(fildes, 0555) < 0) { in setup()
164 if (close(fildes) < 0) { in setup()
174 if ((fildes = open(TEMPFILE, O_RDONLY)) < 0) { in setup()
182 close(fildes); in cleanup()
Dmmap02.c56 static int fildes; variable
79 MAP_FILE | MAP_SHARED, fildes, 0); in main()
91 if (read(fildes, dummy, page_sz) < 0) { in main()
140 if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) { in setup()
147 if (write(fildes, tst_buff, page_sz) < (int)page_sz) { in setup()
157 if (fchmod(fildes, 0444) < 0) { in setup()
163 if (close(fildes) < 0) { in setup()
169 if ((fildes = open(TEMPFILE, O_RDONLY)) < 0) { in setup()
183 close(fildes); in cleanup()
Dmmap03.c63 static int fildes; variable
89 MAP_FILE | MAP_SHARED, fildes, 0); in main()
102 if (read(fildes, dummy, page_sz) < 0) { in main()
171 if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { in setup()
178 if (write(fildes, tst_buff, page_sz) < (long)page_sz) { in setup()
188 if (fchmod(fildes, 0555) < 0) { in setup()
193 if (close(fildes) < 0) { in setup()
204 if ((fildes = open(TEMPFILE, O_RDONLY)) < 0) { in setup()
227 close(fildes); in cleanup()
Dmmap05.c59 static int fildes; variable
86 MAP_FILE | MAP_SHARED, fildes, 0); in main()
149 if ((fildes = open(TEMPFILE, O_WRONLY | O_CREAT, 0666)) < 0) { in setup()
156 if (write(fildes, tst_buff, page_sz) != (int)page_sz) { in setup()
165 if (fchmod(fildes, 0444) < 0) { in setup()
171 if (close(fildes) < 0) { in setup()
177 if ((fildes = open(TEMPFILE, O_RDONLY)) < 0) { in setup()
203 close(fildes); in cleanup()
Dmmap13.c51 static int fildes; variable
72 MAP_FILE | MAP_SHARED, fildes, 0); in main()
113 fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0766); in setup()
114 if (fildes < 0) in setup()
118 if (ftruncate(fildes, page_sz / 2) == -1) in setup()
140 close(fildes); in cleanup()
Dmmap12.c36 static int fildes; variable
98 MAP_PRIVATE | MAP_POPULATE, fildes, 0); in verify_mmap()
122 fildes = SAFE_OPEN(TEMPFILE, O_RDWR | O_CREAT, 0766); in setup()
124 SAFE_FTRUNCATE(fildes, MMAPSIZE); in setup()
129 if (fildes > 0) in cleanup()
130 SAFE_CLOSE(fildes); in cleanup()
/third_party/ltp/testcases/kernel/syscalls/llseek/
Dllseek01.c26 static int fildes; variable
30 TEST(lseek64(fildes, (loff_t) (80 * BUFSIZ), SEEK_SET)); in verify_llseek()
36 if (write(fildes, write_buff, BUFSIZ) == -1) in verify_llseek()
41 TEST(lseek64(fildes, (loff_t) BUFSIZ, SEEK_SET)); in verify_llseek()
47 if (write(fildes, write_buff, BUFSIZ) != -1) in verify_llseek()
52 if (write(fildes, write_buff, BUFSIZ) == -1) in verify_llseek()
71 fildes = SAFE_OPEN(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE); in setup()
73 SAFE_WRITE(1, fildes, write_buff, BUFSIZ); in setup()
/third_party/ltp/testcases/kernel/syscalls/mremap/
Dmremap01.c94 int fildes; /* file descriptor for tempfile */ variable
179 if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) in setup()
184 if (lseek(fildes, (off_t) memsize, SEEK_SET) != (off_t) memsize) { in setup()
190 if (write(fildes, "\0", 1) != 1) { in setup()
198 addr = mmap(0, memsize, PROT_WRITE, MAP_SHARED, fildes, 0); in setup()
206 if (lseek(fildes, (off_t) newsize, SEEK_SET) != (off_t) newsize) { in setup()
212 if (write(fildes, "\0", 1) != 1) { in setup()
234 SAFE_CLOSE(NULL, fildes); in cleanup()
/third_party/ltp/testcases/kernel/syscalls/msync/
Dmsync02.c82 int fildes; /* file descriptor for tempfile */ variable
120 if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) in setup()
125 if ((nwrite = write(fildes, tst_buf, sizeof(tst_buf))) <= 0) in setup()
132 fildes, 0); in setup()
138 if (lseek(fildes, 100, SEEK_SET) != 100) in setup()
142 if (write(fildes, write_buf, strlen(write_buf)) != (long)strlen(write_buf)) in setup()
152 if (close(fildes) == -1) in cleanup()
Dmsync01.c83 int fildes; /* file descriptor for tempfile */ variable
110 if (lseek(fildes, (off_t) 100, SEEK_SET) != 100) in main()
119 nread = read(fildes, read_buf, sizeof(read_buf)); in main()
166 if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) in setup()
170 nwrite = write(fildes, write_buf, sizeof(write_buf)); in setup()
182 fildes, 0); in setup()
197 if (close(fildes) == -1) in cleanup()
/third_party/ltp/testcases/kernel/syscalls/munmap/
Dmunmap01.c86 int fildes; /* file descriptor for tempfile */ variable
176 if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) { in setup()
185 SAFE_LSEEK(cleanup, fildes, map_len, SEEK_SET); in setup()
188 if (write(fildes, "a", 1) != 1) { in setup()
201 MAP_FILE | MAP_PRIVATE, fildes, 0); in setup()
204 MAP_FILE | MAP_SHARED, fildes, 0); in setup()
243 if (close(fildes) < 0) { in cleanup()
Dmunmap02.c88 int fildes; /* file descriptor for tempfile */ variable
180 if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) { in setup()
189 SAFE_LSEEK(cleanup, fildes, map_len, SEEK_SET); in setup()
192 if (write(fildes, "a", 1) != 1) { in setup()
205 MAP_FILE | MAP_PRIVATE, fildes, 0); in setup()
208 MAP_FILE | MAP_SHARED, fildes, 0); in setup()
267 SAFE_CLOSE(NULL, fildes); in cleanup()
/third_party/ltp/testcases/kernel/syscalls/mount/
Dmount03.c66 static int fildes; variable
201 fildes = open(file, O_RDWR | O_CREAT, FILE_MODE); in test_rwflag()
202 if (fildes == -1) { in test_rwflag()
210 if (write(fildes, write_buffer, strlen(write_buffer)) != in test_rwflag()
213 close(fildes); in test_rwflag()
218 if (lseek(fildes, 0, SEEK_SET) < 0) { in test_rwflag()
221 close(fildes); in test_rwflag()
226 if (read(fildes, read_buffer, sizeof(read_buffer)) > 0) { in test_rwflag()
230 close(fildes); in test_rwflag()
233 close(fildes); in test_rwflag()
[all …]
/third_party/ltp/testcases/kernel/syscalls/fstat/
Dfstat02.c26 static int fildes; variable
32 TEST(fstat(fildes, &stat_buf)); in run()
77 fildes = SAFE_OPEN(TESTFILE, O_WRONLY | O_CREAT, FILE_MODE); in setup()
85 if (fildes > 0) in cleanup()
86 SAFE_CLOSE(fildes); in cleanup()

123