Home
last modified time | relevance | path

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

12345

/external/ltp/testcases/kernel/syscalls/dup2/
Ddup205.c43 int *fildes; variable
74 if ((fildes[0] = creat(pfilname, 0666)) == -1) in main()
77 fildes[fildes[0]] = fildes[0]; in main()
78 for (ifile = fildes[0] + 1; ifile < min + 10; ifile++) { in main()
79 if ((fildes[ifile] = dup2(fildes[ifile - 1], in main()
84 if (fildes[ifile] != ifile) { in main()
88 fildes[ifile], ifile); in main()
106 for (ifile = fildes[0]; ifile < min + 10; ifile++) in main()
107 close(fildes[ifile]); in main()
124 fildes = malloc((min + 10) * sizeof(int)); in setup()
[all …]
/external/ltp/testcases/kernel/syscalls/pread/
Dpread01.c90 int fildes; /* file descriptor for tempfile */ variable
117 nread = pread(fildes, read_buf[2], K1, K2); in main()
129 l_seek(fildes, 0, SEEK_CUR, K4); in main()
132 l_seek(fildes, 0, SEEK_SET, 0); in main()
135 nread = pread(fildes, read_buf[3], K1, K3); in main()
142 l_seek(fildes, 0, SEEK_CUR, 0); in main()
149 if ((nread = read(fildes, read_buf[0], K1)) != K1) { in main()
155 l_seek(fildes, 0, SEEK_CUR, K1); in main()
158 nread = pread(fildes, read_buf[1], K1, K1); in main()
165 l_seek(fildes, 0, SEEK_CUR, K1); in main()
[all …]
/external/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 …]
/external/ltp/testcases/kernel/syscalls/pipe/
Dpipe04.c56 int fildes[2]; /* fds for pipe read and write */ variable
87 maybe_run_child(&c1func, "ndd", 1, &fildes[0], &fildes[1]); in main()
88 maybe_run_child(&c2func, "ndd", 2, &fildes[0], &fildes[1]); in main()
98 if (pipe(fildes) == -1) in main()
107 if (self_exec(av[0], "ndd", 1, fildes[0], fildes[1]) < in main()
119 if (self_exec(av[0], "ndd", 2, fildes[0], fildes[1]) < in main()
128 if (close(fildes[1]) == -1) in main()
135 bytesread = do_read(fildes[0], rbuf, sizeof(rbuf)); in main()
223 if (close(fildes[0]) == -1) in c1func()
226 if (write(fildes[1], "bbbbbbbbbbbbbbbbbbbbbbbbb", 25) == -1) in c1func()
[all …]
/external/ltp/testcases/kernel/syscalls/fork/
Dfork10.c60 int status, pid, fildes; in main() local
66 fildes = -1; in main()
75 fildes = creat(fnamebuf, 0600); in main()
76 if (fildes < 0) in main()
80 write(fildes, "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", 27); in main()
81 close(fildes); in main()
83 fildes = open(fnamebuf, 0); in main()
84 if (fildes == -1) in main()
94 if (lseek(fildes, 10L, 0) == -1L) { in main()
108 if (read(fildes, chilchar, 1) <= 0) { 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.c139 int fildes; in child_environment() local
144 fildes = creat(OUTPUT_FILE, 0700); in child_environment()
156 write(fildes, msg, sizeof(msg)); in child_environment()
159 close(fildes); in child_environment()
237 int fildes; in parent_environment() local
244 fildes = open(OUTPUT_FILE, O_RDWR); in parent_environment()
245 if (fildes == -1) { in parent_environment()
251 ret = read(fildes, tmp_line, MAX_LINE_LENGTH); in parent_environment()
271 close(fildes); in parent_environment()
/external/ltp/include/
Dtst_safe_prw.h22 char len_strict, int fildes, void *buf, size_t nbyte, in safe_pread() argument
27 rval = pread(fildes, buf, nbyte, offset); in safe_pread()
32 fildes, buf, nbyte, (long long)offset); in safe_pread()
37 #define SAFE_PREAD(len_strict, fildes, buf, nbyte, offset) \ argument
38 safe_pread(__FILE__, __LINE__, (len_strict), (fildes), \
42 char len_strict, int fildes, const void *buf, size_t nbyte, in safe_pwrite() argument
47 rval = pwrite(fildes, buf, nbyte, offset); in safe_pwrite()
51 fildes, buf, nbyte, (long long)offset); in safe_pwrite()
56 #define SAFE_PWRITE(len_strict, fildes, buf, nbyte, offset) \ argument
57 safe_pwrite(__FILE__, __LINE__, (len_strict), (fildes), \
/external/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()
/external/ltp/testcases/kernel/syscalls/pwrite/
Dpwrite01.c92 int fildes; /* file descriptor for tempfile */ variable
118 nwrite = pwrite(fildes, write_buf[0], K1, 0); in main()
128 l_seek(fildes, 0, SEEK_CUR, 0); in main()
134 l_seek(fildes, K1 / 2, SEEK_SET, K1 / 2); in main()
140 nwrite = pwrite(fildes, write_buf[2], K1, K2); in main()
149 l_seek(fildes, 0, SEEK_CUR, K1 / 2); in main()
152 l_seek(fildes, K3, SEEK_SET, K3); in main()
159 nwrite = write(fildes, write_buf[3], K1); in main()
167 l_seek(fildes, 0, SEEK_CUR, K4); in main()
170 nwrite = pwrite(fildes, write_buf[1], K1, K1); in main()
[all …]
/external/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) < 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) < 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) < 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) != 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()
/external/ltp/testcases/kernel/syscalls/lseek/
Dlseek09.c88 int fildes; /* file handle for temp file */ variable
112 TEST(lseek(fildes, 1, SEEK_CUR)); in main()
134 if (read(fildes, &read_buf, (file_size - 3)) < 0) { in main()
155 if (lseek(fildes, 2, SEEK_SET) == -1) { in main()
187 if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { in setup()
194 if (write(fildes, write_buf, strlen(write_buf)) <= 0) { in setup()
200 if (fstat(fildes, &stat_buf) < 0) { in setup()
211 if (lseek(fildes, 2, SEEK_SET) != 2) { in setup()
226 if (close(fildes) < 0) { in cleanup()
Dlseek07.c87 int fildes; /* file handle for temp file */ variable
116 TEST(lseek(fildes, offset, SEEK_SET)); in main()
138 if (write(fildes, write_buf2, strlen(write_buf2)) != in main()
148 if (close(fildes) < 0) { in main()
154 if ((fildes = open(TEMP_FILE, O_RDWR)) < 0) { in main()
164 if (read(fildes, &read_buf, (offset + in main()
216 if ((fildes = open(TEMP_FILE, O_WRONLY | O_CREAT, FILE_MODE)) == -1) { in setup()
223 if (write(fildes, write_buf1, strlen(write_buf1)) != strlen(write_buf1)) { in setup()
229 if (fstat(fildes, &stat_buf) < 0) { in setup()
246 if (close(fildes) < 0) { in cleanup()
Dlseek08.c86 int fildes; /* file handle for temp file */ variable
109 TEST(lseek(fildes, 0, SEEK_END)); in main()
132 if (read(fildes, &read_buf, sizeof(read_buf)) > 0) { in main()
167 if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { in setup()
174 if (write(fildes, write_buf, strlen(write_buf)) <= 0) { in setup()
180 if (fstat(fildes, &stat_buf) < 0) { in setup()
197 if (close(fildes) < 0) { in cleanup()
/external/ltp/testcases/kernel/syscalls/poll/
Dpoll01.c39 static int fildes[2]; variable
47 {.fd = fildes[1], .events = POLLOUT}, in verify_pollout()
71 {.fd = fildes[0], .events = POLLIN}, in verify_pollin()
74 SAFE_WRITE(cleanup, 1, fildes[1], write_buf, sizeof(write_buf)); in verify_pollin()
92 SAFE_READ(cleanup, 1, fildes[0], read_buf, sizeof(write_buf)); in verify_pollin()
118 SAFE_PIPE(NULL, fildes); in setup()
123 if (close(fildes[0])) in cleanup()
126 if (close(fildes[1])) in cleanup()
/external/ltp/testcases/kernel/syscalls/llseek/
Dllseek01.c94 int fildes; /* file handle for temp file */ variable
117 TEST(lseek64(fildes, (loff_t) (80 * BUFSIZ), SEEK_SET)); in main()
136 if (write(fildes, write_buff, BUFSIZ) != -1) { in main()
142 offset = lseek64(fildes, (loff_t) BUFSIZ, SEEK_SET); in main()
152 if (write(fildes, write_buff, BUFSIZ) != BUFSIZ) { in main()
160 if (write(fildes, write_buff, BUFSIZ) != -1) { in main()
199 if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { in setup()
205 SAFE_WRITE(cleanup, 1, fildes, write_buff, BUFSIZ); in setup()
210 SAFE_CLOSE(NULL, fildes); in cleanup()
/external/fmtlib/test/
Dposix-mock.h65 int close(int fildes);
67 int dup(int fildes);
68 int dup2(int fildes, int fildes2);
70 FILE *fdopen(int fildes, const char *mode);
72 ssize_t read(int fildes, void *buf, size_t nbyte);
73 ssize_t write(int fildes, const void *buf, size_t nbyte);
76 int pipe(int fildes[2]);
/external/ltp/testcases/kernel/syscalls/fchown/
Dfchown03.c53 static int fildes; variable
77 TEST(FCHOWN(cleanup, fildes, -1, group_id)); in main()
85 SAFE_FSTAT(cleanup, fildes, &stat_buf); in main()
122 fildes = SAFE_OPEN(cleanup, TESTFILE, O_RDWR | O_CREAT, FILE_MODE); in setup()
126 SAFE_FCHOWN(cleanup, fildes, -1, 0); in setup()
127 SAFE_FCHMOD(cleanup, fildes, NEW_PERMS); in setup()
135 if (fildes > 0 && close(fildes)) in cleanup()
/external/ltp/testcases/kernel/syscalls/mremap/
Dmremap01.c93 int fildes; /* file descriptor for tempfile */ variable
178 if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) in setup()
183 if (lseek(fildes, (off_t) memsize, SEEK_SET) != (off_t) memsize) { in setup()
189 if (write(fildes, "\0", 1) != 1) { in setup()
197 addr = mmap(0, memsize, PROT_WRITE, MAP_SHARED, fildes, 0); in setup()
205 if (lseek(fildes, (off_t) newsize, SEEK_SET) != (off_t) newsize) { in setup()
211 if (write(fildes, "\0", 1) != 1) { in setup()
233 if (close(fildes) < 0) { in cleanup()
/external/ltp/testcases/kernel/syscalls/ftruncate/
Dftruncate01.c87 int fildes; /* file descriptor for test file */ variable
110 TEST(ftruncate(fildes, TRUNC_LEN)); in main()
121 if (fstat(fildes, &stat_buf) < 0) { in main()
173 fildes = open(TESTFILE, O_RDWR | O_CREAT, FILE_MODE); in setup()
174 if (fildes == -1) in setup()
181 if ((c = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) { in setup()
201 if (close(fildes) == -1) in cleanup()
/external/ltp/testcases/kernel/syscalls/msync/
Dmsync02.c82 int fildes; /* file descriptor for tempfile */ variable
121 if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) in setup()
126 if ((nwrite = write(fildes, tst_buf, sizeof(tst_buf))) <= 0) in setup()
133 fildes, 0); in setup()
139 if (lseek(fildes, 100, SEEK_SET) != 100) in setup()
143 if (write(fildes, write_buf, strlen(write_buf)) != strlen(write_buf)) in setup()
153 if (close(fildes) == -1) in cleanup()
/external/elfutils/libelf/
Delf_begin.c53 file_read_ar (int fildes, void *map_address, off_t offset, size_t maxsize, in file_read_ar() argument
59 elf = allocate_elf (fildes, map_address, offset, maxsize, cmd, parent, in file_read_ar()
75 get_shnum (void *map_address, unsigned char *e_ident, int fildes, off_t offset, in get_shnum() argument
171 if (unlikely (pread_retry (fildes, &size, sizeof (Elf32_Word), in get_shnum()
219 if (unlikely (pread_retry (fildes, &size, sizeof (Elf64_Xword), in get_shnum()
248 file_read_elf (int fildes, void *map_address, unsigned char *e_ident, in file_read_elf() argument
264 size_t scncnt = get_shnum (map_address, e_ident, fildes, offset, maxsize); in file_read_elf()
282 Elf *elf = allocate_elf (fildes, map_address, offset, maxsize, cmd, parent, in file_read_elf()
506 __libelf_read_mmaped_file (int fildes, void *map_address, off_t offset, in __libelf_read_mmaped_file() argument
521 return file_read_elf (fildes, map_address, e_ident, offset, maxsize, in __libelf_read_mmaped_file()
[all …]

12345