This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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]

[PATCH]: Allow _rename_r to be re-classified as a system call


Hi,

In the current implementation of the rename() function, _rename_r() is
also provided as well, and is either implemented using the system call
_rename() (if HAVE_RENAME is defined) or by using the system calls
_link_r() and _unlink_r() (if HAVE_RENAME is not defined).

In the system call implementation I am using I would like to provide my
own version of _rename_r() (in order to correctly preserve errno) and so
I thought of introducing HAVE_RENAME_R for this purpose. If this is the
correct approach then the following is a patch requested.

--- newlib/libc/stdio/rename.c@@/main/LATEST    2004-04-23
21:01:55.000000000 +0100
+++ newlib/libc/stdio/rename.c  2006-10-27 18:56:51.836773000 +0100
@@ -70,6 +70,7 @@
 #include <stdio.h>
 #include <sys/unistd.h>

+#ifndef HAVE_RENAME_R
 int
 _DEFUN(_rename_r, (ptr, old, new),
        struct _reent *ptr _AND
@@ -77,7 +78,7 @@
        _CONST char *new)
 {
 #ifdef HAVE_RENAME
-  return _rename (old,new);
+  return _rename (old, new);
 #else
   if (_link_r (ptr, old, new) == -1)
     return -1;
@@ -90,6 +91,7 @@
 #endif
   return 0;
 }
+#endif

 #ifndef _REENT_ONLY

and the ChangeLog comment is as follows:

2006-11-03  Antony King  <antony.king@st.com>

	* libc/stdio/rename.c (HAVE_RENAME_R): Add support for
        providing _rename_r as a system call.

Cheers,

Antony.


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