|
From: <sv...@va...> - 2008-10-12 19:53:34
|
Author: njn
Date: 2008-10-12 20:53:28 +0100 (Sun, 12 Oct 2008)
New Revision: 8667
Log:
Patch from Robert O'Callahan:
create and expose 'dup2'
Modified:
trunk/coregrind/m_libcfile.c
trunk/include/pub_tool_libcfile.h
Modified: trunk/coregrind/m_libcfile.c
===================================================================
--- trunk/coregrind/m_libcfile.c 2008-10-12 19:51:41 UTC (rev 8666)
+++ trunk/coregrind/m_libcfile.c 2008-10-12 19:53:28 UTC (rev 8667)
@@ -260,6 +260,11 @@
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 )
{
Modified: trunk/include/pub_tool_libcfile.h
===================================================================
--- trunk/include/pub_tool_libcfile.h 2008-10-12 19:51:41 UTC (rev 8666)
+++ trunk/include/pub_tool_libcfile.h 2008-10-12 19:53:28 UTC (rev 8667)
@@ -73,6 +73,7 @@
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 );
|