1 /* 2 * Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <errno.h> 8 #include <unistd.h> 9 10 #include <errno_private.h> 11 #include <syscalls.h> 12 #include <syscall_utils.h> 13 14 15 int 16 dup(int fd) 17 { 18 RETURN_AND_SET_ERRNO(_kern_dup(fd)); 19 } 20 21 22 int 23 dup2(int oldFD, int newFD) 24 { 25 return dup3(oldFD, newFD, 0); 26 } 27 28 29 int 30 dup3(int oldFD, int newFD, int flags) 31 { 32 RETURN_AND_SET_ERRNO(_kern_dup2(oldFD, newFD, flags)); 33 } 34