+static int __sys_dup2(int old, int new)
+{
+#ifdef SYS_dup2
+ return __syscall(SYS_dup2, old, new);
+#else
+ if (old==new) {
+ int r = __syscall(SYS_fcntl, old, F_GETFD);
+ return r<0 ? r : old;
+ } else {
+ return __syscall(SYS_dup3, old, new, 0);
+ }
+#endif
+}
+