summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cpukit/ChangeLog6
-rw-r--r--cpukit/libcsupport/Makefile.am2
-rw-r--r--cpukit/libcsupport/src/_rename_r.c40
3 files changed, 47 insertions, 1 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 974030b991..e912326b87 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,9 @@
+2007-12-28 Joel Sherrill <joel.sherrill@OARcorp.com>
+
+ * libcsupport/Makefile.am: _rename_r is required by newlib 1.16.0.
+ Hopefully this implementation is OK.
+ * libcsupport/src/_rename_r.c: New file.
+
2007-12-22 Chris Johns <chrisj@rtems.org>
* configure.ac: fixed bug that always enabled strict order
diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
index c32a88d5e0..729237175b 100644
--- a/cpukit/libcsupport/Makefile.am
+++ b/cpukit/libcsupport/Makefile.am
@@ -62,7 +62,7 @@ SYSTEM_CALL_C_FILES = src/open.c src/close.c src/read.c src/write.c \
src/unlink.c src/umask.c src/ftruncate.c src/utime.c src/fstat.c \
src/fcntl.c src/fpathconf.c src/getdents.c src/fsync.c src/fdatasync.c \
src/pipe.c src/dup.c src/dup2.c src/symlink.c src/readlink.c src/creat.c \
- src/chroot.c src/sync.c
+ src/chroot.c src/sync.c src/_rename_r.c
## Until sys/uio.h is moved to libcsupport, we have to have networking
## enabled to compile these. Hopefully this is a temporary situation.
diff --git a/cpukit/libcsupport/src/_rename_r.c b/cpukit/libcsupport/src/_rename_r.c
new file mode 100644
index 0000000000..b0a636f468
--- /dev/null
+++ b/cpukit/libcsupport/src/_rename_r.c
@@ -0,0 +1,40 @@
+/*
+ * _rename_r() - POSIX 1003.1b - 5.3.4 - Rename a file
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <reent.h>
+
+#include <rtems.h>
+#include <rtems/libio.h>
+#include <errno.h>
+
+#include <rtems/libio_.h>
+#include <rtems/seterr.h>
+
+int _rename_r(
+ struct _reent *ptr,
+ const char *old,
+ const char *new
+)
+{
+ int s;
+
+ s = link( old, new );
+ if ( !s )
+ return s;
+ return unlink( old );
+}