summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-28 18:55:31 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-28 18:55:31 +0000
commit477996368827f818daf6a9dcf9de2d3e8d875fe4 (patch)
treeec4a98d647337ff2e084c9cd1e2ae0af5ad6303c /cpukit/libcsupport
parent2007-12-22 Chris Johns <chrisj@rtems.org> (diff)
downloadrtems-477996368827f818daf6a9dcf9de2d3e8d875fe4.tar.bz2
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.
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r--cpukit/libcsupport/Makefile.am2
-rw-r--r--cpukit/libcsupport/src/_rename_r.c40
2 files changed, 41 insertions, 1 deletions
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 );
+}