/external/python/cpython2/Python/ |
H A D | dup2.c | 9 * Check to see if fd2 is already open; if so, close it. 10 * Duplicate fd1 onto fd2; checking to make sure fd2 is a valid fd. 11 * Return fd2 if all went well; return BADEXIT otherwise. 20 dup2(int fd1, int fd2) argument 22 if (fd1 != fd2) { 25 if (fcntl(fd2, F_GETFL) >= 0) 26 close(fd2); 27 if (fcntl(fd1, F_DUPFD, fd2) < 0) 30 return fd2; [all...] |
/external/python/cpython3/Python/ |
H A D | dup2.c | 9 * Check to see if fd2 is already open; if so, close it. 10 * Duplicate fd1 onto fd2; checking to make sure fd2 is a valid fd. 11 * Return fd2 if all went well; return BADEXIT otherwise. 20 dup2(int fd1, int fd2) argument 22 if (fd1 != fd2) { 25 if (fcntl(fd2, F_GETFL) >= 0) 26 close(fd2); 27 if (fcntl(fd1, F_DUPFD, fd2) < 0) 30 return fd2; [all...] |
/external/ltp/testcases/kernel/syscalls/eventfd2/ |
H A D | eventfd2_03.c | 80 static void sem_player(int fd1, int fd2) argument 85 fprintf(stdout, "[%u] waiting on %d\n", getpid(), fd2); 86 xsem_wait(fd2); 91 fprintf(stdout, "[%u] waiting on %d\n", getpid(), fd2); 92 xsem_wait(fd2); 97 fprintf(stdout, "[%u] waiting 5 times on %d\n", getpid(), fd2); 98 xsem_wait(fd2); 99 xsem_wait(fd2); 100 xsem_wait(fd2); 101 xsem_wait(fd2); 112 int c, fd1, fd2, status; local [all...] |
/external/ltp/testcases/kernel/input/ |
H A D | input02.c | 39 static int fd2; variable 55 fd2 = open_device(); 64 if (no_events_queued(fd2, 0)) 68 SAFE_CLOSE(NULL, fd2); 92 SAFE_IOCTL(NULL, fd2, EVIOCGRAB, 1); 100 SAFE_CLOSE(NULL, fd2);
|
H A D | input04.c | 37 static int fd, fd2; variable 60 if (no_events_queued(fd2, 1)) 84 fd2 = open_device(); 99 if (fd2 > 0 && close(fd2)) 100 tst_resm(TWARN | TERRNO, "close(fd2)");
|
/external/strace/tests/ |
H A D | redirect-fds.test | 40 fd2="$LOG.fd2" 51 rm -f "$LOG" "$fd0" "$fd1" "$fd2" 64 check_fd "$fd0" "$fd1" "$fd2" 65 check_fd '' "$fd1" "$fd2" 66 check_fd "$fd0" '' "$fd2" 68 check_fd '' '' "$fd2"
|
/external/strace/tests-m32/ |
H A D | redirect-fds.test | 40 fd2="$LOG.fd2" 51 rm -f "$LOG" "$fd0" "$fd1" "$fd2" 64 check_fd "$fd0" "$fd1" "$fd2" 65 check_fd '' "$fd1" "$fd2" 66 check_fd "$fd0" '' "$fd2" 68 check_fd '' '' "$fd2"
|
/external/strace/tests-mx32/ |
H A D | redirect-fds.test | 40 fd2="$LOG.fd2" 51 rm -f "$LOG" "$fd0" "$fd1" "$fd2" 64 check_fd "$fd0" "$fd1" "$fd2" 65 check_fd '' "$fd1" "$fd2" 66 check_fd "$fd0" '' "$fd2" 68 check_fd '' '' "$fd2"
|
/external/compiler-rt/test/tsan/ |
H A D | fd_dup_norace2.cc | 44 int fd2 = open("/dev/urandom", O_RDONLY); local 45 if (fd == -1 || fd2 == -1) 49 if (dup2(fd2, fd) == -1) 54 if (close(fd2) == -1)
|
H A D | fd_dup_race.cc | 21 int fd2 = open("/dev/random", O_RDONLY); local 22 if (fd == -1 || fd2 == -1) 26 if (dup2(fd2, fd) == -1)
|
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/shm_open/ |
H A D | 8-1.c | 38 int fd1, fd2; local 47 fd2 = shm_open(SHM_NAME, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); 48 if (fd2 == -1) { 57 if (fd2 == (fd1 + 1)) {
|
/external/ltp/testcases/kernel/syscalls/kcmp/ |
H A D | kcmp02.c | 39 static int fd2; variable 54 int *fd2; member in struct:test_case 57 {&pid1, &pid_unused, KCMP_FILE, &fd1, &fd2, ESRCH}, 58 {&pid1, &pid1, KCMP_TYPES + 1, &fd1, &fd2, EINVAL}, 59 {&pid1, &pid1, -1, &fd1, &fd2, EINVAL}, 60 {&pid1, &pid1, INT_MIN, &fd1, &fd2, EINVAL}, 61 {&pid1, &pid1, INT_MAX, &fd1, &fd2, EINVAL}, 71 fd2 = SAFE_OPEN(TEST_FILE2, O_CREAT | O_RDWR | O_TRUNC); 79 if (fd2 > 0) 80 SAFE_CLOSE(fd2); [all...] |
H A D | kcmp.h | 47 int kcmp(int pid1, int pid2, int type, int fd1, int fd2) argument 49 return tst_syscall(__NR_kcmp, pid1, pid2, type, fd1, fd2);
|
H A D | kcmp01.c | 37 static int fd2; variable 47 int *fd2; member in struct:test_case 51 {&pid2, &pid2, KCMP_FILE, &fd1, &fd2, 0}, 53 {&pid1, &pid2, KCMP_FILE, &fd1, &fd2, 0}, 74 fd2 = dup(fd1); 75 if (fd2 == -1) { 82 *(test->fd1), *(test->fd2))); 84 SAFE_CLOSE(fd2);
|
/external/libdrm/ |
H A D | libsync.h | 51 int32_t fd2; member in struct:sync_merge_data 86 static inline int sync_merge(const char *name, int fd1, int fd2) argument 91 data.fd2 = fd2; 104 /* accumulate fd2 into fd1. If *fd1 is not a valid fd then dup fd2, 121 static inline int sync_accumulate(const char *name, int *fd1, int fd2) argument 125 assert(fd2 >= 0); 128 *fd1 = dup(fd2); 132 ret = sync_merge(name, *fd1, fd2); [all...] |
/external/linux-kselftest/tools/testing/selftests/sync/ |
H A D | sync.h | 36 int sync_merge(const char *name, int fd1, int fd2);
|
/external/ltp/testcases/kernel/syscalls/dup2/ |
H A D | dup203.c | 62 int fd0, fd1, fd2, rval; local 104 if ((fd2 = TEST_RETURN) == -1) { 107 if (fd1 != fd2) { 113 if (read(fd2, buf, sizeof(buf)) == -1) 122 close(fd2); 143 if ((fd2 = creat(filename1, 0666)) == -1) { 148 rval = fd2; 151 TEST(dup2(fd0, fd2)); 156 if (fd1 != fd2) {
|
/external/ltp/testcases/kernel/syscalls/pwritev/ |
H A D | pwritev02.c | 47 static int fd2; variable 77 {&fd2, wr_iovec2, 1, 0, EBADF}, 104 fd2 = SAFE_OPEN("file", O_RDONLY | O_CREAT, 0644); 113 if (fd2 > 0) 114 SAFE_CLOSE(fd2);
|
/external/ltp/testcases/kernel/syscalls/fcntl/ |
H A D | fcntl32.c | 36 static int fd2; variable 102 fd2 = SAFE_OPEN(cleanup, "file", test_cases[i].fd2_flag); 124 SAFE_CLOSE(cleanup, fd2); 125 fd2 = 0; 133 if (fd2 > 0 && close(fd2))
|
/external/ltp/testcases/kernel/syscalls/flock/ |
H A D | flock06.c | 90 int fd1, fd2; local 107 fd2 = open(filename, O_RDWR); 108 if (fd2 == -1) 112 TEST(flock(fd2, LOCK_EX | LOCK_NB)); 124 TEST(flock(fd2, LOCK_EX | LOCK_NB)); 130 close(fd2);
|
/external/ltp/testcases/kernel/syscalls/lseek/ |
H A D | lseek07.c | 36 static int fd1, fd2; variable 46 {&fd2, TFILE2, 2, 2, 7, "abijkfg"}, 89 fd2 = SAFE_OPEN(TFILE2, O_RDWR | O_CREAT, 0644); 92 SAFE_WRITE(1, fd2, WR_STR1, sizeof(WR_STR1) - 1); 100 if (fd2 > 0) 101 SAFE_CLOSE(fd2);
|
/external/libdrm/tests/nouveau/ |
H A D | threaded.c | 78 int err, fd, fd2; local 88 fd2 = drmOpenWithType("nouveau", NULL, DRM_NODE_RENDER); 94 fd2 = open(device, O_RDWR); 96 fd2 = fd = -errno; 104 if (fd2 < 0) { 122 err = nouveau_device_wrap(fd2, 0, &nvdev2); 144 close(fd2); 147 drmClose(fd2);
|
/external/ltp/testcases/kernel/syscalls/memfd_create/ |
H A D | memfd_create01.c | 139 int fd2; local 143 fd2 = SAFE_DUP(fd); 144 CHECK_MFD_HAS_SEALS(fd2, 0); 148 CHECK_MFD_HAS_SEALS(fd2, F_SEAL_WRITE); 150 CHECK_MFD_ADD_SEALS(fd2, F_SEAL_SHRINK); 152 CHECK_MFD_HAS_SEALS(fd2, F_SEAL_WRITE | F_SEAL_SHRINK); 156 CHECK_MFD_HAS_SEALS(fd2, F_SEAL_WRITE | F_SEAL_SHRINK | F_SEAL_SEAL); 159 CHECK_MFD_FAIL_ADD_SEALS(fd2, F_SEAL_GROW); 161 CHECK_MFD_FAIL_ADD_SEALS(fd2, F_SEAL_SEAL); 163 SAFE_CLOSE(fd2); 203 int fd2; local [all...] |
/external/linux-kselftest/tools/testing/selftests/powerpc/context_switch/ |
H A D | cp_abort.c | 70 int fd1[2], fd2[2], pid; local 84 FAIL_IF(pipe(fd1) || pipe(fd2)); 92 FAIL_IF((read(fd2[READ_FD], &c, 1)) != 1); 100 FAIL_IF((write(fd2[WRITE_FD], &c, 1) != 1));
|
/external/valgrind/memcheck/tests/linux/ |
H A D | syscalls-2007.c | 38 int fd, fd2; local 48 fd2 = eventfd (5, 0); 49 eventfd_read (fd2, &ev); 52 pfd[1].fd = fd2;
|