add extensions for libfat

This commit is contained in:
Dave Murphy 2008-11-20 21:18:29 +00:00
parent 52c1a3ce8f
commit 51696b0ca5

View File

@ -66,7 +66,7 @@ diff -Nbaur newlib-1.16.0/libgloss/configure.in newlib-1.16.0-ppc/libgloss/confi
i[[3456]]86-*-elf* | i[[3456]]86-*-coff*)
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/Makefile.in newlib-1.16.0-ppc/libgloss/libsysbase/Makefile.in
--- newlib-1.16.0/libgloss/libsysbase/Makefile.in 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/Makefile.in 2008-11-13 03:28:46.000000000 +0000
+++ newlib-1.16.0-ppc/libgloss/libsysbase/Makefile.in 2008-11-20 18:50:27.000000000 +0000
@@ -0,0 +1,147 @@
+# Copyright (c) 1998 Cygnus Support
+#
@ -139,7 +139,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/Makefile.in newlib-1.16.0-ppc/libg
+ isatty.o kill.o link.o lseek.o open.o read.o sbrk.o stat.o \
+ unlink.o wait.o write.o _exit.o malloc_vars.o \
+ chdir.o mkdir.o dir.o rename.o build_argv.o statvfs.o \
+ flock.o syscall_support.o handle_manager.o truncate.o ftruncate.o dirent.o
+ flock.o syscall_support.o handle_manager.o truncate.o ftruncate.o dirent.o fsync.o
+
+# Object files specific to particular targets.
+EVALOBJS = ${OBJS}
@ -217,7 +217,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/Makefile.in newlib-1.16.0-ppc/libg
+ $(SHELL) config.status --recheck
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/_exit.c newlib-1.16.0-ppc/libgloss/libsysbase/_exit.c
--- newlib-1.16.0/libgloss/libsysbase/_exit.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/_exit.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/_exit.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,19 @@
+/* Stub version of _exit. */
+
@ -240,7 +240,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/_exit.c newlib-1.16.0-ppc/libgloss
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/abort.c newlib-1.16.0-ppc/libgloss/libsysbase/abort.c
--- newlib-1.16.0/libgloss/libsysbase/abort.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/abort.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/abort.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,8 @@
+#include <stdlib.h>
+#include <unistd.h>
@ -633,7 +633,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/aclocal.m4 newlib-1.16.0-ppc/libgl
+m4_include([../acinclude.m4])
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/build_argv.c newlib-1.16.0-ppc/libgloss/libsysbase/build_argv.c
--- newlib-1.16.0/libgloss/libsysbase/build_argv.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/build_argv.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/build_argv.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,31 @@
+struct __argv {
+ int argvMagic;
@ -668,7 +668,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/build_argv.c newlib-1.16.0-ppc/lib
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/chdir.c newlib-1.16.0-ppc/libgloss/libsysbase/chdir.c
--- newlib-1.16.0/libgloss/libsysbase/chdir.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/chdir.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/chdir.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,175 @@
+#include <unistd.h>
+#include <reent.h>
@ -847,7 +847,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/chdir.c newlib-1.16.0-ppc/libgloss
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/close.c newlib-1.16.0-ppc/libgloss/libsysbase/close.c
--- newlib-1.16.0/libgloss/libsysbase/close.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/close.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/close.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,41 @@
+#include "config.h"
+#include <_ansi.h>
@ -4690,7 +4690,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/configure.in newlib-1.16.0-ppc/lib
+
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/dir.c newlib-1.16.0-ppc/libgloss/libsysbase/dir.c
--- newlib-1.16.0/libgloss/libsysbase/dir.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/dir.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/dir.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,94 @@
+#include <reent.h>
+#include <sys/iosupport.h>
@ -4788,7 +4788,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/dir.c newlib-1.16.0-ppc/libgloss/l
+
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/dirent.c newlib-1.16.0-ppc/libgloss/libsysbase/dirent.c
--- newlib-1.16.0/libgloss/libsysbase/dirent.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/dirent.c 2008-11-13 03:29:18.000000000 +0000
+++ newlib-1.16.0-ppc/libgloss/libsysbase/dirent.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,157 @@
+#include <sys/dirent.h>
+#include <sys/dir.h>
@ -4949,7 +4949,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/dirent.c newlib-1.16.0-ppc/libglos
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/environ.c newlib-1.16.0-ppc/libgloss/libsysbase/environ.c
--- newlib-1.16.0/libgloss/libsysbase/environ.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/environ.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/environ.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,6 @@
+/*
+ * Version of environ for no OS.
@ -4959,7 +4959,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/environ.c newlib-1.16.0-ppc/libglo
+char **environ = __env;
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/execve.c newlib-1.16.0-ppc/libgloss/libsysbase/execve.c
--- newlib-1.16.0/libgloss/libsysbase/execve.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/execve.c 2008-11-13 07:28:53.000000000 +0000
+++ newlib-1.16.0-ppc/libgloss/libsysbase/execve.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,31 @@
+/*
+ * Stub version of execve.
@ -4994,7 +4994,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/execve.c newlib-1.16.0-ppc/libglos
+
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/flock.c newlib-1.16.0-ppc/libgloss/libsysbase/flock.c
--- newlib-1.16.0/libgloss/libsysbase/flock.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/flock.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/flock.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,21 @@
+#include <config.h>
+#include <_ansi.h>
@ -5019,7 +5019,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/flock.c newlib-1.16.0-ppc/libgloss
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/fork.c newlib-1.16.0-ppc/libgloss/libsysbase/fork.c
--- newlib-1.16.0/libgloss/libsysbase/fork.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/fork.c 2008-11-13 07:49:41.000000000 +0000
+++ newlib-1.16.0-ppc/libgloss/libsysbase/fork.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,25 @@
+/*
+ * Stub version of fork.
@ -5048,7 +5048,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/fork.c newlib-1.16.0-ppc/libgloss/
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/fstat.c newlib-1.16.0-ppc/libgloss/libsysbase/fstat.c
--- newlib-1.16.0/libgloss/libsysbase/fstat.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/fstat.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/fstat.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,48 @@
+#include "config.h"
+#include <_ansi.h>
@ -5098,10 +5098,10 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/fstat.c newlib-1.16.0-ppc/libgloss
+ }
+ return ret;
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/ftruncate.c newlib-1.16.0-ppc/libgloss/libsysbase/ftruncate.c
--- newlib-1.16.0/libgloss/libsysbase/ftruncate.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/ftruncate.c 2008-11-13 03:11:31.000000000 +0000
@@ -0,0 +1,52 @@
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/fsync.c newlib-1.16.0-ppc/libgloss/libsysbase/fsync.c
--- newlib-1.16.0/libgloss/libsysbase/fsync.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/fsync.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,36 @@
+#include "config.h"
+#include <_ansi.h>
+#include <_syslist.h>
@ -5111,52 +5111,77 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/ftruncate.c newlib-1.16.0-ppc/libg
+
+#include "handle_manager.h"
+
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+//---------------------------------------------------------------------------------
+int _DEFUN (ftruncate_r, (r, fileDesc, len),
+ struct _reent * r _AND
+ int fileDesc _AND
+ off_t len) {
+//---------------------------------------------------------------------------------
+#else
+//---------------------------------------------------------------------------------
+int _DEFUN (ftruncate,(fileDesc, len),
+ int fileDesc _AND
+ off_t len) {
+//---------------------------------------------------------------------------------
+ struct _reent *r = _REENT;
+//---------------------------------------------------------------------------------
+#endif
+//---------------------------------------------------------------------------------
+int _DEFUN (fsync,(fileDesc),
+ int fileDesc ) {
+ int ret = -1;
+ unsigned int dev = 0;
+ unsigned int fd = -1;
+
+ __handle * handle;
+
+ if(fileDesc!=-1) {
+
+ if ( fileDesc < 3) {
+ dev = fileDesc;
+ } else {
+ handle = __get_handle(fileDesc);
+
+ if ( NULL == handle ) return ret;
+
+ dev = handle->device;
+ fd = (int)handle->fileStruct;
+ if ( fileDesc < 3) {
+ errno = EINVAL;
+ } else {
+ handle = __get_handle(fileDesc);
+
+ if ( NULL == handle ) {
+ errno = EINVAL;
+ return ret;
+ }
+
+ if(devoptab_list[dev]->seek_r)
+ ret = devoptab_list[dev]->ftruncate_r( r, fd, len);
+
+
+ dev = handle->device;
+ fd = (int)handle->fileStruct;
+
+ if(devoptab_list[dev]->fsync_r)
+ ret = devoptab_list[dev]->fsync_r( _REENT, fd);
+ }
+
+ return ret;
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/ftruncate.c newlib-1.16.0-ppc/libgloss/libsysbase/ftruncate.c
--- newlib-1.16.0/libgloss/libsysbase/ftruncate.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/ftruncate.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,37 @@
+#include "config.h"
+#include <_ansi.h>
+#include <_syslist.h>
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#include "handle_manager.h"
+
+int _DEFUN (ftruncate,(fileDesc, len),
+ int fileDesc _AND
+ off_t len) {
+ int ret = -1;
+ unsigned int dev = 0;
+ unsigned int fd = -1;
+
+ __handle * handle;
+
+ if ( fileDesc < 3) {
+ errno = EINVAL;
+ } else {
+ handle = __get_handle(fileDesc);
+
+ if ( NULL == handle ) {
+ errno = EINVAL;
+ return ret;
+ }
+
+ dev = handle->device;
+ fd = (int)handle->fileStruct;
+
+ if(devoptab_list[dev]->ftruncate_r)
+ ret = devoptab_list[dev]->ftruncate_r( _REENT, fd, len);
+ }
+
+ return ret;
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/getpid.c newlib-1.16.0-ppc/libgloss/libsysbase/getpid.c
--- newlib-1.16.0/libgloss/libsysbase/getpid.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/getpid.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/getpid.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,21 @@
+#include "config.h"
+#include <_ansi.h>
@ -5181,7 +5206,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/getpid.c newlib-1.16.0-ppc/libglos
+
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/gettod.c newlib-1.16.0-ppc/libgloss/libsysbase/gettod.c
--- newlib-1.16.0/libgloss/libsysbase/gettod.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/gettod.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/gettod.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,25 @@
+/*
+ * Stub version of gettimeofday.
@ -5210,7 +5235,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/gettod.c newlib-1.16.0-ppc/libglos
+stub_warning(_gettimeofday)
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/handle_manager.c newlib-1.16.0-ppc/libgloss/libsysbase/handle_manager.c
--- newlib-1.16.0/libgloss/libsysbase/handle_manager.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/handle_manager.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/handle_manager.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,47 @@
+#include <stdlib.h>
+#include <stdio.h>
@ -5275,8 +5300,8 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/handle_manager.h newlib-1.16.0-ppc
+#endif
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/iosupport.c newlib-1.16.0-ppc/libgloss/libsysbase/iosupport.c
--- newlib-1.16.0/libgloss/libsysbase/iosupport.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/iosupport.c 2008-11-19 03:26:25.000000000 +0000
@@ -0,0 +1,121 @@
+++ newlib-1.16.0-ppc/libgloss/libsysbase/iosupport.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,122 @@
+#include <stdlib.h>
+#include <string.h>
+#include <sys/iosupport.h>
@ -5315,6 +5340,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/iosupport.c newlib-1.16.0-ppc/libg
+ NULL, // device dirclose_r
+ NULL, // device statvfs_r
+ NULL, // device ftruncate_r
+ NULL, // device fsync_r
+ NULL // deviceData
+};
+
@ -5400,7 +5426,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/iosupport.c newlib-1.16.0-ppc/libg
+
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/isatty.c newlib-1.16.0-ppc/libgloss/libsysbase/isatty.c
--- newlib-1.16.0/libgloss/libsysbase/isatty.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/isatty.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/isatty.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,10 @@
+#include <_ansi.h>
+#include <_syslist.h>
@ -5414,7 +5440,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/isatty.c newlib-1.16.0-ppc/libglos
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/kill.c newlib-1.16.0-ppc/libgloss/libsysbase/kill.c
--- newlib-1.16.0/libgloss/libsysbase/kill.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/kill.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/kill.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,23 @@
+/*
+ * Stub version of kill.
@ -5441,7 +5467,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/kill.c newlib-1.16.0-ppc/libgloss/
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/link.c newlib-1.16.0-ppc/libgloss/libsysbase/link.c
--- newlib-1.16.0/libgloss/libsysbase/link.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/link.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/link.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,37 @@
+#include "config.h"
+#include <_ansi.h>
@ -5482,7 +5508,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/link.c newlib-1.16.0-ppc/libgloss/
+
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/lseek.c newlib-1.16.0-ppc/libgloss/libsysbase/lseek.c
--- newlib-1.16.0/libgloss/libsysbase/lseek.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/lseek.c 2008-11-13 02:19:19.000000000 +0000
+++ newlib-1.16.0-ppc/libgloss/libsysbase/lseek.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,55 @@
+#include "config.h"
+#include <_ansi.h>
@ -5541,13 +5567,13 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/lseek.c newlib-1.16.0-ppc/libgloss
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/malloc_vars.c newlib-1.16.0-ppc/libgloss/libsysbase/malloc_vars.c
--- newlib-1.16.0/libgloss/libsysbase/malloc_vars.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/malloc_vars.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/malloc_vars.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,2 @@
+char *fake_heap_end = (char*)0;
+char *fake_heap_start = (char*)0;
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/mkdir.c newlib-1.16.0-ppc/libgloss/libsysbase/mkdir.c
--- newlib-1.16.0/libgloss/libsysbase/mkdir.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/mkdir.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/mkdir.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,18 @@
+#include <reent.h>
+#include <sys/iosupport.h>
@ -5569,7 +5595,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/mkdir.c newlib-1.16.0-ppc/libgloss
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/open.c newlib-1.16.0-ppc/libgloss/libsysbase/open.c
--- newlib-1.16.0/libgloss/libsysbase/open.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/open.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/open.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,57 @@
+#include "config.h"
+#include <_ansi.h>
@ -5630,7 +5656,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/open.c newlib-1.16.0-ppc/libgloss/
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/read.c newlib-1.16.0-ppc/libgloss/libsysbase/read.c
--- newlib-1.16.0/libgloss/libsysbase/read.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/read.c 2008-11-13 02:03:11.000000000 +0000
+++ newlib-1.16.0-ppc/libgloss/libsysbase/read.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,48 @@
+#include "config.h"
+#include <_ansi.h>
@ -5682,7 +5708,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/read.c newlib-1.16.0-ppc/libgloss/
+
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/rename.c newlib-1.16.0-ppc/libgloss/libsysbase/rename.c
--- newlib-1.16.0/libgloss/libsysbase/rename.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/rename.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/rename.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,39 @@
+#include <reent.h>
+#include <sys/iosupport.h>
@ -5725,7 +5751,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/rename.c newlib-1.16.0-ppc/libglos
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/sbrk.c newlib-1.16.0-ppc/libgloss/libsysbase/sbrk.c
--- newlib-1.16.0/libgloss/libsysbase/sbrk.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/sbrk.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/sbrk.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,26 @@
+#include "config.h"
+#include <sys/iosupport.h>
@ -5755,7 +5781,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/sbrk.c newlib-1.16.0-ppc/libgloss/
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/stat.c newlib-1.16.0-ppc/libgloss/libsysbase/stat.c
--- newlib-1.16.0/libgloss/libsysbase/stat.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/stat.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/stat.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,39 @@
+#include "config.h"
+#include <_ansi.h>
@ -5798,7 +5824,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/stat.c newlib-1.16.0-ppc/libgloss/
+
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/statvfs.c newlib-1.16.0-ppc/libgloss/libsysbase/statvfs.c
--- newlib-1.16.0/libgloss/libsysbase/statvfs.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/statvfs.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/statvfs.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,23 @@
+#include <reent.h>
+#include <sys/iosupport.h>
@ -5825,7 +5851,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/statvfs.c newlib-1.16.0-ppc/libglo
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/syscall_support.c newlib-1.16.0-ppc/libgloss/libsysbase/syscall_support.c
--- newlib-1.16.0/libgloss/libsysbase/syscall_support.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/syscall_support.c 2008-11-11 20:30:15.000000000 +0000
+++ newlib-1.16.0-ppc/libgloss/libsysbase/syscall_support.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,66 @@
+#include <sys/iosupport.h>
+
@ -5895,8 +5921,8 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/syscall_support.c newlib-1.16.0-pp
+
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/truncate.c newlib-1.16.0-ppc/libgloss/libsysbase/truncate.c
--- newlib-1.16.0/libgloss/libsysbase/truncate.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/truncate.c 2008-11-13 03:05:46.000000000 +0000
@@ -0,0 +1,67 @@
+++ newlib-1.16.0-ppc/libgloss/libsysbase/truncate.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,59 @@
+#include "config.h"
+#include <_ansi.h>
+#include <_syslist.h>
@ -5906,67 +5932,59 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/truncate.c newlib-1.16.0-ppc/libgl
+
+#include "handle_manager.h"
+
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+//---------------------------------------------------------------------------------
+int _DEFUN (truncate_r, (r, file, len),
+ struct _reent * r _AND
+ const char *file _AND
+ off_t len) {
+//---------------------------------------------------------------------------------
+#else
+//---------------------------------------------------------------------------------
+int _DEFUN (truncate, (file, len),
+ const char *file _AND
+ off_t len) {
+//---------------------------------------------------------------------------------
+ struct _reent *r = _REENT;
+#endif
+ __handle *handle;
+ int dev, fd, ret;
+ const char *file _AND
+ off_t len)
+{
+
+ __handle *handle;
+ int dev, fd, ret;
+
+ struct _reent * r = _REENT;
+
+ dev = FindDevice(file);
+
+ dev = FindDevice(file);
+
+ fd = -1;
+ if(dev!=-1 && devoptab_list[dev]->open_r && devoptab_list[dev]->close_r &&
+ devoptab_list[dev]->ftruncate_r)
+ {
+ fd = -1;
+ if(dev!=-1 && devoptab_list[dev]->open_r && devoptab_list[dev]->close_r &&
+ devoptab_list[dev]->ftruncate_r)
+ {
+
+ fd = __alloc_handle(sizeof(__handle) + devoptab_list[dev]->structSize );
+ fd = __alloc_handle(sizeof(__handle) + devoptab_list[dev]->structSize );
+
+ if ( -1 != fd ) {
+ handle = __get_handle(fd);
+ handle->device = dev;
+ handle->fileStruct = ((void *)handle) + sizeof(__handle);
+ if ( -1 != fd ) {
+ handle = __get_handle(fd);
+ handle->device = dev;
+ handle->fileStruct = ((void *)handle) + sizeof(__handle);
+
+ ret = devoptab_list[dev]->open_r(r, handle->fileStruct, file, O_WRONLY, 0);
+ ret = devoptab_list[dev]->open_r(r, handle->fileStruct, file, O_WRONLY, 0);
+
+ if ( ret < 0 ) {
+ __release_handle(fd);
+ return ret;
+ }
+ if ( ret < 0 ) {
+ __release_handle(fd);
+ return ret;
+ }
+
+ ret = devoptab_list[dev]->ftruncate_r(r, fd, len);
+ ret = devoptab_list[dev]->ftruncate_r(r, fd, len);
+
+ devoptab_list[dev]->close_r(r, fd);
+ devoptab_list[dev]->close_r(r, fd);
+
+ if (ret >= 0) {
+ ret = devoptab_list[dev]->close_r(r, fd);
+ } else {
+ // Close it anyway, we don't want to leak memory
+ devoptab_list[dev]->close_r(r, fd);
+ }
+ if (ret >= 0) {
+ ret = devoptab_list[dev]->close_r(r, fd);
+ } else {
+ r->_errno = ENOSR;
+ // Close it anyway, we don't want to leak memory
+ devoptab_list[dev]->close_r(r, fd);
+ }
+ } else {
+ r->_errno = ENOSYS;
+ r->_errno = ENOSR;
+ }
+
+ return ret;
+ } else {
+ r->_errno = ENOSYS;
+ }
+
+ return ret;
+}
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/unlink.c newlib-1.16.0-ppc/libgloss/libsysbase/unlink.c
--- newlib-1.16.0/libgloss/libsysbase/unlink.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/unlink.c 2008-10-19 16:45:49.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/unlink.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,33 @@
+#include "config.h"
+#include <_ansi.h>
@ -6003,7 +6021,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/unlink.c newlib-1.16.0-ppc/libglos
+
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/wait.c newlib-1.16.0-ppc/libgloss/libsysbase/wait.c
--- newlib-1.16.0/libgloss/libsysbase/wait.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/wait.c 2008-11-13 07:32:46.000000000 +0000
+++ newlib-1.16.0-ppc/libgloss/libsysbase/wait.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,28 @@
+/*
+ * Stub version of wait.
@ -6082,7 +6100,7 @@ diff -Nbaur newlib-1.16.0/libgloss/libsysbase/warning.h newlib-1.16.0-ppc/libglo
+#endif /* __WARNING_H__ */
diff -Nbaur newlib-1.16.0/libgloss/libsysbase/write.c newlib-1.16.0-ppc/libgloss/libsysbase/write.c
--- newlib-1.16.0/libgloss/libsysbase/write.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/libgloss/libsysbase/write.c 2008-11-13 02:20:55.000000000 +0000
+++ newlib-1.16.0-ppc/libgloss/libsysbase/write.c 2008-11-20 21:15:32.000000000 +0000
@@ -0,0 +1,48 @@
+#include "config.h"
+#include <_ansi.h>
@ -6326,8 +6344,8 @@ diff -Nbaur newlib-1.16.0/newlib/libc/include/sys/dirent.h newlib-1.16.0-ppc/new
\ No newline at end of file
diff -Nbaur newlib-1.16.0/newlib/libc/include/sys/iosupport.h newlib-1.16.0-ppc/newlib/libc/include/sys/iosupport.h
--- newlib-1.16.0/newlib/libc/include/sys/iosupport.h 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.16.0-ppc/newlib/libc/include/sys/iosupport.h 2008-11-19 03:22:17.000000000 +0000
@@ -0,0 +1,82 @@
+++ newlib-1.16.0-ppc/newlib/libc/include/sys/iosupport.h 2008-11-20 21:04:08.000000000 +0000
@@ -0,0 +1,83 @@
+//---------------------------------------------------------------------------------
+#ifndef __iosupp_h__
+#define __iosupp_h__
@ -6379,6 +6397,7 @@ diff -Nbaur newlib-1.16.0/newlib/libc/include/sys/iosupport.h newlib-1.16.0-ppc/
+ int (*dirclose_r)(struct _reent *r, DIR_ITER *dirState);
+ int (*statvfs_r)(struct _reent *r, const char *path, struct statvfs *buf);
+ int (*ftruncate_r)(struct _reent *r, int fd, off_t len);
+ int (*fsync_r)(struct _reent *r,int fd);
+ void *deviceData;
+} devoptab_t;
+