/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 | 91 int fildes; /* file descriptor for tempfile */ variable 118 nread = pread(fildes, read_buf[2], K1, K2); in main() 130 l_seek(fildes, 0, SEEK_CUR, K4); in main() 133 l_seek(fildes, 0, SEEK_SET, 0); in main() 136 nread = pread(fildes, read_buf[3], K1, K3); in main() 143 l_seek(fildes, 0, SEEK_CUR, 0); in main() 150 if ((nread = read(fildes, read_buf[0], K1)) != K1) { in main() 156 l_seek(fildes, 0, SEEK_CUR, K1); in main() 159 nread = pread(fildes, read_buf[1], K1, K1); in main() 166 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 | 57 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 …]
|
/external/ltp/testcases/kernel/syscalls/pwrite/ |
D | pwrite01.c | 93 int fildes; /* file descriptor for tempfile */ variable 119 nwrite = pwrite(fildes, write_buf[0], K1, 0); in main() 129 l_seek(fildes, 0, SEEK_CUR, 0); in main() 135 l_seek(fildes, K1 / 2, SEEK_SET, K1 / 2); in main() 141 nwrite = pwrite(fildes, write_buf[2], K1, K2); in main() 150 l_seek(fildes, 0, SEEK_CUR, K1 / 2); in main() 153 l_seek(fildes, K3, SEEK_SET, K3); in main() 160 nwrite = write(fildes, write_buf[3], K1); in main() 168 l_seek(fildes, 0, SEEK_CUR, K4); in main() 171 nwrite = pwrite(fildes, write_buf[1], K1, K1); in main() [all …]
|
/external/ltp/testcases/kernel/syscalls/fork/ |
D | fork10.c | 61 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 …]
|
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 | 140 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()
|
/external/ltp/testcases/kernel/syscalls/poll/ |
D | poll01.c | 35 static int fildes[2]; variable 40 {.fd = fildes[1], .events = POLLOUT}, in verify_pollout() 64 {.fd = fildes[0], .events = POLLIN}, in verify_pollin() 67 SAFE_WRITE(1, fildes[1], write_buf, sizeof(write_buf)); in verify_pollin() 85 SAFE_READ(1, fildes[0], read_buf, sizeof(write_buf)); in verify_pollin() 102 SAFE_PIPE(fildes); in setup() 107 if (fildes[0] > 0) in cleanup() 108 SAFE_CLOSE(fildes[0]); in cleanup() 110 if (fildes[1] > 0) in cleanup() 111 SAFE_CLOSE(fildes[1]); in cleanup()
|
/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/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/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()
|
D | mmap13.c | 51 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()
|
/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() 197 if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { in setup() 203 SAFE_WRITE(cleanup, 1, fildes, write_buff, BUFSIZ); in setup() 208 SAFE_CLOSE(NULL, fildes); in cleanup()
|
/external/ltp/testcases/kernel/syscalls/mremap/ |
D | mremap01.c | 94 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()
|
/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 …]
|
/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/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()
|
D | msync01.c | 83 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() 167 if ((fildes = open(TEMPFILE, O_RDWR | O_CREAT, 0666)) < 0) in setup() 171 nwrite = write(fildes, write_buf, sizeof(write_buf)); in setup() 183 fildes, 0); in setup() 198 if (close(fildes) == -1) in cleanup()
|
/external/ltp/testcases/kernel/syscalls/munmap/ |
D | munmap01.c | 86 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()
|
D | munmap02.c | 88 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()
|
/external/ltp/testcases/kernel/syscalls/mount/ |
D | mount03.c | 66 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 …]
|