This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patches to improve Hurd parts: dup3


Hello!

On Thu, Dec 18, 2008 at 12:42:10PM -0800, Roland McGrath wrote:
> > On Wed, Dec 17, 2008 at 07:54:04PM -0800, Roland McGrath wrote:
> > > __dup2 has to call __dup3, not dup3.

Here is a patch for the header file:

2008-12-19  Thomas Schwinge  <tschwinge@gnu.org>

	* include/unistd.h (__dup3): New hidden declaration.

diff --git a/include/unistd.h b/include/unistd.h
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -75,6 +75,8 @@ char *__canonicalize_directory_name_internal (__const char *__thisdir,
 extern int __dup (int __fd);
 extern int __dup2 (int __fd, int __fd2);
 libc_hidden_proto (__dup2)
+extern int __dup3 (int __fd, int __fd2, int __flags);
+libc_hidden_proto (__dup3)
 extern int __execve (__const char *__path, char *__const __argv[],
 		     char *__const __envp[]);
 extern long int __pathconf (__const char *__path, int __name);


... and for the Hurd parts, to be put on top of the existing one:

--- sysdeps/mach/hurd/dup3.c.	2008-12-19 11:52:32.000000000 +0100
+++ sysdeps/mach/hurd/dup3.c	2008-12-19 11:52:49.000000000 +0100
@@ -26,7 +26,7 @@
    open the same file as FD is which setting flags according to
    FLAGS.  Return FD2 or -1.  */
 int
-dup3 (fd, fd2, flags)
+__dup3 (fd, fd2, flags)
      int fd;
      int fd2;
      int flags;
@@ -136,3 +136,5 @@
 
   return fd2;
 }
+libc_hidden_def (__dup3)
+weak_alias (__dup3, dup3)
--- sysdeps/mach/hurd/dup2.c.	2008-12-19 11:51:48.000000000 +0100
+++ sysdeps/mach/hurd/dup2.c	2008-12-19 11:52:16.000000000 +0100
@@ -31,7 +31,7 @@
     /* See the comment in dup3.  */
     flags = -1;
 
-  return dup3 (fd, fd2, flags);
+  return __dup3 (fd, fd2, flags);
 }
 libc_hidden_def (__dup2)
 weak_alias (__dup2, dup2)


Regards,
 Thomas

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]