From 62b2adce92c2111d57a4977463904d25e83fb834 Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Tue, 27 Jan 2015 23:41:06 +0000 Subject: [PATCH] implement dup/dup2 --- dkarm-eabi/patches/newlib-2.2.0.patch | 1793 ++++++++----------------- 1 file changed, 582 insertions(+), 1211 deletions(-) diff --git a/dkarm-eabi/patches/newlib-2.2.0.patch b/dkarm-eabi/patches/newlib-2.2.0.patch index f202ba5..ef8e78c 100644 --- a/dkarm-eabi/patches/newlib-2.2.0.patch +++ b/dkarm-eabi/patches/newlib-2.2.0.patch @@ -1,376 +1,8 @@ -diff -NBaur newlib-2.2.0/libgloss/arm/_kill.c newlib-2.2.0-arm/libgloss/arm/_kill.c ---- newlib-2.2.0/libgloss/arm/_kill.c 2007-01-03 16:55:25 +0000 -+++ newlib-2.2.0-arm/libgloss/arm/_kill.c 2014-12-31 19:45:54 +0000 -@@ -1,6 +1,7 @@ - #include <_ansi.h> - #include - #include "swi.h" -+#include "arm.h" - - int _kill _PARAMS ((int, int)); - -@@ -20,6 +21,10 @@ - (void *) ADP_Stopped_ApplicationExit); - } - #else -+#ifdef __ARM_ARCH_6M__ -+ asm ("bkpt %a0" :: "i" (SWI_Exit)); -+#else - asm ("swi %a0" :: "i" (SWI_Exit)); - #endif -+#endif - } -diff -NBaur newlib-2.2.0/libgloss/arm/linux-syscalls0.S newlib-2.2.0-arm/libgloss/arm/linux-syscalls0.S ---- newlib-2.2.0/libgloss/arm/linux-syscalls0.S 2009-10-26 10:00:41 +0000 -+++ newlib-2.2.0-arm/libgloss/arm/linux-syscalls0.S 2014-12-31 19:45:54 +0000 -@@ -7,6 +7,7 @@ - */ - - #include "linux-syscall.h" -+#include "arm.h" - - #if __thumb__ - # define FUNC(name) .type name, %function; .thumb_func; name: -@@ -19,6 +20,26 @@ - #define GLOBAL(name) .global name; FUNC(name) - #define SIZE(name) .size name, .-name - -+#ifdef THUMB_V7M_V6M -+ -+# define SYSCALL4(name) \ -+ GLOBAL(_ ## name); \ -+ bkpt #SYS_ ## name; \ -+ b _set_errno; \ -+ SIZE(_ ## name) -+ -+# define SYSCALL6(name) \ -+ GLOBAL(_ ## name); \ -+ push { r4 - r5 }; \ -+ ldr r4, [sp, #8]; \ -+ ldr r5, [sp, #12]; \ -+ bkpt #SYS_ ## name; \ -+ pop { r4 - r5 }; \ -+ b _set_errno; \ -+ SIZE(_ ## name) -+ -+#else -+ - # define SYSCALL4(name) \ - GLOBAL(_ ## name); \ - swi #SYS_ ## name; \ -@@ -34,6 +55,7 @@ - pop { r4 - r5 }; \ - b _set_errno; \ - SIZE(_ ## name) -+#endif - - #define SYSCALL0(name) SYSCALL3(name) - #define SYSCALL3(name) SYSCALL4(name) -diff -NBaur newlib-2.2.0/libgloss/arm/redboot-syscalls.c newlib-2.2.0-arm/libgloss/arm/redboot-syscalls.c ---- newlib-2.2.0/libgloss/arm/redboot-syscalls.c 2008-01-03 22:38:30 +0000 -+++ newlib-2.2.0-arm/libgloss/arm/redboot-syscalls.c 2014-12-31 19:45:54 +0000 -@@ -20,13 +20,18 @@ - #include - #include - #include "syscall.h" -+#include "arm.h" - - // Use "naked" attribute to suppress C prologue/epilogue - static int __attribute__ ((naked)) __syscall(int func_no, ...) - { - asm ("mov r12, lr\n"); - #ifdef __thumb__ -+#ifdef THUMB_V7M_V6M -+ asm ("bkpt 0x18\n"); -+#else - asm ("swi 0x18\n"); -+#endif - #else - asm ("swi 0x180001\n"); - #endif -diff -NBaur newlib-2.2.0/libgloss/arm/syscalls.c newlib-2.2.0-arm/libgloss/arm/syscalls.c ---- newlib-2.2.0/libgloss/arm/syscalls.c 2014-02-11 19:55:22 +0000 -+++ newlib-2.2.0-arm/libgloss/arm/syscalls.c 2014-12-31 19:45:54 +0000 -@@ -16,6 +16,7 @@ - #include - #include - #include "swi.h" -+#include "arm.h" - - /* Forward prototypes. */ - int _system _PARAMS ((const char *)); -@@ -168,24 +169,45 @@ - const char * name; - - name = ":tt"; -+#ifdef __ARM_ARCH_6M__ -+ asm ("mov r0,%2; mov r1, #0; bkpt %a1; mov %0, r0" -+ : "=r"(fh) -+ : "i" (SWI_Open),"r"(name) -+ : "r0","r1"); -+#else - asm ("mov r0,%2; mov r1, #0; swi %a1; mov %0, r0" - : "=r"(fh) - : "i" (SWI_Open),"r"(name) - : "r0","r1"); -+#endif - monitor_stdin = fh; - - name = ":tt"; -+#ifdef __ARM_ARCH_6M__ -+ asm ("mov r0,%2; mov r1, #4; bkpt %a1; mov %0, r0" -+ : "=r"(fh) -+ : "i" (SWI_Open),"r"(name) -+ : "r0","r1"); -+#else - asm ("mov r0,%2; mov r1, #4; swi %a1; mov %0, r0" - : "=r"(fh) - : "i" (SWI_Open),"r"(name) - : "r0","r1"); -+#endif - monitor_stdout = fh; - - name = ":tt"; -+#ifdef __ARM_ARCH_6M__ -+ asm ("mov r0,%2; mov r1, #8; bkpt %a1; mov %0, r0" -+ : "=r"(fh) -+ : "i" (SWI_Open),"r"(name) -+ : "r0","r1"); -+#else - asm ("mov r0,%2; mov r1, #8; swi %a1; mov %0, r0" - : "=r"(fh) - : "i" (SWI_Open),"r"(name) - : "r0","r1"); -+#endif - monitor_stderr = fh; - #endif - -@@ -211,7 +233,11 @@ - return do_AngelSWI (AngelSWI_Reason_Errno, NULL); - #else - register r0 asm("r0"); -+#ifdef __ARM_ARCH_6M__ -+ asm ("bkpt %a1" : "=r"(r0) : "i" (SWI_GetErrno)); -+#else - asm ("swi %a1" : "=r"(r0) : "i" (SWI_GetErrno)); -+#endif - return r0; - #endif - } -@@ -257,9 +283,15 @@ - r0 = fh; - r1 = (int)ptr; - r2 = len; -+#ifdef __ARM_ARCH_6M__ -+ asm ("bkpt %a4" -+ : "=r" (r0) -+ : "0"(r0), "r"(r1), "r"(r2), "i"(SWI_Read)); -+#else - asm ("swi %a4" - : "=r" (r0) - : "0"(r0), "r"(r1), "r"(r2), "i"(SWI_Read)); -+#endif - return checkerror (r0); - #endif - } -@@ -353,10 +385,17 @@ - #else - if (dir == SEEK_END) - { -+#ifdef __ARM_ARCH_6M__ -+ asm ("mov r0, %2; bkpt %a1; mov %0, r0" -+ : "=r" (res) -+ : "i" (SWI_Flen), "r" (pfd->handle) -+ : "r0"); -+#else - asm ("mov r0, %2; swi %a1; mov %0, r0" - : "=r" (res) - : "i" (SWI_Flen), "r" (pfd->handle) - : "r0"); -+#endif - checkerror (res); - if (res == -1) - return -1; -@@ -364,10 +403,17 @@ - } - - /* This code only does absolute seeks. */ -+#ifdef __ARM_ARCH_6M__ -+ asm ("mov r0, %2; mov r1, %3; bkpt %a1; mov %0, r0" -+ : "=r" (res) -+ : "i" (SWI_Seek), "r" (pfd->handle), "r" (ptr) -+ : "r0", "r1"); -+#else - asm ("mov r0, %2; mov r1, %3; swi %a1; mov %0, r0" - : "=r" (res) - : "i" (SWI_Seek), "r" (pfd->handle), "r" (ptr) - : "r0", "r1"); -+#endif - checkerror (res); - #endif - /* At this point ptr is the current file position. */ -@@ -410,9 +456,15 @@ - r0 = fh; - r1 = (int)ptr; - r2 = len; -+#ifdef __ARM_ARCH_6M__ -+ asm ("bkpt %a4" -+ : "=r" (r0) -+ : "0"(r0), "r"(r1), "r"(r2), "i"(SWI_Write)); -+#else - asm ("swi %a4" - : "=r" (r0) - : "0"(r0), "r"(r1), "r"(r2), "i"(SWI_Write)); -+#endif - return checkerror (r0); - #endif - } -@@ -510,11 +562,18 @@ - fh = do_AngelSWI (AngelSWI_Reason_Open, block); - - #else -+#ifdef __ARM_ARCH_6M__ -+ asm ("mov r0,%2; mov r1, %3; bkpt %a1; mov %0, r0" -+ : "=r"(fh) -+ : "i" (SWI_Open),"r"(path),"r"(aflags) -+ : "r0","r1"); -+#else - asm ("mov r0,%2; mov r1, %3; swi %a1; mov %0, r0" - : "=r"(fh) - : "i" (SWI_Open),"r"(path),"r"(aflags) - : "r0","r1"); - #endif -+#endif - - /* Return a user file descriptor or an error. */ - if (fh >= 0) -@@ -542,9 +601,15 @@ - #else - register r0 asm("r0"); - r0 = fh; -+#ifdef __ARM_ARCH_6M__ -+ asm ("bkpt %a2" -+ : "=r"(r0) -+ : "0"(r0), "i" (SWI_Close)); -+#else - asm ("swi %a2" - : "=r"(r0) - : "0"(r0), "i" (SWI_Close)); -+#endif - return checkerror (r0); - #endif - } -@@ -640,10 +705,17 @@ - #ifdef ARM_RDI_MONITOR - res = checkerror (do_AngelSWI (AngelSWI_Reason_FLen, &pfd->handle)); - #else -+#ifdef __ARM_ARCH_6M__ -+ asm ("mov r0, %2; bkpt %a1; mov %0, r0" -+ : "=r" (res) -+ : "i" (SWI_Flen), "r" (pfd->handle) -+ : "r0"); -+#else - asm ("mov r0, %2; swi %a1; mov %0, r0" - : "=r" (res) - : "i" (SWI_Flen), "r" (pfd->handle) - : "r0"); -+#endif - checkerror (res); - #endif - if (res == -1) -@@ -695,9 +767,15 @@ - #else - register r0 asm("r0"); - r0 = (int)path; -+#ifdef __ARM_ARCH_6M__ -+ asm ("bkpt %a2" -+ : "=r"(r0) -+ : "0"(r0), "i" (SWI_Remove)); -+#else - asm ("swi %a2" - : "=r"(r0) - : "0"(r0), "i" (SWI_Remove)); -+#endif - res = r0; - #endif - if (res == -1) -@@ -717,7 +795,11 @@ - #else - { - int value; -+#ifdef __ARM_ARCH_6M__ -+ asm ("bkpt %a1; mov %0, r0" : "=r" (value): "i" (SWI_Time) : "r0"); -+#else - asm ("swi %a1; mov %0, r0" : "=r" (value): "i" (SWI_Time) : "r0"); -+#endif - tp->tv_sec = value; - } - #endif -@@ -743,8 +825,12 @@ - #ifdef ARM_RDI_MONITOR - timeval = do_AngelSWI (AngelSWI_Reason_Clock,NULL); - #else -+#ifdef __ARM_ARCH_6M__ -+ asm ("bkpt %a1; mov %0, r0" : "=r" (timeval): "i" (SWI_Clock) : "r0"); -+#else - asm ("swi %a1; mov %0, r0" : "=r" (timeval): "i" (SWI_Clock) : "r0"); - #endif -+#endif - return timeval; - } - -@@ -784,9 +870,15 @@ - #else - register r0 asm("r0"); - r0 = pfd->handle; -+#ifdef __ARM_ARCH_6M__ -+ asm ("bkpt %a2" -+ : "=r" (r0) -+ : "0"(r0), "i" (SWI_CLI)); -+#else - asm ("swi %a2" - : "=r" (r0) - : "0"(r0), "i" (SWI_IsTTY)); -+#endif - tty = r0; - #endif - -@@ -825,9 +917,15 @@ - #else - register r0 asm("r0"); - r0 = (int)s; -+#ifdef __ARM_ARCH_6M__ -+ asm ("bkpt %a2" -+ : "=r" (r0) -+ : "0"(r0), "i" (SWI_CLI)); -+#else - asm ("swi %a2" - : "=r" (r0) - : "0"(r0), "i" (SWI_CLI)); -+#endif - return checkerror (r0); - #endif - } -@@ -847,9 +945,15 @@ - register r1 asm("r1"); - r0 = (int)oldpath; - r1 = (int)newpath; -+#ifdef __ARM_ARCH_6M__ -+ asm ("bkpt %a3" -+ : "=r" (r0) -+ : "0" (r0), "r" (r1), "i" (SWI_Rename)); -+#else - asm ("swi %a3" - : "=r" (r0) - : "0" (r0), "r" (r1), "i" (SWI_Rename)); -+#endif - return checkerror (r0); - #endif - } -diff -NBaur newlib-2.2.0/libgloss/configure newlib-2.2.0-arm/libgloss/configure ---- newlib-2.2.0/libgloss/configure 2014-12-15 20:09:27 +0000 -+++ newlib-2.2.0-arm/libgloss/configure 2014-12-31 19:45:54 +0000 -@@ -2572,6 +2572,8 @@ +diff --git a/libgloss/configure b/libgloss/configure +index 87cf53c..dda06c2 100755 +--- a/libgloss/configure ++++ b/libgloss/configure +@@ -2572,6 +2572,8 @@ if test "${config_libnosys}" = "true"; then fi @@ -379,10 +11,11 @@ diff -NBaur newlib-2.2.0/libgloss/configure newlib-2.2.0-arm/libgloss/configure DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" -diff -NBaur newlib-2.2.0/libgloss/configure.in newlib-2.2.0-arm/libgloss/configure.in ---- newlib-2.2.0/libgloss/configure.in 2014-12-15 20:09:27 +0000 -+++ newlib-2.2.0-arm/libgloss/configure.in 2014-12-31 19:45:54 +0000 -@@ -2,6 +2,7 @@ +diff --git a/libgloss/configure.in b/libgloss/configure.in +index 74d4fd6..de0c45c 100644 +--- a/libgloss/configure.in ++++ b/libgloss/configure.in +@@ -2,6 +2,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT([libgloss],[LIBGLOSS_VERSION]) AC_CONFIG_SRCDIR([libnosys]) @@ -390,7 +23,7 @@ diff -NBaur newlib-2.2.0/libgloss/configure.in newlib-2.2.0-arm/libgloss/configu if test "${enable_shared}" = "yes" ; then echo "Shared libraries not supported for cross compiling, ignored" -@@ -173,6 +174,7 @@ +@@ -173,6 +174,7 @@ dnl fi if test "${config_libnosys}" = "true"; then AC_CONFIG_SUBDIRS([libnosys]) fi @@ -398,9 +31,11 @@ diff -NBaur newlib-2.2.0/libgloss/configure.in newlib-2.2.0-arm/libgloss/configu LIB_AC_PROG_CC AS=${AS-as} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/Makefile.in newlib-2.2.0-arm/libgloss/libsysbase/Makefile.in ---- newlib-2.2.0/libgloss/libsysbase/Makefile.in 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/Makefile.in 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/Makefile.in b/libgloss/libsysbase/Makefile.in +new file mode 100644 +index 0000000..7fd7357 +--- /dev/null ++++ b/libgloss/libsysbase/Makefile.in @@ -0,0 +1,148 @@ +# Copyright (c) 1998 Cygnus Support +# @@ -550,9 +185,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/Makefile.in newlib-2.2.0-arm/libglo + +config.status: configure + $(SHELL) config.status --recheck -diff -NBaur newlib-2.2.0/libgloss/libsysbase/_exit.c newlib-2.2.0-arm/libgloss/libsysbase/_exit.c ---- newlib-2.2.0/libgloss/libsysbase/_exit.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/_exit.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/_exit.c b/libgloss/libsysbase/_exit.c +new file mode 100644 +index 0000000..502d6fb +--- /dev/null ++++ b/libgloss/libsysbase/_exit.c @@ -0,0 +1,19 @@ +/* Stub version of _exit. */ + @@ -573,9 +210,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/_exit.c newlib-2.2.0-arm/libgloss/l + + while(1); +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/abort.c newlib-2.2.0-arm/libgloss/libsysbase/abort.c ---- newlib-2.2.0/libgloss/libsysbase/abort.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/abort.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/abort.c b/libgloss/libsysbase/abort.c +new file mode 100644 +index 0000000..9272e22 +--- /dev/null ++++ b/libgloss/libsysbase/abort.c @@ -0,0 +1,8 @@ +#include +#include @@ -585,9 +224,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/abort.c newlib-2.2.0-arm/libgloss/l + _exit (1); +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/acconfig.h newlib-2.2.0-arm/libgloss/libsysbase/acconfig.h ---- newlib-2.2.0/libgloss/libsysbase/acconfig.h 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/acconfig.h 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/acconfig.h b/libgloss/libsysbase/acconfig.h +new file mode 100644 +index 0000000..200ea78 +--- /dev/null ++++ b/libgloss/libsysbase/acconfig.h @@ -0,0 +1,29 @@ +/* Name of package. */ +#undef PACKAGE @@ -618,9 +259,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/acconfig.h newlib-2.2.0-arm/libglos + +/* symbol prefix */ +#undef __SYMBOL_PREFIX -diff -NBaur newlib-2.2.0/libgloss/libsysbase/aclocal.m4 newlib-2.2.0-arm/libgloss/libsysbase/aclocal.m4 ---- newlib-2.2.0/libgloss/libsysbase/aclocal.m4 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/aclocal.m4 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/aclocal.m4 b/libgloss/libsysbase/aclocal.m4 +new file mode 100644 +index 0000000..b6cdfae +--- /dev/null ++++ b/libgloss/libsysbase/aclocal.m4 @@ -0,0 +1,344 @@ +# generated automatically by aclocal 1.9.5 -*- Autoconf -*- + @@ -966,9 +609,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/aclocal.m4 newlib-2.2.0-arm/libglos +]) + +m4_include([../acinclude.m4]) -diff -NBaur newlib-2.2.0/libgloss/libsysbase/build_argv.c newlib-2.2.0-arm/libgloss/libsysbase/build_argv.c ---- newlib-2.2.0/libgloss/libsysbase/build_argv.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/build_argv.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/build_argv.c b/libgloss/libsysbase/build_argv.c +new file mode 100644 +index 0000000..79d2006 +--- /dev/null ++++ b/libgloss/libsysbase/build_argv.c @@ -0,0 +1,31 @@ +struct __argv { + int argvMagic; @@ -1001,9 +646,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/build_argv.c newlib-2.2.0-arm/libgl + argstruct->argc = argCount; + argstruct->endARGV = &argv[argCount]; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/chdir.c newlib-2.2.0-arm/libgloss/libsysbase/chdir.c ---- newlib-2.2.0/libgloss/libsysbase/chdir.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/chdir.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/chdir.c b/libgloss/libsysbase/chdir.c +new file mode 100644 +index 0000000..c850f27 +--- /dev/null ++++ b/libgloss/libsysbase/chdir.c @@ -0,0 +1,192 @@ +#include +#include @@ -1197,9 +844,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/chdir.c newlib-2.2.0-arm/libgloss/l + + return buf; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/chmod.c newlib-2.2.0-arm/libgloss/libsysbase/chmod.c ---- newlib-2.2.0/libgloss/libsysbase/chmod.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/chmod.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/chmod.c b/libgloss/libsysbase/chmod.c +new file mode 100644 +index 0000000..f3959bf +--- /dev/null ++++ b/libgloss/libsysbase/chmod.c @@ -0,0 +1,28 @@ +#include "config.h" +#include <_ansi.h> @@ -1229,10 +878,12 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/chmod.c newlib-2.2.0-arm/libgloss/l + return ret; +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/close.c newlib-2.2.0-arm/libgloss/libsysbase/close.c ---- newlib-2.2.0/libgloss/libsysbase/close.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/close.c 2014-12-31 19:45:54 +0000 -@@ -0,0 +1,43 @@ +diff --git a/libgloss/libsysbase/close.c b/libgloss/libsysbase/close.c +new file mode 100644 +index 0000000..3dd9a37 +--- /dev/null ++++ b/libgloss/libsysbase/close.c +@@ -0,0 +1,49 @@ +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> @@ -1264,21 +915,29 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/close.c newlib-2.2.0-arm/libgloss/l + + if ( handle != NULL) { + dev = handle->device; -+ fd = (unsigned int)handle->fileStruct; ++ handle->refcount--; ++ if (handle->refcount == 0 ) { ++ fd = (unsigned int)handle->fileStruct; + -+ if(devoptab_list[dev]->close_r) -+ ret = devoptab_list[dev]->close_r(ptr,fd); -+ else -+ ptr->_errno = ENOSYS; ++ if(devoptab_list[dev]->close_r) ++ ret = devoptab_list[dev]->close_r(ptr,fd); ++ else ++ ptr->_errno = ENOSYS; ++ ++ __release_handle(fileDesc); ++ } else { ++ ret = 0; ++ } + -+ __release_handle(fileDesc); + } + } + return ret; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/config.h.in newlib-2.2.0-arm/libgloss/libsysbase/config.h.in ---- newlib-2.2.0/libgloss/libsysbase/config.h.in 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/config.h.in 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/config.h.in b/libgloss/libsysbase/config.h.in +new file mode 100644 +index 0000000..48ce950 +--- /dev/null ++++ b/libgloss/libsysbase/config.h.in @@ -0,0 +1,25 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + @@ -1305,9 +964,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/config.h.in newlib-2.2.0-arm/libglo + +/* symbol prefix */ +#undef __SYMBOL_PREFIX -diff -NBaur newlib-2.2.0/libgloss/libsysbase/configure newlib-2.2.0-arm/libgloss/libsysbase/configure ---- newlib-2.2.0/libgloss/libsysbase/configure 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/configure 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/configure b/libgloss/libsysbase/configure +new file mode 100644 +index 0000000..0b232bc +--- /dev/null ++++ b/libgloss/libsysbase/configure @@ -0,0 +1,4170 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. @@ -5479,9 +5140,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/configure newlib-2.2.0-arm/libgloss + + + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/configure.in newlib-2.2.0-arm/libgloss/libsysbase/configure.in ---- newlib-2.2.0/libgloss/libsysbase/configure.in 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/configure.in 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/configure.in b/libgloss/libsysbase/configure.in +new file mode 100644 +index 0000000..edd389e +--- /dev/null ++++ b/libgloss/libsysbase/configure.in @@ -0,0 +1,210 @@ +# Copyright (c) 1995, 1996 Cygnus Support +# @@ -5693,9 +5356,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/configure.in newlib-2.2.0-arm/libgl +AC_OUTPUT + + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/dirent.c newlib-2.2.0-arm/libgloss/libsysbase/dirent.c ---- newlib-2.2.0/libgloss/libsysbase/dirent.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/dirent.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/dirent.c b/libgloss/libsysbase/dirent.c +new file mode 100644 +index 0000000..b703373 +--- /dev/null ++++ b/libgloss/libsysbase/dirent.c @@ -0,0 +1,250 @@ +#include +#include @@ -5947,9 +5612,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/dirent.c newlib-2.2.0-arm/libgloss/ + + return dirp->position; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/environ.c newlib-2.2.0-arm/libgloss/libsysbase/environ.c ---- newlib-2.2.0/libgloss/libsysbase/environ.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/environ.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/environ.c b/libgloss/libsysbase/environ.c +new file mode 100644 +index 0000000..1c485b2 +--- /dev/null ++++ b/libgloss/libsysbase/environ.c @@ -0,0 +1,6 @@ +/* + * Version of environ for no OS. @@ -5957,9 +5624,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/environ.c newlib-2.2.0-arm/libgloss + +char *__env[1] = { 0 }; +char **environ = __env; -diff -NBaur newlib-2.2.0/libgloss/libsysbase/execve.c newlib-2.2.0-arm/libgloss/libsysbase/execve.c ---- newlib-2.2.0/libgloss/libsysbase/execve.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/execve.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/execve.c b/libgloss/libsysbase/execve.c +new file mode 100644 +index 0000000..8b86b6b +--- /dev/null ++++ b/libgloss/libsysbase/execve.c @@ -0,0 +1,31 @@ +/* + * Stub version of execve. @@ -5992,9 +5661,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/execve.c newlib-2.2.0-arm/libgloss/ + return -1; +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/fchmod.c newlib-2.2.0-arm/libgloss/libsysbase/fchmod.c ---- newlib-2.2.0/libgloss/libsysbase/fchmod.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/fchmod.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/fchmod.c b/libgloss/libsysbase/fchmod.c +new file mode 100644 +index 0000000..f54aef2 +--- /dev/null ++++ b/libgloss/libsysbase/fchmod.c @@ -0,0 +1,31 @@ +#include "config.h" +#include <_ansi.h> @@ -6027,9 +5698,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/fchmod.c newlib-2.2.0-arm/libgloss/ + } + return ret; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/flock.c newlib-2.2.0-arm/libgloss/libsysbase/flock.c ---- newlib-2.2.0/libgloss/libsysbase/flock.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/flock.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/flock.c b/libgloss/libsysbase/flock.c +new file mode 100644 +index 0000000..c6b8c92 +--- /dev/null ++++ b/libgloss/libsysbase/flock.c @@ -0,0 +1,21 @@ +#include +#include <_ansi.h> @@ -6052,9 +5725,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/flock.c newlib-2.2.0-arm/libgloss/l +{ + __lock_release_recursive(*(_LOCK_RECURSIVE_T*)&fp->_lock); +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/fork.c newlib-2.2.0-arm/libgloss/libsysbase/fork.c ---- newlib-2.2.0/libgloss/libsysbase/fork.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/fork.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/fork.c b/libgloss/libsysbase/fork.c +new file mode 100644 +index 0000000..712b13e +--- /dev/null ++++ b/libgloss/libsysbase/fork.c @@ -0,0 +1,25 @@ +/* + * Stub version of fork. @@ -6081,10 +5756,12 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/fork.c newlib-2.2.0-arm/libgloss/li + r->_errno = ENOSYS; + return -1; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/fstat.c newlib-2.2.0-arm/libgloss/libsysbase/fstat.c ---- newlib-2.2.0/libgloss/libsysbase/fstat.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/fstat.c 2014-12-31 19:45:54 +0000 -@@ -0,0 +1,48 @@ +diff --git a/libgloss/libsysbase/fstat.c b/libgloss/libsysbase/fstat.c +new file mode 100644 +index 0000000..c0d80dd +--- /dev/null ++++ b/libgloss/libsysbase/fstat.c +@@ -0,0 +1,45 @@ +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> @@ -6115,16 +5792,13 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/fstat.c newlib-2.2.0-arm/libgloss/l + __handle * handle = NULL; + + if(fileDesc!=-1) { -+ if ( fileDesc < 3) { -+ dev = fileDesc; -+ } else { -+ handle = __get_handle(fileDesc); ++ handle = __get_handle(fileDesc); + -+ if ( NULL == handle ) return ret; ++ if ( NULL == handle ) return ret; ++ ++ dev = handle->device; ++ fd = (int)handle->fileStruct; + -+ dev = handle->device; -+ fd = (int)handle->fileStruct; -+ } + if(devoptab_list[dev]->fstat_r) { + ret = devoptab_list[dev]->fstat_r(r,fd,st); + } else { @@ -6133,10 +5807,12 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/fstat.c newlib-2.2.0-arm/libgloss/l + } + return ret; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/fsync.c newlib-2.2.0-arm/libgloss/libsysbase/fsync.c ---- newlib-2.2.0/libgloss/libsysbase/fsync.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/fsync.c 2014-12-31 19:45:54 +0000 -@@ -0,0 +1,39 @@ +diff --git a/libgloss/libsysbase/fsync.c b/libgloss/libsysbase/fsync.c +new file mode 100644 +index 0000000..fe68c00 +--- /dev/null ++++ b/libgloss/libsysbase/fsync.c +@@ -0,0 +1,35 @@ +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> @@ -6152,34 +5828,32 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/fsync.c newlib-2.2.0-arm/libgloss/l + unsigned int dev = 0; + unsigned int fd = -1; + struct _reent *r = _REENT; -+ -+ __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]->fsync_r) -+ ret = devoptab_list[dev]->fsync_r(r, fd); -+ else -+ r->_errno=ENOSYS; ++ __handle * handle; ++ ++ handle = __get_handle(fileDesc); ++ ++ if ( NULL == handle ) { ++ errno = EINVAL; ++ return ret; + } -+ ++ ++ dev = handle->device; ++ fd = (int)handle->fileStruct; ++ ++ if(devoptab_list[dev]->fsync_r) ++ ret = devoptab_list[dev]->fsync_r(r, fd); ++ else ++ r->_errno=ENOSYS; ++ + return ret; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/ftruncate.c newlib-2.2.0-arm/libgloss/libsysbase/ftruncate.c ---- newlib-2.2.0/libgloss/libsysbase/ftruncate.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/ftruncate.c 2014-12-31 19:45:54 +0000 -@@ -0,0 +1,40 @@ +diff --git a/libgloss/libsysbase/ftruncate.c b/libgloss/libsysbase/ftruncate.c +new file mode 100644 +index 0000000..909fadc +--- /dev/null ++++ b/libgloss/libsysbase/ftruncate.c +@@ -0,0 +1,36 @@ +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> @@ -6198,31 +5872,29 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/ftruncate.c newlib-2.2.0-arm/libglo + struct _reent *r = _REENT; + + __handle * handle; -+ -+ if ( fileDesc < 3) { -+ errno = EINVAL; -+ } else { -+ handle = __get_handle(fileDesc); -+ -+ if ( NULL == handle ) { -+ r->_errno = EINVAL; -+ return ret; -+ } + -+ dev = handle->device; -+ fd = (int)handle->fileStruct; ++ handle = __get_handle(fileDesc); + -+ if(devoptab_list[dev]->ftruncate_r) -+ ret = devoptab_list[dev]->ftruncate_r(r, fd, len); -+ else -+ r->_errno=ENOSYS; ++ if ( NULL == handle ) { ++ r->_errno = EINVAL; ++ return ret; + } -+ ++ ++ dev = handle->device; ++ fd = (int)handle->fileStruct; ++ ++ if(devoptab_list[dev]->ftruncate_r) ++ ret = devoptab_list[dev]->ftruncate_r(r, fd, len); ++ else ++ r->_errno=ENOSYS; ++ + return ret; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/getpid.c newlib-2.2.0-arm/libgloss/libsysbase/getpid.c ---- newlib-2.2.0/libgloss/libsysbase/getpid.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/getpid.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/getpid.c b/libgloss/libsysbase/getpid.c +new file mode 100644 +index 0000000..77d872b +--- /dev/null ++++ b/libgloss/libsysbase/getpid.c @@ -0,0 +1,21 @@ +#include "config.h" +#include <_ansi.h> @@ -6245,9 +5917,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/getpid.c newlib-2.2.0-arm/libgloss/ + return -1; +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/getreent.c newlib-2.2.0-arm/libgloss/libsysbase/getreent.c ---- newlib-2.2.0/libgloss/libsysbase/getreent.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/getreent.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/getreent.c b/libgloss/libsysbase/getreent.c +new file mode 100644 +index 0000000..1f7b905 +--- /dev/null ++++ b/libgloss/libsysbase/getreent.c @@ -0,0 +1,22 @@ + +/* default reentrant pointer when multithread enabled */ @@ -6271,9 +5945,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/getreent.c newlib-2.2.0-arm/libglos +} + + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/gettod.c newlib-2.2.0-arm/libgloss/libsysbase/gettod.c ---- newlib-2.2.0/libgloss/libsysbase/gettod.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/gettod.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/gettod.c b/libgloss/libsysbase/gettod.c +new file mode 100644 +index 0000000..d2982bc +--- /dev/null ++++ b/libgloss/libsysbase/gettod.c @@ -0,0 +1,35 @@ +#include "config.h" +#include <_ansi.h> @@ -6310,31 +5986,55 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/gettod.c newlib-2.2.0-arm/libgloss/ + +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/handle_manager.c newlib-2.2.0-arm/libgloss/libsysbase/handle_manager.c ---- newlib-2.2.0/libgloss/libsysbase/handle_manager.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/handle_manager.c 2014-12-31 19:45:54 +0000 -@@ -0,0 +1,52 @@ +diff --git a/libgloss/libsysbase/handle_manager.c b/libgloss/libsysbase/handle_manager.c +new file mode 100644 +index 0000000..c2f97a6 +--- /dev/null ++++ b/libgloss/libsysbase/handle_manager.c +@@ -0,0 +1,156 @@ +#include +#include ++#include + +#include + +#define MAX_HANDLES 1024 + -+static __handle* handles[MAX_HANDLES]; ++static __handle __stdin_handle = {0, 1, NULL}; ++static __handle __stdout_handle = {1, 1, NULL}; ++static __handle __stderr_handle = {2, 1, NULL}; ++ ++static __handle* handles[MAX_HANDLES] = { ++ &__stdin_handle, ++ &__stdout_handle, ++ &__stderr_handle ++}; + +__LOCK_INIT_RECURSIVE(static, __hndl_lock); + ++void __free_handle(__handle *handle) { ++ ++ if ( NULL != handle ++ && handle != &__stdin_handle ++ && handle != &__stdout_handle ++ && handle != &__stderr_handle ) { ++ ++ free(handle); ++ ++ } ++ ++} ++ +void __release_handle(int fd) { + -+ if ( fd < 3 || fd >= MAX_HANDLES + 3 ) return; ++ if ( fd <0 || fd >= MAX_HANDLES ) return; + -+ fd -= 3; -+ __handle* handle = handles[fd]; -+ if ( NULL != handle ) { -+ free(handle); -+ handles[fd] = NULL; -+ } ++ __lock_acquire_recursive (__hndl_lock); ++ ++ __free_handle(handles[fd]); ++ handles[fd] = NULL; ++ ++ __lock_release_recursive (__hndl_lock); + +} + @@ -6347,28 +6047,112 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/handle_manager.c newlib-2.2.0-arm/l + for ( i = 0; i < MAX_HANDLES; i++ ) { + if ( handles[i] == NULL ) break; + } -+ ++ + if ( i < MAX_HANDLES ) { + handles[i] = malloc(size); -+ if ( NULL != handles[i] ) ret = i+3; ++ if ( NULL != handles[i] ) { ++ handles[i]->refcount = 1; ++ ret = i; ++ } + } + + __lock_release_recursive (__hndl_lock); + -+ return ret; ++ return ret; +} + +__handle *__get_handle(int fd) { + -+ if ( fd < 3 || fd > MAX_HANDLES + 3 ) return NULL; -+ -+ return handles[fd-3]; ++ if ( fd < 0 || fd >= MAX_HANDLES ) return NULL; ++ ++ return handles[fd]; + +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/iosupport.c newlib-2.2.0-arm/libgloss/libsysbase/iosupport.c ---- newlib-2.2.0/libgloss/libsysbase/iosupport.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/iosupport.c 2015-01-15 10:47:03 +0000 ++int dup(int oldfd) { ++ int i, ret =-1; ++ ++ __lock_acquire_recursive (__hndl_lock); ++ ++ if (handles[oldfd]==NULL) { ++ __lock_release_recursive (__hndl_lock); ++ errno = EBADF; ++ return -1; ++ } ++ ++ ++ for ( i = 0; i < MAX_HANDLES; i++ ) { ++ if ( handles[i] == NULL ) break; ++ } ++ ++ if (irefcount++; ++ ret = i; ++ } ++ __lock_release_recursive (__hndl_lock); ++ ++ return ret; ++ ++} ++ ++int dup2(int oldfd, int newfd) { ++ ++ ++ __lock_acquire_recursive (__hndl_lock); ++ ++ if ( newfd < 0 || newfd >= MAX_HANDLES || ++ ++ oldfd < 0 || oldfd >= MAX_HANDLES || ++ handles[oldfd] == NULL ) { ++ ++ __lock_release_recursive (__hndl_lock); ++ errno = EBADF; ++ ++ return -1; ++ } ++ ++ if ( newfd == oldfd ) { ++ __lock_release_recursive (__hndl_lock); ++ return newfd; ++ } ++ ++ ++ __handle *handle = handles[newfd]; ++ ++ if ( NULL != handle ) { ++ ++ handle->refcount--; ++ ++ } ++ ++ handles[newfd] = handles[oldfd]; ++ handles[newfd]->refcount++; ++ ++ __lock_release_recursive (__hndl_lock); ++ ++ if ( NULL != handle ) { ++ ++ if (handle->refcount == 0 ) { ++ ++ if( devoptab_list[handle->device]->close_r != NULL) { ++ devoptab_list[handle->device]->close_r(_REENT,(unsigned int)handle->fileStruct); ++ } ++ else { ++ __free_handle(handle); ++ } ++ } ++ } ++ ++ return newfd; ++ ++} ++ +diff --git a/libgloss/libsysbase/iosupport.c b/libgloss/libsysbase/iosupport.c +new file mode 100644 +index 0000000..ae816a8 +--- /dev/null ++++ b/libgloss/libsysbase/iosupport.c @@ -0,0 +1,126 @@ +#include +#include @@ -6496,9 +6280,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/iosupport.c newlib-2.2.0-arm/libglo +} + + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/isatty.c newlib-2.2.0-arm/libgloss/libsysbase/isatty.c ---- newlib-2.2.0/libgloss/libsysbase/isatty.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/isatty.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/isatty.c b/libgloss/libsysbase/isatty.c +new file mode 100644 +index 0000000..c873e10 +--- /dev/null ++++ b/libgloss/libsysbase/isatty.c @@ -0,0 +1,20 @@ +#include "config.h" +#include <_ansi.h> @@ -6520,9 +6306,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/isatty.c newlib-2.2.0-arm/libgloss/ +#endif + return 0; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/kill.c newlib-2.2.0-arm/libgloss/libsysbase/kill.c ---- newlib-2.2.0/libgloss/libsysbase/kill.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/kill.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/kill.c b/libgloss/libsysbase/kill.c +new file mode 100644 +index 0000000..d56e340 +--- /dev/null ++++ b/libgloss/libsysbase/kill.c @@ -0,0 +1,23 @@ +/* + * Stub version of kill. @@ -6547,9 +6335,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/kill.c newlib-2.2.0-arm/libgloss/li + ptr->_errno = ENOSYS; + return -1; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/link.c newlib-2.2.0-arm/libgloss/libsysbase/link.c ---- newlib-2.2.0/libgloss/libsysbase/link.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/link.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/link.c b/libgloss/libsysbase/link.c +new file mode 100644 +index 0000000..c1698dd +--- /dev/null ++++ b/libgloss/libsysbase/link.c @@ -0,0 +1,37 @@ +#include "config.h" +#include <_ansi.h> @@ -6588,10 +6378,12 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/link.c newlib-2.2.0-arm/libgloss/li + return ret; +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/lseek.c newlib-2.2.0-arm/libgloss/libsysbase/lseek.c ---- newlib-2.2.0/libgloss/libsysbase/lseek.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/lseek.c 2014-12-31 19:45:54 +0000 -@@ -0,0 +1,57 @@ +diff --git a/libgloss/libsysbase/lseek.c b/libgloss/libsysbase/lseek.c +new file mode 100644 +index 0000000..aa232e0 +--- /dev/null ++++ b/libgloss/libsysbase/lseek.c +@@ -0,0 +1,53 @@ +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> @@ -6629,16 +6421,12 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/lseek.c newlib-2.2.0-arm/libgloss/l + + if(fileDesc!=-1) { + -+ if ( fileDesc < 3) { -+ dev = fileDesc; -+ } else { -+ handle = __get_handle(fileDesc); ++ handle = __get_handle(fileDesc); + -+ if ( NULL == handle ) return ret; ++ if ( NULL == handle ) return ret; + -+ dev = handle->device; -+ fd = (int)handle->fileStruct; -+ } ++ dev = handle->device; ++ fd = (int)handle->fileStruct; + + if(devoptab_list[dev]->seek_r) + ret = devoptab_list[dev]->seek_r( r, fd, pos, dir); @@ -6649,15 +6437,19 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/lseek.c newlib-2.2.0-arm/libgloss/l + return ret; + +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/malloc_vars.c newlib-2.2.0-arm/libgloss/libsysbase/malloc_vars.c ---- newlib-2.2.0/libgloss/libsysbase/malloc_vars.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/malloc_vars.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/malloc_vars.c b/libgloss/libsysbase/malloc_vars.c +new file mode 100644 +index 0000000..4565909 +--- /dev/null ++++ b/libgloss/libsysbase/malloc_vars.c @@ -0,0 +1,2 @@ +char *fake_heap_end = (char*)0; +char *fake_heap_start = (char*)0; -diff -NBaur newlib-2.2.0/libgloss/libsysbase/mkdir.c newlib-2.2.0-arm/libgloss/libsysbase/mkdir.c ---- newlib-2.2.0/libgloss/libsysbase/mkdir.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/mkdir.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/mkdir.c b/libgloss/libsysbase/mkdir.c +new file mode 100644 +index 0000000..45be096 +--- /dev/null ++++ b/libgloss/libsysbase/mkdir.c @@ -0,0 +1,18 @@ +#include +#include @@ -6677,9 +6469,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/mkdir.c newlib-2.2.0-arm/libgloss/l + + return ret; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/open.c newlib-2.2.0-arm/libgloss/libsysbase/open.c ---- newlib-2.2.0/libgloss/libsysbase/open.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/open.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/open.c b/libgloss/libsysbase/open.c +new file mode 100644 +index 0000000..7a3953c +--- /dev/null ++++ b/libgloss/libsysbase/open.c @@ -0,0 +1,60 @@ +#include "config.h" +#include <_ansi.h> @@ -6741,10 +6535,12 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/open.c newlib-2.2.0-arm/libgloss/li + + return fd; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/read.c newlib-2.2.0-arm/libgloss/libsysbase/read.c ---- newlib-2.2.0/libgloss/libsysbase/read.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/read.c 2014-12-31 19:45:54 +0000 -@@ -0,0 +1,50 @@ +diff --git a/libgloss/libsysbase/read.c b/libgloss/libsysbase/read.c +new file mode 100644 +index 0000000..c7eaafe +--- /dev/null ++++ b/libgloss/libsysbase/read.c +@@ -0,0 +1,47 @@ +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> @@ -6777,16 +6573,13 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/read.c newlib-2.2.0-arm/libgloss/li + __handle * handle = NULL; + + if(fileDesc!=-1) { -+ if ( fileDesc < 3) { -+ dev = fileDesc; -+ } else { -+ handle = __get_handle(fileDesc); ++ handle = __get_handle(fileDesc); + -+ if ( NULL == handle ) return ret; ++ if ( NULL == handle ) return ret; ++ ++ dev = handle->device; ++ fd = (int)handle->fileStruct; + -+ dev = handle->device; -+ fd = (int)handle->fileStruct; -+ } + if(devoptab_list[dev]->read_r) + ret = devoptab_list[dev]->read_r(r,fd,ptr,len); + else @@ -6795,9 +6588,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/read.c newlib-2.2.0-arm/libgloss/li + return ret; +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/rename.c newlib-2.2.0-arm/libgloss/libsysbase/rename.c ---- newlib-2.2.0/libgloss/libsysbase/rename.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/rename.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/rename.c b/libgloss/libsysbase/rename.c +new file mode 100644 +index 0000000..712d715 +--- /dev/null ++++ b/libgloss/libsysbase/rename.c @@ -0,0 +1,40 @@ +#include "config.h" +#include @@ -6839,9 +6634,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/rename.c newlib-2.2.0-arm/libgloss/ + + return ret; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/rmdir.c newlib-2.2.0-arm/libgloss/libsysbase/rmdir.c ---- newlib-2.2.0/libgloss/libsysbase/rmdir.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/rmdir.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/rmdir.c b/libgloss/libsysbase/rmdir.c +new file mode 100644 +index 0000000..e28caa1 +--- /dev/null ++++ b/libgloss/libsysbase/rmdir.c @@ -0,0 +1,24 @@ +#include "config.h" +#include <_ansi.h> @@ -6867,9 +6664,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/rmdir.c newlib-2.2.0-arm/libgloss/l + + return ret; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/sbrk.c newlib-2.2.0-arm/libgloss/libsysbase/sbrk.c ---- newlib-2.2.0/libgloss/libsysbase/sbrk.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/sbrk.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/sbrk.c b/libgloss/libsysbase/sbrk.c +new file mode 100644 +index 0000000..5dd550c +--- /dev/null ++++ b/libgloss/libsysbase/sbrk.c @@ -0,0 +1,60 @@ +#include "config.h" +#include <_ansi.h> @@ -6931,9 +6730,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/sbrk.c newlib-2.2.0-arm/libgloss/li + heap_start += incr; + return (caddr_t) prev_heap_start; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/stat.c newlib-2.2.0-arm/libgloss/libsysbase/stat.c ---- newlib-2.2.0/libgloss/libsysbase/stat.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/stat.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/stat.c b/libgloss/libsysbase/stat.c +new file mode 100644 +index 0000000..eceeac8 +--- /dev/null ++++ b/libgloss/libsysbase/stat.c @@ -0,0 +1,43 @@ +#include "config.h" +#include <_ansi.h> @@ -6978,9 +6779,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/stat.c newlib-2.2.0-arm/libgloss/li + return ret; +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/statvfs.c newlib-2.2.0-arm/libgloss/libsysbase/statvfs.c ---- newlib-2.2.0/libgloss/libsysbase/statvfs.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/statvfs.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/statvfs.c b/libgloss/libsysbase/statvfs.c +new file mode 100644 +index 0000000..e259d18 +--- /dev/null ++++ b/libgloss/libsysbase/statvfs.c @@ -0,0 +1,23 @@ +#include +#include @@ -7005,9 +6808,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/statvfs.c newlib-2.2.0-arm/libgloss + + return ret; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/syscall_support.c newlib-2.2.0-arm/libgloss/libsysbase/syscall_support.c ---- newlib-2.2.0/libgloss/libsysbase/syscall_support.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/syscall_support.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/syscall_support.c b/libgloss/libsysbase/syscall_support.c +new file mode 100644 +index 0000000..c8c8ae6 +--- /dev/null ++++ b/libgloss/libsysbase/syscall_support.c @@ -0,0 +1,51 @@ +#include + @@ -7060,9 +6865,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/syscall_support.c newlib-2.2.0-arm/ + return 0; +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/times.c newlib-2.2.0-arm/libgloss/libsysbase/times.c ---- newlib-2.2.0/libgloss/libsysbase/times.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/times.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/times.c b/libgloss/libsysbase/times.c +new file mode 100644 +index 0000000..67db6c7 +--- /dev/null ++++ b/libgloss/libsysbase/times.c @@ -0,0 +1,21 @@ +#include "config.h" +#include <_ansi.h> @@ -7085,10 +6892,12 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/times.c newlib-2.2.0-arm/libgloss/l + return (clock_t)-1; +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/truncate.c newlib-2.2.0-arm/libgloss/libsysbase/truncate.c ---- newlib-2.2.0/libgloss/libsysbase/truncate.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/truncate.c 2014-12-31 19:45:54 +0000 -@@ -0,0 +1,59 @@ +diff --git a/libgloss/libsysbase/truncate.c b/libgloss/libsysbase/truncate.c +new file mode 100644 +index 0000000..3b83711 +--- /dev/null ++++ b/libgloss/libsysbase/truncate.c +@@ -0,0 +1,57 @@ +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> @@ -7102,37 +6911,35 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/truncate.c newlib-2.2.0-arm/libglos + const char *file _AND + off_t len) +{ -+ ++ + __handle *handle; + int dev, fd, ret; + + struct _reent * r = _REENT; + + dev = FindDevice(file); -+ ++ + fd = -1; -+ if(dev!=-1 && devoptab_list[dev]->open_r && devoptab_list[dev]->close_r && -+ devoptab_list[dev]->ftruncate_r) ++ 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 ); -+ ++ + 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); -+ ++ + if ( ret < 0 ) { + __release_handle(fd); + return ret; + } -+ ++ + ret = devoptab_list[dev]->ftruncate_r(r, fd, len); -+ -+ devoptab_list[dev]->close_r(r, fd); -+ ++ + if (ret >= 0) { + ret = devoptab_list[dev]->close_r(r, fd); + } else { @@ -7148,9 +6955,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/truncate.c newlib-2.2.0-arm/libglos + + return ret; +} -diff -NBaur newlib-2.2.0/libgloss/libsysbase/unlink.c newlib-2.2.0-arm/libgloss/libsysbase/unlink.c ---- newlib-2.2.0/libgloss/libsysbase/unlink.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/unlink.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/unlink.c b/libgloss/libsysbase/unlink.c +new file mode 100644 +index 0000000..d493ca5 +--- /dev/null ++++ b/libgloss/libsysbase/unlink.c @@ -0,0 +1,36 @@ +#include "config.h" +#include <_ansi.h> @@ -7188,9 +6997,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/unlink.c newlib-2.2.0-arm/libgloss/ + return ret; +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/wait.c newlib-2.2.0-arm/libgloss/libsysbase/wait.c ---- newlib-2.2.0/libgloss/libsysbase/wait.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/wait.c 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/wait.c b/libgloss/libsysbase/wait.c +new file mode 100644 +index 0000000..407a75a +--- /dev/null ++++ b/libgloss/libsysbase/wait.c @@ -0,0 +1,28 @@ +/* + * Stub version of wait. @@ -7220,9 +7031,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/wait.c newlib-2.2.0-arm/libgloss/li + return -1; +} + -diff -NBaur newlib-2.2.0/libgloss/libsysbase/warning.h newlib-2.2.0-arm/libgloss/libsysbase/warning.h ---- newlib-2.2.0/libgloss/libsysbase/warning.h 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/warning.h 2014-12-31 19:45:54 +0000 +diff --git a/libgloss/libsysbase/warning.h b/libgloss/libsysbase/warning.h +new file mode 100644 +index 0000000..2c29982 +--- /dev/null ++++ b/libgloss/libsysbase/warning.h @@ -0,0 +1,43 @@ +#ifndef __WARNING_H__ +#define __WARNING_H__ @@ -7267,10 +7080,12 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/warning.h newlib-2.2.0-arm/libgloss + "warning: " #name " is not implemented and will always fail") + +#endif /* __WARNING_H__ */ -diff -NBaur newlib-2.2.0/libgloss/libsysbase/write.c newlib-2.2.0-arm/libgloss/libsysbase/write.c ---- newlib-2.2.0/libgloss/libsysbase/write.c 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/libgloss/libsysbase/write.c 2014-12-31 19:45:54 +0000 -@@ -0,0 +1,51 @@ +diff --git a/libgloss/libsysbase/write.c b/libgloss/libsysbase/write.c +new file mode 100644 +index 0000000..263eb69 +--- /dev/null ++++ b/libgloss/libsysbase/write.c +@@ -0,0 +1,46 @@ +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> @@ -7302,19 +7117,14 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/write.c newlib-2.2.0-arm/libgloss/l + + __handle * handle = NULL; + -+ + if(fileDesc!=-1) { -+ if ( fileDesc < 3) { -+ dev = fileDesc; -+ ret = len; -+ } else { -+ handle = __get_handle(fileDesc); ++ handle = __get_handle(fileDesc); + -+ if ( NULL == handle ) return ret; ++ if ( NULL == handle ) return ret; ++ ++ dev = handle->device; ++ fd = (int)handle->fileStruct; + -+ dev = handle->device; -+ fd = (int)handle->fileStruct; -+ } + if(devoptab_list[dev]->write_r) + ret = devoptab_list[dev]->write_r(r,fd,ptr,len); + else @@ -7322,10 +7132,11 @@ diff -NBaur newlib-2.2.0/libgloss/libsysbase/write.c newlib-2.2.0-arm/libgloss/l + } + return ret; +} -diff -NBaur newlib-2.2.0/newlib/configure.host newlib-2.2.0-arm/newlib/configure.host ---- newlib-2.2.0/newlib/configure.host 2014-12-15 13:27:37 +0000 -+++ newlib-2.2.0-arm/newlib/configure.host 2014-12-31 19:45:54 +0000 -@@ -602,6 +602,14 @@ +diff --git a/newlib/configure.host b/newlib/configure.host +index c4773d9..4f1f5a2 100644 +--- a/newlib/configure.host ++++ b/newlib/configure.host +@@ -602,6 +602,14 @@ case "${host}" in arc-*-*) syscall_dir=syscalls ;; @@ -7340,445 +7151,11 @@ diff -NBaur newlib-2.2.0/newlib/configure.host newlib-2.2.0-arm/newlib/configure arm*-*-pe) syscall_dir=syscalls ;; -diff -NBaur newlib-2.2.0/newlib/libc/include/pthread.h newlib-2.2.0-arm/newlib/libc/include/pthread.h ---- newlib-2.2.0/newlib/libc/include/pthread.h 2013-11-29 23:35:34 +0000 -+++ newlib-2.2.0-arm/newlib/libc/include/pthread.h 1970-01-01 00:00:00 +0000 -@@ -1,431 +0,0 @@ --/* pthread.h -- * -- * Written by Joel Sherrill . -- * -- * COPYRIGHT (c) 1989-2013. -- * On-Line Applications Research Corporation (OAR). -- * -- * Permission to use, copy, modify, and distribute this software for any -- * purpose without fee is hereby granted, provided that this entire notice -- * is included in all copies of any software which is or includes a copy -- * or modification of this software. -- * -- * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED -- * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION -- * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS -- * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. -- * -- * $Id: pthread.h,v 1.12 2013/11/29 23:35:34 joel Exp $ -- */ -- --#ifndef __PTHREAD_h --#define __PTHREAD_h -- --#ifdef __cplusplus --extern "C" { --#endif -- --#include -- --#if defined(_POSIX_THREADS) -- --#include --#include --#include --#include -- --struct _pthread_cleanup_context { -- void (*_routine)(void *); -- void *_arg; -- int _canceltype; -- struct _pthread_cleanup_context *_previous; --}; -- --/* Register Fork Handlers */ --int _EXFUN(pthread_atfork,(void (*prepare)(void), void (*parent)(void), -- void (*child)(void))); -- --/* Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81 */ -- --int _EXFUN(pthread_mutexattr_init, (pthread_mutexattr_t *__attr)); --int _EXFUN(pthread_mutexattr_destroy, (pthread_mutexattr_t *__attr)); --int _EXFUN(pthread_mutexattr_getpshared, -- (_CONST pthread_mutexattr_t *__attr, int *__pshared)); --int _EXFUN(pthread_mutexattr_setpshared, -- (pthread_mutexattr_t *__attr, int __pshared)); -- --#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) -- --/* Single UNIX Specification 2 Mutex Attributes types */ -- --int _EXFUN(pthread_mutexattr_gettype, -- (_CONST pthread_mutexattr_t *__attr, int *__kind)); --int _EXFUN(pthread_mutexattr_settype, -- (pthread_mutexattr_t *__attr, int __kind)); -- --#endif -- --/* Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87 */ -- --int _EXFUN(pthread_mutex_init, -- (pthread_mutex_t *__mutex, _CONST pthread_mutexattr_t *__attr)); --int _EXFUN(pthread_mutex_destroy, (pthread_mutex_t *__mutex)); -- --/* This is used to statically initialize a pthread_mutex_t. Example: -- -- pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; -- */ -- --#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF) -- --/* Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93 -- NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29 */ -- --int _EXFUN(pthread_mutex_lock, (pthread_mutex_t *__mutex)); --int _EXFUN(pthread_mutex_trylock, (pthread_mutex_t *__mutex)); --int _EXFUN(pthread_mutex_unlock, (pthread_mutex_t *__mutex)); -- --#if defined(_POSIX_TIMEOUTS) -- --int _EXFUN(pthread_mutex_timedlock, -- (pthread_mutex_t *__mutex, _CONST struct timespec *__timeout)); -- --#endif /* _POSIX_TIMEOUTS */ -- --/* Condition Variable Initialization Attributes, P1003.1c/Draft 10, p. 96 */ -- --int _EXFUN(pthread_condattr_init, (pthread_condattr_t *__attr)); --int _EXFUN(pthread_condattr_destroy, (pthread_condattr_t *__attr)); --int _EXFUN(pthread_condattr_getpshared, -- (_CONST pthread_condattr_t *__attr, int *__pshared)); --int _EXFUN(pthread_condattr_setpshared, -- (pthread_condattr_t *__attr, int __pshared)); -- --/* Initializing and Destroying a Condition Variable, P1003.1c/Draft 10, p. 87 */ -- --int _EXFUN(pthread_cond_init, -- (pthread_cond_t *__cond, _CONST pthread_condattr_t *__attr)); --int _EXFUN(pthread_cond_destroy, (pthread_cond_t *__mutex)); -- --/* This is used to statically initialize a pthread_cond_t. Example: -- -- pthread_cond_t cond = PTHREAD_COND_INITIALIZER; -- */ -- --#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) 0xFFFFFFFF) -- --/* Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101 */ -- --int _EXFUN(pthread_cond_signal, (pthread_cond_t *__cond)); --int _EXFUN(pthread_cond_broadcast, (pthread_cond_t *__cond)); -- --/* Waiting on a Condition, P1003.1c/Draft 10, p. 105 */ -- --int _EXFUN(pthread_cond_wait, -- (pthread_cond_t *__cond, pthread_mutex_t *__mutex)); -- --int _EXFUN(pthread_cond_timedwait, -- (pthread_cond_t *__cond, pthread_mutex_t *__mutex, -- _CONST struct timespec *__abstime)); -- --#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) -- --/* Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120 */ -- --int _EXFUN(pthread_attr_setscope, -- (pthread_attr_t *__attr, int __contentionscope)); --int _EXFUN(pthread_attr_getscope, -- (_CONST pthread_attr_t *__attr, int *__contentionscope)); --int _EXFUN(pthread_attr_setinheritsched, -- (pthread_attr_t *__attr, int __inheritsched)); --int _EXFUN(pthread_attr_getinheritsched, -- (_CONST pthread_attr_t *__attr, int *__inheritsched)); --int _EXFUN(pthread_attr_setschedpolicy, -- (pthread_attr_t *__attr, int __policy)); --int _EXFUN(pthread_attr_getschedpolicy, -- (_CONST pthread_attr_t *__attr, int *__policy)); -- --#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */ -- --int _EXFUN(pthread_attr_setschedparam, -- (pthread_attr_t *__attr, _CONST struct sched_param *__param)); --int _EXFUN(pthread_attr_getschedparam, -- (_CONST pthread_attr_t *__attr, struct sched_param *__param)); -- --#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) -- --/* Dynamic Thread Scheduling Parameters Access, P1003.1c/Draft 10, p. 124 */ -- --int _EXFUN(pthread_getschedparam, -- (pthread_t __pthread, int *__policy, struct sched_param *__param)); --int _EXFUN(pthread_setschedparam, -- (pthread_t __pthread, int __policy, struct sched_param *__param)); -- --#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */ -- --#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT) -- --/* Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128 */ -- --int _EXFUN(pthread_mutexattr_setprotocol, -- (pthread_mutexattr_t *__attr, int __protocol)); --int _EXFUN(pthread_mutexattr_getprotocol, -- (_CONST pthread_mutexattr_t *__attr, int *__protocol)); --int _EXFUN(pthread_mutexattr_setprioceiling, -- (pthread_mutexattr_t *__attr, int __prioceiling)); --int _EXFUN(pthread_mutexattr_getprioceiling, -- (_CONST pthread_mutexattr_t *__attr, int *__prioceiling)); -- --#endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */ -- --#if defined(_POSIX_THREAD_PRIO_PROTECT) -- --/* Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131 */ -- --int _EXFUN(pthread_mutex_setprioceiling, -- (pthread_mutex_t *__mutex, int __prioceiling, int *__old_ceiling)); --int _EXFUN(pthread_mutex_getprioceiling, -- (pthread_mutex_t *__mutex, int *__prioceiling)); -- --#endif /* _POSIX_THREAD_PRIO_PROTECT */ -- --/* Thread Creation Attributes, P1003.1c/Draft 10, p, 140 */ -- --int _EXFUN(pthread_attr_init, (pthread_attr_t *__attr)); --int _EXFUN(pthread_attr_destroy, (pthread_attr_t *__attr)); --int _EXFUN(pthread_attr_setstack, (pthread_attr_t *attr, -- void *__stackaddr, size_t __stacksize)); --int _EXFUN(pthread_attr_getstack, (_CONST pthread_attr_t *attr, -- void **__stackaddr, size_t *__stacksize)); --int _EXFUN(pthread_attr_getstacksize, -- (_CONST pthread_attr_t *__attr, size_t *__stacksize)); --int _EXFUN(pthread_attr_setstacksize, -- (pthread_attr_t *__attr, size_t __stacksize)); --int _EXFUN(pthread_attr_getstackaddr, -- (_CONST pthread_attr_t *__attr, void **__stackaddr)); --int _EXFUN(pthread_attr_setstackaddr, -- (pthread_attr_t *__attr, void *__stackaddr)); --int _EXFUN(pthread_attr_getdetachstate, -- (_CONST pthread_attr_t *__attr, int *__detachstate)); --int _EXFUN(pthread_attr_setdetachstate, -- (pthread_attr_t *__attr, int __detachstate)); --int _EXFUN(pthread_attr_getguardsize, -- (_CONST pthread_attr_t *__attr, size_t *__guardsize)); --int _EXFUN(pthread_attr_setguardsize, -- (pthread_attr_t *__attr, size_t __guardsize)); -- --/* POSIX thread APIs beyond the POSIX standard but provided -- * in GNU/Linux. They may be provided by other OSes for -- * compatibility. -- */ --#if defined(__GNU_VISIBLE) --#if defined(__rtems__) --int _EXFUN(pthread_attr_setaffinity_np, -- (pthread_attr_t *__attr, size_t __cpusetsize, -- const cpu_set_t *__cpuset)); --int _EXFUN(pthread_attr_getaffinity_np, -- (const pthread_attr_t *__attr, size_t __cpusetsize, -- cpu_set_t *__cpuset)); -- --int _EXFUN(pthread_setaffinity_np, -- (pthread_t __id, size_t __cpusetsize, const cpu_set_t *__cpuset)); --int _EXFUN(pthread_getaffinity_np, -- (const pthread_t __id, size_t __cpusetsize, cpu_set_t *__cpuset)); -- --int _EXFUN(pthread_getattr_np, -- (pthread_t __id, pthread_attr_t *__attr)); --#endif /* defined(__rtems__) */ --#endif /* defined(__GNU_VISIBLE) */ -- --/* Thread Creation, P1003.1c/Draft 10, p. 144 */ -- --int _EXFUN(pthread_create, -- (pthread_t *__pthread, _CONST pthread_attr_t *__attr, -- void *(*__start_routine)( void * ), void *__arg)); -- --/* Wait for Thread Termination, P1003.1c/Draft 10, p. 147 */ -- --int _EXFUN(pthread_join, (pthread_t __pthread, void **__value_ptr)); -- --/* Detaching a Thread, P1003.1c/Draft 10, p. 149 */ -- --int _EXFUN(pthread_detach, (pthread_t __pthread)); -- --/* Thread Termination, p1003.1c/Draft 10, p. 150 */ -- --void _EXFUN(pthread_exit, (void *__value_ptr)); -- --/* Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX */ -- --pthread_t _EXFUN(pthread_self, (void)); -- --/* Compare Thread IDs, p1003.1c/Draft 10, p. 153 */ -- --int _EXFUN(pthread_equal, (pthread_t __t1, pthread_t __t2)); -- --/* Dynamic Package Initialization */ -- --/* This is used to statically initialize a pthread_once_t. Example: -- -- pthread_once_t once = PTHREAD_ONCE_INIT; -- -- NOTE: This is named inconsistently -- it should be INITIALIZER. */ -- --#define PTHREAD_ONCE_INIT { 1, 0 } /* is initialized and not run */ -- --int _EXFUN(pthread_once, -- (pthread_once_t *__once_control, void (*__init_routine)(void))); -- --/* Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163 */ -- --int _EXFUN(pthread_key_create, -- (pthread_key_t *__key, void (*__destructor)( void * ))); -- --/* Thread-Specific Data Management, P1003.1c/Draft 10, p. 165 */ -- --int _EXFUN(pthread_setspecific, -- (pthread_key_t __key, _CONST void *__value)); --void * _EXFUN(pthread_getspecific, (pthread_key_t __key)); -- --/* Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167 */ -- --int _EXFUN(pthread_key_delete, (pthread_key_t __key)); -- --/* Execution of a Thread, P1003.1c/Draft 10, p. 181 */ -- --#define PTHREAD_CANCEL_ENABLE 0 --#define PTHREAD_CANCEL_DISABLE 1 -- --#define PTHREAD_CANCEL_DEFERRED 0 --#define PTHREAD_CANCEL_ASYNCHRONOUS 1 -- --#define PTHREAD_CANCELED ((void *) -1) -- --int _EXFUN(pthread_cancel, (pthread_t __pthread)); -- --/* Setting Cancelability State, P1003.1c/Draft 10, p. 183 */ -- --int _EXFUN(pthread_setcancelstate, (int __state, int *__oldstate)); --int _EXFUN(pthread_setcanceltype, (int __type, int *__oldtype)); --void _EXFUN(pthread_testcancel, (void)); -- --/* Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184 */ -- --void _EXFUN(_pthread_cleanup_push, -- (struct _pthread_cleanup_context *_context, -- void (*_routine)(void *), void *_arg)); -- --void _EXFUN(_pthread_cleanup_pop, -- (struct _pthread_cleanup_context *_context, -- int _execute)); -- --/* It is intentional to open and close the scope in two different macros */ --#define pthread_cleanup_push(_routine, _arg) \ -- do { \ -- struct _pthread_cleanup_context _pthread_clup_ctx; \ -- _pthread_cleanup_push(&_pthread_clup_ctx, (_routine), (_arg)) -- --#define pthread_cleanup_pop(_execute) \ -- _pthread_cleanup_pop(&_pthread_clup_ctx, (_execute)); \ -- } while (0) -- --#if defined(_GNU_SOURCE) --void _EXFUN(_pthread_cleanup_push_defer, -- (struct _pthread_cleanup_context *_context, -- void (*_routine)(void *), void *_arg)); -- --void _EXFUN(_pthread_cleanup_pop_restore, -- (struct _pthread_cleanup_context *_context, -- int _execute)); -- --/* It is intentional to open and close the scope in two different macros */ --#define pthread_cleanup_push_defer_np(_routine, _arg) \ -- do { \ -- struct _pthread_cleanup_context _pthread_clup_ctx; \ -- _pthread_cleanup_push_defer(&_pthread_clup_ctx, (_routine), (_arg)) -- --#define pthread_cleanup_pop_restore_np(_execute) \ -- _pthread_cleanup_pop_restore(&_pthread_clup_ctx, (_execute)); \ -- } while (0) --#endif /* defined(_GNU_SOURCE) */ -- --#if defined(_POSIX_THREAD_CPUTIME) -- --/* Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58 */ -- --int _EXFUN(pthread_getcpuclockid, -- (pthread_t __pthread_id, clockid_t *__clock_id)); -- --#endif /* defined(_POSIX_THREAD_CPUTIME) */ -- -- --#endif /* defined(_POSIX_THREADS) */ -- --#if defined(_POSIX_BARRIERS) -- --int _EXFUN(pthread_barrierattr_init, (pthread_barrierattr_t *__attr)); --int _EXFUN(pthread_barrierattr_destroy, (pthread_barrierattr_t *__attr)); --int _EXFUN(pthread_barrierattr_getpshared, -- (_CONST pthread_barrierattr_t *__attr, int *__pshared)); --int _EXFUN(pthread_barrierattr_setpshared, -- (pthread_barrierattr_t *__attr, int __pshared)); -- --#define PTHREAD_BARRIER_SERIAL_THREAD -1 -- --int _EXFUN(pthread_barrier_init, -- (pthread_barrier_t *__barrier, -- _CONST pthread_barrierattr_t *__attr, unsigned __count)); --int _EXFUN(pthread_barrier_destroy, (pthread_barrier_t *__barrier)); --int _EXFUN(pthread_barrier_wait,(pthread_barrier_t *__barrier)); -- --#endif /* defined(_POSIX_BARRIERS) */ -- --#if defined(_POSIX_SPIN_LOCKS) -- --int _EXFUN(pthread_spin_init, -- (pthread_spinlock_t *__spinlock, int __pshared)); --int _EXFUN(pthread_spin_destroy, (pthread_spinlock_t *__spinlock)); --int _EXFUN(pthread_spin_lock, (pthread_spinlock_t *__spinlock)); --int _EXFUN(pthread_spin_trylock, (pthread_spinlock_t *__spinlock)); --int _EXFUN(pthread_spin_unlock, (pthread_spinlock_t *__spinlock)); -- --#endif /* defined(_POSIX_SPIN_LOCKS) */ -- --#if defined(_POSIX_READER_WRITER_LOCKS) -- --/* This is used to statically initialize a pthread_rwlock_t. Example: -- -- pthread_mutex_t mutex = PTHREAD_RWLOCK_INITIALIZER; -- */ -- --#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) 0xFFFFFFFF) -- --int _EXFUN(pthread_rwlockattr_init, (pthread_rwlockattr_t *__attr)); --int _EXFUN(pthread_rwlockattr_destroy, (pthread_rwlockattr_t *__attr)); --int _EXFUN(pthread_rwlockattr_getpshared, -- (_CONST pthread_rwlockattr_t *__attr, int *__pshared)); --int _EXFUN(pthread_rwlockattr_setpshared, -- (pthread_rwlockattr_t *__attr, int __pshared)); -- --int _EXFUN(pthread_rwlock_init, -- (pthread_rwlock_t *__rwlock, _CONST pthread_rwlockattr_t *__attr)); --int _EXFUN(pthread_rwlock_destroy, (pthread_rwlock_t *__rwlock)); --int _EXFUN(pthread_rwlock_rdlock,(pthread_rwlock_t *__rwlock)); --int _EXFUN(pthread_rwlock_tryrdlock,(pthread_rwlock_t *__rwlock)); --int _EXFUN(pthread_rwlock_timedrdlock, -- (pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime)); --int _EXFUN(pthread_rwlock_unlock,(pthread_rwlock_t *__rwlock)); --int _EXFUN(pthread_rwlock_wrlock,(pthread_rwlock_t *__rwlock)); --int _EXFUN(pthread_rwlock_trywrlock,(pthread_rwlock_t *__rwlock)); --int _EXFUN(pthread_rwlock_timedwrlock, -- (pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime)); -- --#endif /* defined(_POSIX_READER_WRITER_LOCKS) */ -- -- --#ifdef __cplusplus --} --#endif -- --#endif --/* end of include file */ -diff -NBaur newlib-2.2.0/newlib/libc/include/sys/_types.h newlib-2.2.0-arm/newlib/libc/include/sys/_types.h ---- newlib-2.2.0/newlib/libc/include/sys/_types.h 2013-10-15 18:37:37 +0100 -+++ newlib-2.2.0-arm/newlib/libc/include/sys/_types.h 2014-12-31 19:45:54 +0000 -@@ -17,7 +17,7 @@ +diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h +index 07bc276..f5aedd0 100644 +--- a/newlib/libc/include/sys/_types.h ++++ b/newlib/libc/include/sys/_types.h +@@ -17,7 +17,7 @@ typedef long _off_t; #endif #ifndef __dev_t_defined @@ -7787,9 +7164,10 @@ diff -NBaur newlib-2.2.0/newlib/libc/include/sys/_types.h newlib-2.2.0-arm/newli #endif #ifndef __uid_t_defined -diff -NBaur newlib-2.2.0/newlib/libc/include/sys/config.h newlib-2.2.0-arm/newlib/libc/include/sys/config.h ---- newlib-2.2.0/newlib/libc/include/sys/config.h 2014-08-18 17:43:42 +0100 -+++ newlib-2.2.0-arm/newlib/libc/include/sys/config.h 2014-12-31 19:45:54 +0000 +diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h +index 0d27d6c..33b03cd 100644 +--- a/newlib/libc/include/sys/config.h ++++ b/newlib/libc/include/sys/config.h @@ -4,6 +4,9 @@ #include /* floating point macros */ #include /* POSIX defs */ @@ -7800,13 +7178,19 @@ diff -NBaur newlib-2.2.0/newlib/libc/include/sys/config.h newlib-2.2.0-arm/newli #ifdef __aarch64__ #define MALLOC_ALIGNMENT 16 #endif -diff -NBaur newlib-2.2.0/newlib/libc/include/sys/dirent.h newlib-2.2.0-arm/newlib/libc/include/sys/dirent.h ---- newlib-2.2.0/newlib/libc/include/sys/dirent.h 2005-10-04 21:47:39 +0100 -+++ newlib-2.2.0-arm/newlib/libc/include/sys/dirent.h 2014-12-31 19:45:54 +0000 -@@ -4,10 +4,49 @@ - not support , we will get this file which uses #error to force - an error. */ - +diff --git a/newlib/libc/include/sys/dirent.h b/newlib/libc/include/sys/dirent.h +index a3fb5c0..1ead46b 100644 +--- a/newlib/libc/include/sys/dirent.h ++++ b/newlib/libc/include/sys/dirent.h +@@ -1,13 +1,52 @@ + /* includes , which is this file. On a + system which supports , this file is overridden by + dirent.h in the libc/sys/.../sys directory. On a system which does +- not support , we will get this file which uses #error to force +- an error. */ ++ not support , we will get this file ++*/ ++ +#ifndef _dirent_h_ +#define _dirent_h_ + @@ -7823,24 +7207,24 @@ diff -NBaur newlib-2.2.0/newlib/libc/include/sys/dirent.h newlib-2.2.0-arm/newli +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 -+ + #ifdef __cplusplus extern "C" { #endif -#error " not supported" -+ ++ + struct dirent { + ino_t d_ino; + unsigned char d_type; + char d_name[NAME_MAX+1]; + }; -+ ++ + typedef struct { + long int position; + DIR_ITER* dirData; + struct dirent fileData; + } DIR; -+ ++ + int closedir(DIR *dirp); + DIR *opendir(const char *dirname); + struct dirent *readdir(DIR *dirp); @@ -7848,17 +7232,18 @@ diff -NBaur newlib-2.2.0/newlib/libc/include/sys/dirent.h newlib-2.2.0-arm/newli + void rewinddir(DIR *dirp); + void seekdir(DIR *dirp, long int loc); + long int telldir(DIR *dirp); -+ ++ #ifdef __cplusplus } #endif + +#endif // _dirent_h_ -\ No newline at end of file -diff -NBaur newlib-2.2.0/newlib/libc/include/sys/iosupport.h newlib-2.2.0-arm/newlib/libc/include/sys/iosupport.h ---- newlib-2.2.0/newlib/libc/include/sys/iosupport.h 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/newlib/libc/include/sys/iosupport.h 2015-01-15 10:47:23 +0000 -@@ -0,0 +1,103 @@ +diff --git a/newlib/libc/include/sys/iosupport.h b/newlib/libc/include/sys/iosupport.h +new file mode 100644 +index 0000000..d043a02 +--- /dev/null ++++ b/newlib/libc/include/sys/iosupport.h +@@ -0,0 +1,104 @@ +//--------------------------------------------------------------------------------- +#ifndef __iosupp_h__ +#define __iosupp_h__ @@ -7883,7 +7268,8 @@ diff -NBaur newlib-2.2.0/newlib/libc/include/sys/iosupport.h newlib-2.2.0-arm/ne + + +typedef struct { -+ int device; ++ unsigned int device; ++ unsigned int refcount; + void *fileStruct; +} __handle; + @@ -7962,9 +7348,11 @@ diff -NBaur newlib-2.2.0/newlib/libc/include/sys/iosupport.h newlib-2.2.0-arm/ne +//--------------------------------------------------------------------------------- +#endif // __iosupp_h__ +//--------------------------------------------------------------------------------- -diff -NBaur newlib-2.2.0/newlib/libc/include/sys/statvfs.h newlib-2.2.0-arm/newlib/libc/include/sys/statvfs.h ---- newlib-2.2.0/newlib/libc/include/sys/statvfs.h 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/newlib/libc/include/sys/statvfs.h 2014-12-31 19:45:54 +0000 +diff --git a/newlib/libc/include/sys/statvfs.h b/newlib/libc/include/sys/statvfs.h +new file mode 100644 +index 0000000..380329d +--- /dev/null ++++ b/newlib/libc/include/sys/statvfs.h @@ -0,0 +1,35 @@ +#ifndef _SYS_STATVFS_H +#define _SYS_STATVFS_H @@ -8002,9 +7390,10 @@ diff -NBaur newlib-2.2.0/newlib/libc/include/sys/statvfs.h newlib-2.2.0-arm/newl + +#endif // _SYS_STATVFS_H \ No newline at end of file -diff -NBaur newlib-2.2.0/newlib/libc/include/sys/syslimits.h newlib-2.2.0-arm/newlib/libc/include/sys/syslimits.h ---- newlib-2.2.0/newlib/libc/include/sys/syslimits.h 2002-08-23 02:56:03 +0100 -+++ newlib-2.2.0-arm/newlib/libc/include/sys/syslimits.h 2014-12-31 19:45:54 +0000 +diff --git a/newlib/libc/include/sys/syslimits.h b/newlib/libc/include/sys/syslimits.h +index ba9dbd6..8bc19ff 100644 +--- a/newlib/libc/include/sys/syslimits.h ++++ b/newlib/libc/include/sys/syslimits.h @@ -44,12 +44,12 @@ #define LINK_MAX 32767 /* max file link count */ #define MAX_CANON 255 /* max bytes in term canon input line */ @@ -8020,10 +7409,11 @@ diff -NBaur newlib-2.2.0/newlib/libc/include/sys/syslimits.h newlib-2.2.0-arm/ne #define PIPE_BUF 512 /* max bytes for atomic pipe writes */ #define IOV_MAX 1024 /* max elements in i/o vector */ -diff -NBaur newlib-2.2.0/newlib/libc/include/sys/types.h newlib-2.2.0-arm/newlib/libc/include/sys/types.h ---- newlib-2.2.0/newlib/libc/include/sys/types.h 2013-11-29 23:14:57 +0000 -+++ newlib-2.2.0-arm/newlib/libc/include/sys/types.h 2014-12-31 19:45:54 +0000 -@@ -152,7 +152,7 @@ +diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h +index ed33e0a..79f73ac 100644 +--- a/newlib/libc/include/sys/types.h ++++ b/newlib/libc/include/sys/types.h +@@ -152,7 +152,7 @@ typedef char * caddr_t; defined(__sparc__) || defined(__SPU__) typedef unsigned long ino_t; #else @@ -8032,7 +7422,7 @@ diff -NBaur newlib-2.2.0/newlib/libc/include/sys/types.h newlib-2.2.0-arm/newlib #endif #endif /*__CYGWIN__*/ -@@ -284,6 +284,9 @@ +@@ -284,6 +284,9 @@ typedef _TIMER_T_ timer_t; typedef unsigned long useconds_t; typedef long suseconds_t; @@ -8042,10 +7432,11 @@ diff -NBaur newlib-2.2.0/newlib/libc/include/sys/types.h newlib-2.2.0-arm/newlib #include -diff -NBaur newlib-2.2.0/newlib/libc/include/sys/unistd.h newlib-2.2.0-arm/newlib/libc/include/sys/unistd.h ---- newlib-2.2.0/newlib/libc/include/sys/unistd.h 2014-10-27 14:35:46 +0000 -+++ newlib-2.2.0-arm/newlib/libc/include/sys/unistd.h 2014-12-31 19:45:54 +0000 -@@ -89,9 +89,7 @@ +diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h +index a741383..d7cfa24 100644 +--- a/newlib/libc/include/sys/unistd.h ++++ b/newlib/libc/include/sys/unistd.h +@@ -89,9 +89,7 @@ uid_t _EXFUN(geteuid, (void )); gid_t _EXFUN(getgid, (void )); #endif int _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] )); @@ -8055,7 +7446,7 @@ diff -NBaur newlib-2.2.0/newlib/libc/include/sys/unistd.h newlib-2.2.0-arm/newli char * _EXFUN(getlogin, (void )); #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) int _EXFUN(getlogin_r, (char *name, size_t namesize) ); -@@ -230,12 +228,10 @@ +@@ -230,12 +228,10 @@ _READ_WRITE_RETURN_TYPE _EXFUN(_write, (int __fd, const void *__buf, size_t __nb int _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] )); #endif @@ -8068,10 +7459,20 @@ diff -NBaur newlib-2.2.0/newlib/libc/include/sys/unistd.h newlib-2.2.0-arm/newli #if defined(__CYGWIN__) || defined(__rtems__) int _EXFUN(getdtablesize, (void)); -diff -NBaur newlib-2.2.0/newlib/libc/locale/locale.c newlib-2.2.0-arm/newlib/libc/locale/locale.c ---- newlib-2.2.0/newlib/libc/locale/locale.c 2012-03-29 21:27:15 +0100 -+++ newlib-2.2.0-arm/newlib/libc/locale/locale.c 2014-12-31 19:45:54 +0000 -@@ -188,7 +188,12 @@ +diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c +index 8e2b121..4ccfac8 100644 +--- a/newlib/libc/locale/locale.c ++++ b/newlib/libc/locale/locale.c +@@ -107,7 +107,7 @@ beginning with <<"LC_">>. + + <> returns a pointer to a structure (also defined in + `<>') describing the locale-specific conventions currently +-in effect. ++in effect. + + <<_localeconv_r>> and <<_setlocale_r>> are reentrant versions of + <> and <> respectively. The extra argument +@@ -188,7 +188,12 @@ No supporting OS subroutines are required. #define _LC_LAST 7 #define ENCODING_LEN 31 @@ -8079,13 +7480,22 @@ diff -NBaur newlib-2.2.0/newlib/libc/locale/locale.c newlib-2.2.0-arm/newlib/lib +#ifdef __CYGWIN__ +#define __DEFAULT_UTF8__ +#endif -+ ++ + +#ifdef __DEFAULT_UTF8__ /* Cygwin defaults to utf8 which starts with LC_CTYPE set to "C.UTF-8". */ int __EXPORT __mb_cur_max = 6; #else int __EXPORT __mb_cur_max = 1; -@@ -240,7 +245,7 @@ +@@ -199,7 +204,7 @@ int __mlocale_changed = 0; + char *_PathLocale = NULL; + + static +-struct lconv lconv = ++struct lconv lconv = + { + ".", "", "", "", "", "", "", "", "", "", + CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, +@@ -240,7 +245,7 @@ char __default_locale[ENCODING_LEN + 1] = DEFAULT_LOCALE; static char current_categories[_LC_LAST][ENCODING_LEN + 1] = { "C", "C", @@ -8094,7 +7504,7 @@ diff -NBaur newlib-2.2.0/newlib/libc/locale/locale.c newlib-2.2.0-arm/newlib/lib "C.UTF-8", #else "C", -@@ -264,7 +269,7 @@ +@@ -264,7 +269,7 @@ static const char *__get_locale_env(struct _reent *, int); #endif /* _MB_CAPABLE */ @@ -8103,9 +7513,29 @@ diff -NBaur newlib-2.2.0/newlib/libc/locale/locale.c newlib-2.2.0-arm/newlib/lib static char lc_ctype_charset[ENCODING_LEN + 1] = "UTF-8"; #else static char lc_ctype_charset[ENCODING_LEN + 1] = "ASCII"; -diff -NBaur newlib-2.2.0/newlib/libc/machine/arm/sys/lock.h newlib-2.2.0-arm/newlib/libc/machine/arm/sys/lock.h ---- newlib-2.2.0/newlib/libc/machine/arm/sys/lock.h 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/newlib/libc/machine/arm/sys/lock.h 2014-12-31 19:45:54 +0000 +@@ -280,7 +285,7 @@ _DEFUN(_setlocale_r, (p, category, locale), + { + #ifndef _MB_CAPABLE + if (locale) +- { ++ { + if (strcmp (locale, "POSIX") && strcmp (locale, "C") + && strcmp (locale, "")) + return NULL; +@@ -969,7 +974,7 @@ _DEFUN_VOID(__locale_cjk_lang) + } + + struct lconv * +-_DEFUN(_localeconv_r, (data), ++_DEFUN(_localeconv_r, (data), + struct _reent *data) + { + #ifdef __HAVE_LOCALE_INFO__ +diff --git a/newlib/libc/machine/arm/sys/lock.h b/newlib/libc/machine/arm/sys/lock.h +new file mode 100644 +index 0000000..a6034e4 +--- /dev/null ++++ b/newlib/libc/machine/arm/sys/lock.h @@ -0,0 +1,78 @@ +#ifndef __SYS_LOCK_H__ +#define __SYS_LOCK_H__ @@ -8185,9 +7615,11 @@ diff -NBaur newlib-2.2.0/newlib/libc/machine/arm/sys/lock.h newlib-2.2.0-arm/new + + +#endif /* __SYS_LOCK_H__ */ -diff -NBaur newlib-2.2.0/newlib/libc/machine/arm/sys/stdio.h newlib-2.2.0-arm/newlib/libc/machine/arm/sys/stdio.h ---- newlib-2.2.0/newlib/libc/machine/arm/sys/stdio.h 1970-01-01 00:00:00 +0000 -+++ newlib-2.2.0-arm/newlib/libc/machine/arm/sys/stdio.h 2014-12-31 19:45:54 +0000 +diff --git a/newlib/libc/machine/arm/sys/stdio.h b/newlib/libc/machine/arm/sys/stdio.h +new file mode 100644 +index 0000000..4eb278e +--- /dev/null ++++ b/newlib/libc/machine/arm/sys/stdio.h @@ -0,0 +1,27 @@ +#ifndef _NEWLIB_STDIO_H +#define _NEWLIB_STDIO_H @@ -8216,36 +7648,26 @@ diff -NBaur newlib-2.2.0/newlib/libc/machine/arm/sys/stdio.h newlib-2.2.0-arm/ne +#endif + +#endif /* _NEWLIB_STDIO_H */ -diff -NBaur newlib-2.2.0/newlib/libc/misc/init.c newlib-2.2.0-arm/newlib/libc/misc/init.c ---- newlib-2.2.0/newlib/libc/misc/init.c 2010-06-04 16:30:40 +0100 -+++ newlib-2.2.0-arm/newlib/libc/misc/init.c 2014-12-31 19:45:54 +0000 -@@ -40,4 +40,8 @@ - for (i = 0; i < count; i++) - __init_array_start[i] (); - } -+#else -+ -+#error why am I not defined -+ - #endif -diff -NBaur newlib-2.2.0/newlib/libc/reent/getreent.c newlib-2.2.0-arm/newlib/libc/reent/getreent.c ---- newlib-2.2.0/newlib/libc/reent/getreent.c 2007-09-07 01:45:55 +0100 -+++ newlib-2.2.0-arm/newlib/libc/reent/getreent.c 2014-12-31 19:45:54 +0000 +diff --git a/newlib/libc/reent/getreent.c b/newlib/libc/reent/getreent.c +index 60ae6fb..781f2c3 100644 +--- a/newlib/libc/reent/getreent.c ++++ b/newlib/libc/reent/getreent.c @@ -1,3 +1,4 @@ +#if 0 /* default reentrant pointer when multithread enabled */ #include <_ansi.h> -@@ -12,3 +13,5 @@ +@@ -12,3 +13,5 @@ _DEFUN_VOID(__getreent) { return _impure_ptr; } + +#endif -diff -NBaur newlib-2.2.0/newlib/libc/reent/gettimeofdayr.c newlib-2.2.0-arm/newlib/libc/reent/gettimeofdayr.c ---- newlib-2.2.0/newlib/libc/reent/gettimeofdayr.c 2007-07-06 17:56:30 +0100 -+++ newlib-2.2.0-arm/newlib/libc/reent/gettimeofdayr.c 2014-12-31 19:45:54 +0000 -@@ -59,7 +59,7 @@ +diff --git a/newlib/libc/reent/gettimeofdayr.c b/newlib/libc/reent/gettimeofdayr.c +index f5a49f7..9551e5c 100644 +--- a/newlib/libc/reent/gettimeofdayr.c ++++ b/newlib/libc/reent/gettimeofdayr.c +@@ -59,7 +59,7 @@ DESCRIPTION Check libc.a to see if its available on yours. */ @@ -8254,57 +7676,18 @@ diff -NBaur newlib-2.2.0/newlib/libc/reent/gettimeofdayr.c newlib-2.2.0-arm/newl _DEFUN (_gettimeofday_r, (ptr, ptimeval, ptimezone), struct _reent *ptr _AND struct timeval *ptimeval _AND -@@ -72,5 +72,5 @@ +@@ -72,5 +72,5 @@ _DEFUN (_gettimeofday_r, (ptr, ptimeval, ptimezone), ptr->_errno = errno; return ret; } - +*/ #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ -diff -NBaur newlib-2.2.0/newlib/libc/stdio/fopen.c newlib-2.2.0-arm/newlib/libc/stdio/fopen.c ---- newlib-2.2.0/newlib/libc/stdio/fopen.c 2013-11-18 17:28:05 +0000 -+++ newlib-2.2.0-arm/newlib/libc/stdio/fopen.c 2015-01-15 09:25:28 +0000 -@@ -28,7 +28,7 @@ - #include - FILE *fopen(const char *<[file]>, const char *<[mode]>); - -- FILE *_fopen_r(struct _reent *<[reent]>, -+ FILE *_fopen_r(struct _reent *<[reent]>, - const char *<[file]>, const char *<[mode]>); - - TRAD_SYNOPSIS -@@ -121,8 +121,12 @@ - #ifdef __CYGWIN__ - #include - #endif -+ -+#include -+ - #include "local.h" - -+ - FILE * - _DEFUN(_fopen_r, (ptr, file, mode), - struct _reent *ptr _AND -@@ -140,12 +144,12 @@ - - if ((f = _open_r (ptr, file, oflags, 0666)) < 0) - { -- _newlib_sfp_lock_start (); -+ _newlib_sfp_lock_start (); - fp->_flags = 0; /* release */ - #ifndef __SINGLE_THREAD__ - __lock_close_recursive (fp->_lock); - #endif -- _newlib_sfp_lock_end (); -+ _newlib_sfp_lock_end (); - return NULL; - } - -diff -NBaur newlib-2.2.0/newlib/libc/stdio/fread.c newlib-2.2.0-arm/newlib/libc/stdio/fread.c ---- newlib-2.2.0/newlib/libc/stdio/fread.c 2014-12-18 14:55:20 +0000 -+++ newlib-2.2.0-arm/newlib/libc/stdio/fread.c 2015-01-21 13:45:42 +0000 -@@ -168,7 +168,7 @@ +diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c +index d55ff66..97a573b 100644 +--- a/newlib/libc/stdio/fread.c ++++ b/newlib/libc/stdio/fread.c +@@ -168,7 +168,7 @@ _DEFUN(crlf_r, (ptr, fp, buf, count, eof), } return count; @@ -8313,7 +7696,7 @@ diff -NBaur newlib-2.2.0/newlib/libc/stdio/fread.c newlib-2.2.0-arm/newlib/libc/ } #endif -@@ -259,7 +259,32 @@ +@@ -259,7 +259,32 @@ _DEFUN(_fread_r, (ptr, buf, size, count, fp), /* fp->_r = 0 ... done in __srefill */ p += r; resid -= r; @@ -8347,9 +7730,10 @@ diff -NBaur newlib-2.2.0/newlib/libc/stdio/fread.c newlib-2.2.0-arm/newlib/libc/ { /* no more input: return partial result */ #ifdef __SCLE -diff -NBaur newlib-2.2.0/newlib/libc/stdlib/mbtowc_r.c newlib-2.2.0-arm/newlib/libc/stdlib/mbtowc_r.c ---- newlib-2.2.0/newlib/libc/stdlib/mbtowc_r.c 2013-11-18 17:26:51 +0000 -+++ newlib-2.2.0-arm/newlib/libc/stdlib/mbtowc_r.c 2014-12-31 19:45:54 +0000 +diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c +index 986595c..df88752 100644 +--- a/newlib/libc/stdlib/mbtowc_r.c ++++ b/newlib/libc/stdlib/mbtowc_r.c @@ -9,7 +9,7 @@ int (*__mbtowc) (struct _reent *, wchar_t *, const char *, size_t, @@ -8359,9 +7743,10 @@ diff -NBaur newlib-2.2.0/newlib/libc/stdlib/mbtowc_r.c newlib-2.2.0-arm/newlib/l /* Cygwin starts up in UTF-8 mode. */ = __utf8_mbtowc; #else -diff -NBaur newlib-2.2.0/newlib/libc/stdlib/wctomb_r.c newlib-2.2.0-arm/newlib/libc/stdlib/wctomb_r.c ---- newlib-2.2.0/newlib/libc/stdlib/wctomb_r.c 2012-08-08 12:04:18 +0100 -+++ newlib-2.2.0-arm/newlib/libc/stdlib/wctomb_r.c 2014-12-31 19:45:54 +0000 +diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c +index 13e1e4c..ba71516 100644 +--- a/newlib/libc/stdlib/wctomb_r.c ++++ b/newlib/libc/stdlib/wctomb_r.c @@ -8,7 +8,7 @@ int (*__wctomb) (struct _reent *, char *, wchar_t, const char *charset, @@ -8371,9 +7756,10 @@ diff -NBaur newlib-2.2.0/newlib/libc/stdlib/wctomb_r.c newlib-2.2.0-arm/newlib/l /* Cygwin starts up in UTF-8 mode. */ = __utf8_wctomb; #else -diff -NBaur newlib-2.2.0/newlib/libc/sys/arm/sys/param.h newlib-2.2.0-arm/newlib/libc/sys/arm/sys/param.h ---- newlib-2.2.0/newlib/libc/sys/arm/sys/param.h 2005-02-02 19:00:30 +0000 -+++ newlib-2.2.0-arm/newlib/libc/sys/arm/sys/param.h 2014-12-31 19:45:54 +0000 +diff --git a/newlib/libc/sys/arm/sys/param.h b/newlib/libc/sys/arm/sys/param.h +index adc066e..4bf7ad5 100644 +--- a/newlib/libc/sys/arm/sys/param.h ++++ b/newlib/libc/sys/arm/sys/param.h @@ -3,10 +3,17 @@ #ifndef _SYS_PARAM_H # define _SYS_PARAM_H @@ -8394,18 +7780,3 @@ diff -NBaur newlib-2.2.0/newlib/libc/sys/arm/sys/param.h newlib-2.2.0-arm/newlib #define BIG_ENDIAN 4321 #define LITTLE_ENDIAN 1234 -diff -NBaur newlib-2.2.0/newlib/libc/syscalls/Makefile.am newlib-2.2.0-arm/newlib/libc/syscalls/Makefile.am ---- newlib-2.2.0/newlib/libc/syscalls/Makefile.am 2008-01-03 22:33:37 +0000 -+++ newlib-2.2.0-arm/newlib/libc/syscalls/Makefile.am 2014-12-31 19:45:54 +0000 -@@ -20,8 +20,9 @@ - sysstat.c \ - systimes.c \ - sysunlink.c \ -- syswrite.c -- -+ syswrite.c \ -+ sysftruncate.c \ -+ systruncate.c - - ## Weed out EL/IX level 3 interfaces if necessary - if ELIX_LEVEL_1