From: Nicholas Nethercote Date: Sun, 12 Oct 2008 19:53:28 +0000 (+0000) Subject: Patch from Robert O'Callahan: X-Git-Tag: svn/VALGRIND_3_4_0~222 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc2603ae7aef5a99192c4ce19a4ae9942d289a95;p=thirdparty%2Fvalgrind.git Patch from Robert O'Callahan: create and expose 'dup2' git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8667 --- diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index 16d1d634d3..1236d7eb5c 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -260,6 +260,11 @@ SysRes VG_(dup) ( Int oldfd ) return VG_(do_syscall1)(__NR_dup, oldfd); } +SysRes VG_(dup2) ( Int oldfd, Int newfd ) +{ + return VG_(do_syscall2)(__NR_dup2, oldfd, newfd); +} + /* Returns -1 on error. */ Int VG_(fcntl) ( Int fd, Int cmd, Int arg ) { diff --git a/include/pub_tool_libcfile.h b/include/pub_tool_libcfile.h index 81710d4d94..5c5930195a 100644 --- a/include/pub_tool_libcfile.h +++ b/include/pub_tool_libcfile.h @@ -73,6 +73,7 @@ extern OffT VG_(lseek) ( Int fd, OffT offset, Int whence ); extern SysRes VG_(stat) ( Char* file_name, struct vg_stat* buf ); extern Int VG_(fstat) ( Int fd, struct vg_stat* buf ); extern SysRes VG_(dup) ( Int oldfd ); +extern SysRes VG_(dup2) ( Int oldfd, Int newfd ); extern Int VG_(rename) ( Char* old_name, Char* new_name ); extern Int VG_(unlink) ( Char* file_name );