Searched refs:fd2 (Results 1 - 25 of 114) sorted by relevance

12345

/external/python/cpython2/Python/
H A Ddup2.c9 * 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 Ddup2.c9 * 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 Deventfd2_03.c80 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 Dinput02.c39 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 Dinput04.c37 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 Dredirect-fds.test40 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 Dredirect-fds.test40 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 Dredirect-fds.test40 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 Dfd_dup_norace2.cc44 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 Dfd_dup_race.cc21 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 D8-1.c38 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 Dkcmp02.c39 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 Dkcmp.h47 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 Dkcmp01.c37 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 Dlibsync.h51 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 Dsync.h36 int sync_merge(const char *name, int fd1, int fd2);
/external/ltp/testcases/kernel/syscalls/dup2/
H A Ddup203.c62 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 Dpwritev02.c47 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 Dfcntl32.c36 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 Dflock06.c90 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 Dlseek07.c36 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 Dthreaded.c78 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 Dmemfd_create01.c139 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 Dcp_abort.c70 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 Dsyscalls-2007.c38 int fd, fd2; local
48 fd2 = eventfd (5, 0);
49 eventfd_read (fd2, &ev);
52 pfd[1].fd = fd2;

Completed in 1248 milliseconds

12345