1 #include "tests.h" 2 #include <fcntl.h> 3 #include <asm/unistd.h> 4 5 #if defined __NR_dup3 && defined O_CLOEXEC 6 7 # include <stdio.h> 8 # include <unistd.h> 9 10 int main(void)11main(void) 12 { 13 const long int fd_old = (long int) 0xdeadbeefffffffffULL; 14 const long int fd_new = (long int) 0xdeadbeeffffffffeULL; 15 16 long rc = syscall(__NR_dup3, fd_old, fd_new, O_CLOEXEC); 17 printf("dup3(%d, %d, O_CLOEXEC) = %ld %s (%m)\n", 18 (int) fd_old, (int) fd_new, rc, errno2name()); 19 20 puts("+++ exited with 0 +++"); 21 return 0; 22 } 23 24 #else 25 26 SKIP_MAIN_UNDEFINED("__NR_dup3 && O_CLOEXEC") 27 28 #endif 29