/external/ltp/testcases/kernel/syscalls/dup2/ |
D | dup205.c | 43 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/ |
D | pread01.c | 90 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/ |
D | open09.c | 45 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/ |
D | pipe04.c | 56 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/ |
D | fork10.c | 60 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 …]
|
D | fork01.c | 115 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()
|
D | fork04.c | 139 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/ |
D | tst_safe_prw.h | 22 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/ |
D | dup06.c | 56 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/ |
D | pwrite01.c | 92 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/ |
D | mmap04.c | 60 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()
|
D | mmap02.c | 56 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()
|
D | mmap03.c | 63 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()
|
D | mmap05.c | 59 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/ |
D | lseek09.c | 88 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()
|
D | lseek07.c | 87 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()
|
D | lseek08.c | 86 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/ |
D | poll01.c | 39 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/ |
D | llseek01.c | 94 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/ |
D | posix-mock.h | 65 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/ |
D | fchown03.c | 53 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/ |
D | mremap01.c | 93 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/ |
D | ftruncate01.c | 87 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/ |
D | msync02.c | 82 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/ |
D | elf_begin.c | 53 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 …]
|