Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/include')
-rw-r--r--newlib/libc/include/_syslist.h15
-rw-r--r--newlib/libc/include/getopt.h136
-rw-r--r--newlib/libc/include/ieeefp.h7
-rw-r--r--newlib/libc/include/inttypes.h290
-rw-r--r--newlib/libc/include/machine/ieeefp.h9
-rw-r--r--newlib/libc/include/machine/setjmp.h13
-rw-r--r--newlib/libc/include/math.h85
-rw-r--r--newlib/libc/include/stdint.h401
-rw-r--r--newlib/libc/include/stdio.h5
-rw-r--r--newlib/libc/include/stdlib.h46
-rw-r--r--newlib/libc/include/string.h3
-rw-r--r--newlib/libc/include/sys/config.h18
-rw-r--r--newlib/libc/include/sys/dirent.h8
-rw-r--r--newlib/libc/include/sys/fcntl.h6
-rw-r--r--newlib/libc/include/sys/features.h1
-rw-r--r--newlib/libc/include/sys/time.h6
-rw-r--r--newlib/libc/include/sys/types.h12
-rw-r--r--newlib/libc/include/sys/unistd.h2
-rw-r--r--newlib/libc/include/time.h32
19 files changed, 114 insertions, 981 deletions
diff --git a/newlib/libc/include/_syslist.h b/newlib/libc/include/_syslist.h
index 0bf76e108..fa552fb60 100644
--- a/newlib/libc/include/_syslist.h
+++ b/newlib/libc/include/_syslist.h
@@ -2,7 +2,6 @@
and only provide C names, so that we end up in violation of ANSI */
#ifndef __SYSLIST_H
#define __SYSLIST_H
-
#ifdef MISSING_SYSCALL_NAMES
#define _close close
#define _execve execve
@@ -22,17 +21,9 @@
#define _unlink unlink
#define _wait wait
#define _write write
-#endif /* MISSING_SYSCALL_NAMES */
-
-#if defined MISSING_SYSCALL_NAMES || !defined HAVE_OPENDIR
-/* If the system call interface is missing opendir, readdir, and
- closedir, there is an implementation of these functions in
- libc/posix that is implemented using open, getdents, and close.
- Note, these functions are currently not in the libc/syscalls
- directory. */
+/* functions not yet sysfaked */
#define _opendir opendir
#define _readdir readdir
#define _closedir closedir
-#endif /* MISSING_SYSCALL_NAMES || !HAVE_OPENDIR */
-
-#endif /* !__SYSLIST_H_ */
+#endif
+#endif
diff --git a/newlib/libc/include/getopt.h b/newlib/libc/include/getopt.h
deleted file mode 100644
index 7179298ae..000000000
--- a/newlib/libc/include/getopt.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-
-getopt.h - Read command line options
-
-AUTHOR: Gregory Pietsch
-CREATED Thu Jan 09 22:37:00 1997
-
-DESCRIPTION:
-
-The getopt() function parses the command line arguments. Its arguments argc
-and argv are the argument count and array as passed to the main() function
-on program invocation. The argument optstring is a list of available option
-characters. If such a character is followed by a colon (`:'), the option
-takes an argument, which is placed in optarg. If such a character is
-followed by two colons, the option takes an optional argument, which is
-placed in optarg. If the option does not take an argument, optarg is NULL.
-
-The external variable optind is the index of the next array element of argv
-to be processed; it communicates from one call to the next which element to
-process.
-
-The getopt_long() function works like getopt() except that it also accepts
-long options started by two dashes `--'. If these take values, it is either
-in the form
-
---arg=value
-
- or
-
---arg value
-
-It takes the additional arguments longopts which is a pointer to the first
-element of an array of type GETOPT_LONG_OPTION_T, defined below. The last
-element of the array has to be filled with NULL for the name field.
-
-The longind pointer points to the index of the current long option relative
-to longopts if it is non-NULL.
-
-The getopt() function returns the option character if the option was found
-successfully, `:' if there was a missing parameter for one of the options,
-`?' for an unknown option character, and EOF for the end of the option list.
-
-The getopt_long() function's return value is described below.
-
-The function getopt_long_only() is identical to getopt_long(), except that a
-plus sign `+' can introduce long options as well as `--'.
-
-Describe how to deal with options that follow non-option ARGV-elements.
-
-If the caller did not specify anything, the default is REQUIRE_ORDER if the
-environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise.
-
-REQUIRE_ORDER means don't recognize them as options; stop option processing
-when the first non-option is seen. This is what Unix does. This mode of
-operation is selected by either setting the environment variable
-POSIXLY_CORRECT, or using `+' as the first character of the optstring
-parameter.
-
-PERMUTE is the default. We permute the contents of ARGV as we scan, so that
-eventually all the non-options are at the end. This allows options to be
-given in any order, even with programs that were not written to expect this.
-
-RETURN_IN_ORDER is an option available to programs that were written to
-expect options and other ARGV-elements in any order and that care about the
-ordering of the two. We describe each non-option ARGV-element as if it were
-the argument of an option with character code 1. Using `-' as the first
-character of the optstring parameter selects this mode of operation.
-
-The special argument `--' forces an end of option-scanning regardless of the
-value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause
-getopt() and friends to return EOF with optind != argc.
-
-COPYRIGHT NOTICE AND DISCLAIMER:
-
-Copyright (C) 1997 Gregory Pietsch
-
-This file and the accompanying getopt.c implementation file are hereby
-placed in the public domain without restrictions. Just give the author
-credit, don't claim you wrote it or prevent anyone else from using it.
-
-Gregory Pietsch's current e-mail address:
-gpietsch@comcast.net
-****************************************************************************/
-
-#ifndef GETOPT_H
-#define GETOPT_H
-
-#include <_ansi.h>
-
-/* include files needed by this include file */
-
-/* macros defined by this include file */
-#define NO_ARG 0
-#define REQUIRED_ARG 1
-#define OPTIONAL_ARG 2
-
-/* types defined by this include file */
-
-struct option
-{
- char *name; /* the name of the long option */
- int has_arg; /* one of the above macros */
- int *flag; /* determines if getopt_long() returns a
- * value for a long option; if it is
- * non-NULL, 0 is returned as a function
- * value and the value of val is stored in
- * the area pointed to by flag. Otherwise,
- * val is returned. */
- int val; /* determines the value to return if flag is
- * NULL. */
-};
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
- /* externally-defined variables */
- extern char *optarg;
- extern int optind;
- extern int opterr;
- extern int optopt;
-
- /* function prototypes */
- int _EXFUN (getopt, (int __argc, char *const __argv[], const char *__optstring));
- int _EXFUN (getopt_long, (int __argc, char *const __argv[], const char *__shortopts, const struct option *__longopts, int *__longind));
- int _EXFUN (getopt_long_only, (int __argc, char *const __argv[], const char *__shortopts, const struct option *__longopts, int *__longind));
-
-#ifdef __cplusplus
-};
-
-#endif
-
-#endif /* GETOPT_H */
-
-/* END OF FILE getopt.h */
diff --git a/newlib/libc/include/ieeefp.h b/newlib/libc/include/ieeefp.h
index e08fd0885..78bb5bf62 100644
--- a/newlib/libc/include/ieeefp.h
+++ b/newlib/libc/include/ieeefp.h
@@ -5,8 +5,6 @@
#include <machine/ieeefp.h>
-_BEGIN_STD_C
-
/* FIXME FIXME FIXME:
Neither of __ieee_{float,double}_shape_tape seem to be used anywhere
except in libm/test. If that is the case, please delete these from here.
@@ -184,9 +182,6 @@ typedef int fp_rdi;
fp_rdi _EXFUN(fpgetroundtoi,(void));
fp_rdi _EXFUN(fpsetroundtoi,(fp_rdi));
-#undef isnan
-#undef isinf
-
int _EXFUN(isnan, (double));
int _EXFUN(isinf, (double));
int _EXFUN(finite, (double));
@@ -243,6 +238,4 @@ int _EXFUN(finitef, (float));
#endif /* _DOUBLE_IS_32BITS */
-_END_STD_C
-
#endif /* _IEEE_FP_H_ */
diff --git a/newlib/libc/include/inttypes.h b/newlib/libc/include/inttypes.h
deleted file mode 100644
index 0bcbd31c0..000000000
--- a/newlib/libc/include/inttypes.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (c) 2004, 2005 by
- * Ralf Corsepius, Ulm/Germany. All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * is freely granted, provided that this notice is preserved.
- */
-
-/**
- * @file inttypes.h
- */
-
-#ifndef _INTTYPES_H
-#define _INTTYPES_H
-
-#include <stdint.h>
-#define __need_wchar_t
-#include <stddef.h>
-
-#define __STRINGIFY(a) #a
-
-/* 8-bit types */
-#define __PRI8(x) __STRINGIFY(x)
-#define __SCN8(x) __STRINGIFY(hh##x)
-
-
-#define PRId8 __PRI8(d)
-#define PRIi8 __PRI8(i)
-#define PRIo8 __PRI8(o)
-#define PRIu8 __PRI8(u)
-#define PRIx8 __PRI8(x)
-#define PRIX8 __PRI8(X)
-
-#define SCNd8 __SCN8(d)
-#define SCNi8 __SCN8(i)
-#define SCNo8 __SCN8(o)
-#define SCNu8 __SCN8(u)
-#define SCNx8 __SCN8(x)
-
-
-#define PRIdLEAST8 __PRI8(d)
-#define PRIiLEAST8 __PRI8(i)
-#define PRIoLEAST8 __PRI8(o)
-#define PRIuLEAST8 __PRI8(u)
-#define PRIxLEAST8 __PRI8(x)
-#define PRIXLEAST8 __PRI8(X)
-
-#define SCNdLEAST8 __SCN8(d)
-#define SCNiLEAST8 __SCN8(i)
-#define SCNoLEAST8 __SCN8(o)
-#define SCNuLEAST8 __SCN8(u)
-#define SCNxLEAST8 __SCN8(x)
-
-
-#define PRIdFAST8 __PRI8(d)
-#define PRIiFAST8 __PRI8(i)
-#define PRIoFAST8 __PRI8(o)
-#define PRIuFAST8 __PRI8(u)
-#define PRIxFAST8 __PRI8(x)
-#define PRIXFAST8 __PRI8(X)
-
-#define SCNdFAST8 __SCN8(d)
-#define SCNiFAST8 __SCN8(i)
-#define SCNoFAST8 __SCN8(o)
-#define SCNuFAST8 __SCN8(u)
-#define SCNxFAST8 __SCN8(x)
-
-/* 16-bit types */
-#define __PRI16(x) __STRINGIFY(x)
-#define __SCN16(x) __STRINGIFY(h##x)
-
-
-#define PRId16 __PRI16(d)
-#define PRIi16 __PRI16(i)
-#define PRIo16 __PRI16(o)
-#define PRIu16 __PRI16(u)
-#define PRIx16 __PRI16(x)
-#define PRIX16 __PRI16(X)
-
-#define SCNd16 __SCN16(d)
-#define SCNi16 __SCN16(i)
-#define SCNo16 __SCN16(o)
-#define SCNu16 __SCN16(u)
-#define SCNx16 __SCN16(x)
-
-
-#define PRIdLEAST16 __PRI16(d)
-#define PRIiLEAST16 __PRI16(i)
-#define PRIoLEAST16 __PRI16(o)
-#define PRIuLEAST16 __PRI16(u)
-#define PRIxLEAST16 __PRI16(x)
-#define PRIXLEAST16 __PRI16(X)
-
-#define SCNdLEAST16 __SCN16(d)
-#define SCNiLEAST16 __SCN16(i)
-#define SCNoLEAST16 __SCN16(o)
-#define SCNuLEAST16 __SCN16(u)
-#define SCNxLEAST16 __SCN16(x)
-
-
-#define PRIdFAST16 __PRI16(d)
-#define PRIiFAST16 __PRI16(i)
-#define PRIoFAST16 __PRI16(o)
-#define PRIuFAST16 __PRI16(u)
-#define PRIxFAST16 __PRI16(x)
-#define PRIXFAST16 __PRI16(X)
-
-#define SCNdFAST16 __SCN16(d)
-#define SCNiFAST16 __SCN16(i)
-#define SCNoFAST16 __SCN16(o)
-#define SCNuFAST16 __SCN16(u)
-#define SCNxFAST16 __SCN16(x)
-
-/* 32-bit types */
-#if __have_long32
-#define __PRI32(x) __STRINGIFY(l##x)
-#define __SCN32(x) __STRINGIFY(l##x)
-#else
-#define __PRI32(x) __STRINGIFY(x)
-#define __SCN32(x) __STRINGIFY(x)
-#endif
-
-#define PRId32 __PRI32(d)
-#define PRIi32 __PRI32(i)
-#define PRIo32 __PRI32(o)
-#define PRIu32 __PRI32(u)
-#define PRIx32 __PRI32(x)
-#define PRIX32 __PRI32(X)
-
-#define SCNd32 __SCN32(d)
-#define SCNi32 __SCN32(i)
-#define SCNo32 __SCN32(o)
-#define SCNu32 __SCN32(u)
-#define SCNx32 __SCN32(x)
-
-
-#define PRIdLEAST32 __PRI32(d)
-#define PRIiLEAST32 __PRI32(i)
-#define PRIoLEAST32 __PRI32(o)
-#define PRIuLEAST32 __PRI32(u)
-#define PRIxLEAST32 __PRI32(x)
-#define PRIXLEAST32 __PRI32(X)
-
-#define SCNdLEAST32 __SCN32(d)
-#define SCNiLEAST32 __SCN32(i)
-#define SCNoLEAST32 __SCN32(o)
-#define SCNuLEAST32 __SCN32(u)
-#define SCNxLEAST32 __SCN32(x)
-
-
-#define PRIdFAST32 __PRI32(d)
-#define PRIiFAST32 __PRI32(i)
-#define PRIoFAST32 __PRI32(o)
-#define PRIuFAST32 __PRI32(u)
-#define PRIxFAST32 __PRI32(x)
-#define PRIXFAST32 __PRI32(X)
-
-#define SCNdFAST32 __SCN32(d)
-#define SCNiFAST32 __SCN32(i)
-#define SCNoFAST32 __SCN32(o)
-#define SCNuFAST32 __SCN32(u)
-#define SCNxFAST32 __SCN32(x)
-
-
-/* 64-bit types */
-#if __have_longlong64
-#define __PRI64(x) __STRINGIFY(ll##x)
-#define __SCN64(x) __STRINGIFY(ll##x)
-#elif __have_long64
-#define __PRI64(x) __STRINGIFY(l##x)
-#define __SCN64(x) __STRINGIFY(l##x)
-#else
-#define __PRI64(x) __STRINGIFY(x)
-#define __SCN64(x) __STRINGIFY(x)
-#endif
-
-#define PRId64 __PRI64(d)
-#define PRIi64 __PRI64(i)
-#define PRIo64 __PRI64(o)
-#define PRIu64 __PRI64(u)
-#define PRIx64 __PRI64(x)
-#define PRIX64 __PRI64(X)
-
-#define SCNd64 __SCN64(d)
-#define SCNi64 __SCN64(i)
-#define SCNo64 __SCN64(o)
-#define SCNu64 __SCN64(u)
-#define SCNx64 __SCN64(x)
-
-#if __int64_t_defined
-#define PRIdLEAST64 __PRI64(d)
-#define PRIiLEAST64 __PRI64(i)
-#define PRIoLEAST64 __PRI64(o)
-#define PRIuLEAST64 __PRI64(u)
-#define PRIxLEAST64 __PRI64(x)
-#define PRIXLEAST64 __PRI64(X)
-
-#define SCNdLEAST64 __SCN64(d)
-#define SCNiLEAST64 __SCN64(i)
-#define SCNoLEAST64 __SCN64(o)
-#define SCNuLEAST64 __SCN64(u)
-#define SCNxLEAST64 __SCN64(x)
-
-
-#define PRIdFAST64 __PRI64(d)
-#define PRIiFAST64 __PRI64(i)
-#define PRIoFAST64 __PRI64(o)
-#define PRIuFAST64 __PRI64(u)
-#define PRIxFAST64 __PRI64(x)
-#define PRIXFAST64 __PRI64(X)
-
-#define SCNdFAST64 __SCN64(d)
-#define SCNiFAST64 __SCN64(i)
-#define SCNoFAST64 __SCN64(o)
-#define SCNuFAST64 __SCN64(u)
-#define SCNxFAST64 __SCN64(x)
-#endif
-
-/* max-bit types */
-#if __have_longlong64
-#define __PRIMAX(x) __STRINGIFY(ll##x)
-#define __SCNMAX(x) __STRINGIFY(ll##x)
-#elif __have_long64
-#define __PRIMAX(x) __STRINGIFY(l##x)
-#define __SCNMAX(x) __STRINGIFY(l##x)
-#else
-#define __PRIMAX(x) __STRINGIFY(x)
-#define __SCNMAX(x) __STRINGIFY(x)
-#endif
-
-#define PRIdMAX __PRIMAX(d)
-#define PRIiMAX __PRIMAX(i)
-#define PRIoMAX __PRIMAX(o)
-#define PRIuMAX __PRIMAX(u)
-#define PRIxMAX __PRIMAX(x)
-#define PRIXMAX __PRIMAX(X)
-
-#define SCNdMAX __SCNMAX(d)
-#define SCNiMAX __SCNMAX(i)
-#define SCNoMAX __SCNMAX(o)
-#define SCNuMAX __SCNMAX(u)
-#define SCNxMAX __SCNMAX(x)
-
-/* ptr types */
-#if __have_longlong64
-#define __PRIPTR(x) __STRINGIFY(ll##x)
-#define __SCNPTR(x) __STRINGIFY(ll##x)
-#elif __have_long64
-#define __PRIPTR(x) __STRINGIFY(l##x)
-#define __SCNPTR(x) __STRINGIFY(l##x)
-#else
-#define __PRIPTR(x) __STRINGIFY(x)
-#define __SCNPTR(x) __STRINGIFY(x)
-#endif
-
-#define PRIdPTR __PRIPTR(d)
-#define PRIiPTR __PRIPTR(i)
-#define PRIoPTR __PRIPTR(o)
-#define PRIuPTR __PRIPTR(u)
-#define PRIxPTR __PRIPTR(x)
-#define PRIXPTR __PRIPTR(X)
-
-#define SCNdPTR __SCNPTR(d)
-#define SCNiPTR __SCNPTR(i)
-#define SCNoPTR __SCNPTR(o)
-#define SCNuPTR __SCNPTR(u)
-#define SCNxPTR __SCNPTR(x)
-
-
-typedef struct {
- intmax_t quot;
- intmax_t rem;
-} imaxdiv_t;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern intmax_t imaxabs(intmax_t j);
-extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denomer);
-extern intmax_t strtoimax(const char *__restrict, char **__restrict, int);
-extern uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
-extern intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
-extern uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/newlib/libc/include/machine/ieeefp.h b/newlib/libc/include/machine/ieeefp.h
index dcd6cdf3a..1377e5af5 100644
--- a/newlib/libc/include/machine/ieeefp.h
+++ b/newlib/libc/include/machine/ieeefp.h
@@ -226,10 +226,6 @@
#define __IEEE_BIG_ENDIAN
#endif
-#ifdef __mt__
-#define __IEEE_BIG_ENDIAN
-#endif
-
#ifdef __frv__
#define __IEEE_BIG_ENDIAN
#endif
@@ -269,11 +265,6 @@
#endif /* __ARMEL__ */
#endif /* __MAVERICK__ */
-#ifdef __m32c__
-#define __IEEE_LITTLE_ENDIAN
-#define __SMALL_BITFIELDS
-#endif
-
#ifdef __CRIS__
#define __IEEE_LITTLE_ENDIAN
#endif
diff --git a/newlib/libc/include/machine/setjmp.h b/newlib/libc/include/machine/setjmp.h
index b74808f9c..fe05ee1ee 100644
--- a/newlib/libc/include/machine/setjmp.h
+++ b/newlib/libc/include/machine/setjmp.h
@@ -200,10 +200,6 @@ _BEGIN_STD_C
#define _JBTYPE unsigned long
#endif
-#ifdef __mt__
-#define _JBLEN 16
-#endif
-
#ifdef __xstormy16__
/* 4 GPRs plus SP plus PC. */
#define _JBLEN 8
@@ -213,15 +209,6 @@ _BEGIN_STD_C
#define _JBLEN 18
#endif
-#ifdef __m32c__
-#if defined(__r8c_cpu__) || defined(__m16c_cpu__)
-#define _JBLEN (22/2)
-#else
-#define _JBLEN (34/2)
-#endif
-#define _JBTYPE unsigned short
-#endif /* __m32c__ */
-
#ifdef _JBLEN
#ifdef _JBTYPE
typedef _JBTYPE jmp_buf[_JBLEN];
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index 41ce752b3..36766809e 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -1,3 +1,4 @@
+/* math.h -- Definitions for the math floating point package. */
#ifndef _MATH_H_
#define _MATH_H_
@@ -8,65 +9,25 @@
_BEGIN_STD_C
+#ifndef HUGE_VAL
+
+/* Define HUGE_VAL as infinity, unless HUGE_VAL is already defined
+ (which might have been done by something like math-68881.h). */
+
union __dmath
{
__ULong i[2];
double d;
};
-
-union __fmath
-{
- __ULong i[1];
- float f;
-};
-
-union __ldmath
-{
- __ULong i[4];
- _LONG_DOUBLE ld;
-};
-
-#if defined(__GNUC__) && \
- ( (__GNUC__ >= 4) || \
- ( (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 3) ) )
-
- /* gcc >= 3.3 implicitly defines builtins for HUGE_VALx values. */
-
- #ifndef HUGE_VAL
- #define HUGE_VAL (__builtin_huge_val())
- #endif
- #ifndef HUGE_VALF
- #define HUGE_VALF (__builtin_huge_valf())
- #endif
+/* Declare this as an array without bounds so that no matter what small data
+ support a port and/or library has, this reference will be via the general
+ method for accessing globals. */
+extern __IMPORT const union __dmath __infinity[];
- #ifndef HUGE_VALL
- #define HUGE_VALL (__builtin_huge_vall())
- #endif
+#define HUGE_VAL (__infinity[0].d)
-#else /* !gcc >= 3.3 */
-
- /* No builtins. Use floating-point unions instead. Declare as an array
- without bounds so no matter what small data support a port and/or
- library has, the reference will be via the general method for accessing
- globals. */
-
- #ifndef HUGE_VAL
- extern __IMPORT const union __dmath __infinity[];
- #define HUGE_VAL (__infinity[0].d)
- #endif
-
- #ifndef HUGE_VALF
- extern __IMPORT const union __fmath __infinityf[];
- #define HUGE_VALF (__infinityf[0].f)
- #endif
-
- #ifndef HUGE_VALL
- extern __IMPORT const union __ldmath __infinityld[];
- #define HUGE_VALL (__infinityld[0].ld)
- #endif
-
-#endif /* !gcc >= 3.3 */
+#endif /* ! defined (HUGE_VAL) */
/* Reentrant ANSI C functions. */
@@ -118,10 +79,6 @@ typedef double double_t;
#define FP_SUBNORMAL 3
#define FP_NORMAL 4
-extern int __isinff (float x);
-extern int __isinfd (double x);
-extern int __isnanf (float x);
-extern int __isnand (double x);
extern int __fpclassifyf (float x);
extern int __fpclassifyd (double x);
extern int __signbitf (float x);
@@ -134,19 +91,9 @@ extern int __signbitd (double x);
#define isfinite(y) \
(__extension__ ({__typeof__(y) __y = (y); \
fpclassify(__y) != FP_INFINITE && fpclassify(__y) != FP_NAN;}))
-
-/* Note: isinf and isnan were once functions in newlib that took double
- * arguments. C99 specifies that these names are reserved for macros
- * supporting multiple floating point types. Thus, they are
- * now defined as macros. Implementations of the old functions
- * taking double arguments still exist for compatibility purposes. */
-#define isinf(x) \
- (__extension__ ({__typeof__(x) __x = (x); \
- (sizeof (__x) == sizeof (float)) ? __isinff(__x) : __isinfd(__x);}))
-#define isnan(x) \
- (__extension__ ({__typeof__(x) __x = (x); \
- (sizeof (__x) == sizeof (float)) ? __isnanf(__x) : __isnand(__x);}))
-#define isnormal(y) (fpclassify(y) == FP_NORMAL)
+#define isnormal(z) \
+ (__extension__ ({__typeof__(z) __z = (z); \
+ fpclassify(__z) == FP_NORMAL;}))
#define signbit(x) \
(__extension__ ({__typeof__(x) __x = (x); \
(sizeof(__x) == sizeof(float)) ? __signbitf(__x) : __signbitd(__x);}))
@@ -175,6 +122,8 @@ extern int __signbitd (double x);
extern double infinity _PARAMS((void));
extern double nan _PARAMS((const char *));
+extern int isnan _PARAMS((double));
+extern int isinf _PARAMS((double));
extern int finite _PARAMS((double));
extern double copysign _PARAMS((double, double));
extern int ilogb _PARAMS((double));
diff --git a/newlib/libc/include/stdint.h b/newlib/libc/include/stdint.h
deleted file mode 100644
index 328b094c9..000000000
--- a/newlib/libc/include/stdint.h
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Copyright (c) 2004, 2005 by
- * Ralf Corsepius, Ulm/Germany. All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * is freely granted, provided that this notice is preserved.
- */
-
-/*
- * @todo - Add support for wint_t types.
- */
-
-#ifndef _STDINT_H
-#define _STDINT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(__GNUC__) && \
- ( (__GNUC__ >= 4) || \
- ( (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 2) ) )
-/* gcc > 3.2 implicitly defines the values we are interested */
-#define __STDINT_EXP(x) __##x##__
-#else
-#define __STDINT_EXP(x) x
-#include <limits.h>
-#endif
-
-/* Check if "long long" is 64bit wide */
-/* Modern GCCs provide __LONG_LONG_MAX__, SUSv3 wants LLONG_MAX */
-#if ( defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff) ) \
- || ( defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff) )
-#define __have_longlong64 1
-#endif
-
-/* Check if "long" is 64bit or 32bit wide */
-#if __STDINT_EXP(LONG_MAX) > 0x7fffffff
-#define __have_long64 1
-#elif __STDINT_EXP(LONG_MAX) == 0x7fffffff
-#define __have_long32 1
-#endif
-
-#if __STDINT_EXP(SCHAR_MAX) == 0x7f
-typedef signed char int8_t ;
-typedef unsigned char uint8_t ;
-#define __int8_t_defined 1
-#endif
-
-#if __int8_t_defined
-typedef signed char int_least8_t;
-typedef unsigned char uint_least8_t;
-#define __int_least8_t_defined 1
-#endif
-
-#if __STDINT_EXP(SHRT_MAX) == 0x7fff
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-#define __int16_t_defined 1
-#elif __STDINT_EXP(INT_MAX) == 0x7fff
-typedef signed int int16_t;
-typedef unsigned int uint16_t;
-#define __int16_t_defined 1
-#elif __STDINT_EXP(SCHAR_MAX) == 0x7fff
-typedef signed char int16_t;
-typedef unsigned char uint16_t;
-#define __int16_t_defined 1
-#endif
-
-#if __int16_t_defined
-typedef int16_t int_least16_t;
-typedef uint16_t uint_least16_t;
-#define __int_least16_t_defined 1
-
-#if !__int_least8_t_defined
-typedef int16_t int_least8_t;
-typedef uint16_t uint_least8_t;
-#define __int_least8_t_defined 1
-#endif
-#endif
-
-#if __have_long32
-typedef signed long int32_t;
-typedef unsigned long uint32_t;
-#define __int32_t_defined 1
-#elif __STDINT_EXP(INT_MAX) == 0x7fffffffL
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-#define __int32_t_defined 1
-#elif __STDINT_EXP(SHRT_MAX) == 0x7fffffffL
-typedef signed short int32_t;
-typedef unsigned short uint32_t;
-#define __int32_t_defined 1
-#elif __STDINT_EXP(SCHAR_MAX) == 0x7fffffffL
-typedef signed char int32_t;
-typedef unsigned char uint32_t;
-#define __int32_t_defined 1
-#endif
-
-#if __int32_t_defined
-typedef int32_t int_least32_t;
-typedef uint32_t uint_least32_t;
-#define __int_least32_t_defined 1
-
-#if !__int_least8_t_defined
-typedef int32_t int_least8_t;
-typedef uint32_t uint_least8_t;
-#define __int_least8_t_defined 1
-#endif
-
-#if !__int_least16_t_defined
-typedef int32_t int_least16_t;
-typedef uint32_t uint_least16_t;
-#define __int_least16_t_defined 1
-#endif
-#endif
-
-#if __have_long64
-typedef signed long int64_t;
-typedef unsigned long uint64_t;
-#define __int64_t_defined 1
-#elif __have_longlong64
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-#define __int64_t_defined 1
-#elif __STDINT_EXP(INT_MAX) > 0x7fffffff
-typedef signed int int64_t;
-typedef unsigned int uint64_t;
-#define __int64_t_defined 1
-#endif
-
-#if __int64_t_defined
-typedef int64_t int_least64_t;
-typedef uint64_t uint_least64_t;
-#define __int_least64_t_defined 1
-
-#if !__int_least8_t_defined
-typedef int64_t int_least8_t;
-typedef uint64_t uint_least8_t;
-#define __int_least8_t_defined 1
-#endif
-
-#if !__int_least16_t_defined
-typedef int64_t int_least16_t;
-typedef uint64_t uint_least16_t;
-#define __int_least16_t_defined 1
-#endif
-
-#if !__int_least32_t_defined
-typedef int64_t int_least32_t;
-typedef uint64_t uint_least32_t;
-#define __int_least32_t_defined 1
-#endif
-#endif
-
-/*
- * Fastest minimum-width integer types
- *
- * Assume int to be the fastest type for all types with a width
- * less than __INT_MAX__ rsp. INT_MAX
- */
-#if __STDINT_EXP(INT_MAX) >= 0x7f
- typedef signed int int_fast8_t;
- typedef unsigned int uint_fast8_t;
-#define __int_fast8_t_defined 1
-#endif
-
-#if __STDINT_EXP(INT_MAX) >= 0x7fff
- typedef signed int int_fast16_t;
- typedef unsigned int uint_fast16_t;
-#define __int_fast16_t_defined 1
-#endif
-
-#if __STDINT_EXP(INT_MAX) >= 0x7fffffff
- typedef signed int int_fast32_t;
- typedef unsigned int uint_fast32_t;
-#define __int_fast32_t_defined 1
-#endif
-
-#if __STDINT_EXP(INT_MAX) > 0x7fffffff
- typedef signed int int_fast64_t;
- typedef unsigned int uint_fast64_t;
-#define __int_fast64_t_defined 1
-#endif
-
-/*
- * Fall back to [u]int_least<N>_t for [u]int_fast<N>_t types
- * not having been defined, yet.
- * Leave undefined, if [u]int_least<N>_t should not be available.
- */
-#if !__int_fast8_t_defined
-#if __int_least8_t_defined
- typedef int_least8_t int_fast8_t;
- typedef uint_least8_t uint_fast8_t;
-#define __int_fast8_t_defined 1
-#endif
-#endif
-
-#if !__int_fast16_t_defined
-#if __int_least16_t_defined
- typedef int_least16_t int_fast16_t;
- typedef uint_least16_t uint_fast16_t;
-#define __int_fast16_t_defined 1
-#endif
-#endif
-
-#if !__int_fast32_t_defined
-#if __int_least32_t_defined
- typedef int_least32_t int_fast32_t;
- typedef uint_least32_t uint_fast32_t;
-#define __int_fast32_t_defined 1
-#endif
-#endif
-
-#if !__int_fast64_t_defined
-#if __int_least64_t_defined
- typedef int_least64_t int_fast64_t;
- typedef uint_least64_t uint_fast64_t;
-#define __int_fast64_t_defined 1
-#endif
-#endif
-
-/* Greatest-width integer types */
-/* Modern GCCs provide __INTMAX_TYPE__ */
-#if defined(__INTMAX_TYPE__)
- typedef __INTMAX_TYPE__ intmax_t;
-#elif __have_longlong64
- typedef signed long long intmax_t;
-#else
- typedef signed long intmax_t;
-#endif
-
-/* Modern GCCs provide __UINTMAX_TYPE__ */
-#if defined(__UINTMAX_TYPE__)
- typedef __UINTMAX_TYPE__ uintmax_t;
-#elif __have_longlong64
- typedef unsigned long long uintmax_t;
-#else
- typedef unsigned long uintmax_t;
-#endif
-
-/*
- * GCC doesn't provide an appropriate macro for [u]intptr_t
- * For now, use __PTRDIFF_TYPE__
- */
-#if defined(__PTRDIFF_TYPE__)
-typedef signed __PTRDIFF_TYPE__ intptr_t;
-typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
-#else
-/*
- * Fallback to hardcoded values,
- * should be valid on cpu's with 32bit int/32bit void*
- */
-typedef signed long intptr_t;
-typedef unsigned long uintptr_t;
-#endif
-
-/* Limits of Specified-Width Integer Types */
-
-#if __int8_t_defined
-#define INT8_MIN -128
-#define INT8_MAX 127
-#define UINT8_MAX 255
-#endif
-
-#if __int_least8_t_defined
-#define INT_LEAST8_MIN -128
-#define INT_LEAST8_MAX 127
-#define UINT_LEAST8_MAX 255
-#else
-#error required type int_least8_t missing
-#endif
-
-#if __int16_t_defined
-#define INT16_MIN -32768
-#define INT16_MAX 32767
-#define UINT16_MAX 65535
-#endif
-
-#if __int_least16_t_defined
-#define INT_LEAST16_MIN -32768
-#define INT_LEAST16_MAX 32767
-#define UINT_LEAST16_MAX 65535
-#else
-#error required type int_least16_t missing
-#endif
-
-#if __int32_t_defined
-#define INT32_MIN (-2147483647-1)
-#define INT32_MAX 2147483647
-#define UINT32_MAX 4294967295U
-#endif
-
-#if __int_least32_t_defined
-#define INT_LEAST32_MIN (-2147483647-1)
-#define INT_LEAST32_MAX 2147483647
-#define UINT_LEAST32_MAX 4294967295U
-#else
-#error required type int_least32_t missing
-#endif
-
-#if __int64_t_defined
-#if __have_long64
-#define INT64_MIN (-9223372036854775807L-1L)
-#define INT64_MAX 9223372036854775807L
-#define UINT64_MAX 18446744073709551615U
-#elif __have_longlong64
-#define INT64_MIN (-9223372036854775807LL-1LL)
-#define INT64_MAX 9223372036854775807LL
-#define UINT64_MAX 18446744073709551615ULL
-#endif
-#endif
-
-#if __int_least64_t_defined
-#if __have_long64
-#define INT_LEAST64_MIN (-9223372036854775807L-1L)
-#define INT_LEAST64_MAX 9223372036854775807L
-#define UINT_LEAST64_MAX 18446744073709551615U
-#elif __have_longlong64
-#define INT_LEAST64_MIN (-9223372036854775807LL-1LL)
-#define INT_LEAST64_MAX 9223372036854775807LL
-#define UINT_LEAST64_MAX 18446744073709551615ULL
-#endif
-#endif
-
-#if __int_fast8_t_defined
-#define INT_FAST8_MIN INT8_MIN
-#define INT_FAST8_MAX INT8_MAX
-#define UINT_FAST8_MAX UINT8_MAX
-#endif
-
-#if __int_fast16_t_defined
-#define INT_FAST16_MIN INT16_MIN
-#define INT_FAST16_MAX INT16_MAX
-#define UINT_FAST16_MAX UINT16_MAX
-#endif
-
-#if __int_fast32_t_defined
-#define INT_FAST32_MIN INT32_MIN
-#define INT_FAST32_MAX INT32_MAX
-#define UINT_FAST32_MAX UINT32_MAX
-#endif
-
-#if __int_fast64_t_defined
-#define INT_FAST64_MIN INT64_MIN
-#define INT_FAST64_MAX INT64_MAX
-#define UINT_FAST64_MAX UINT64_MAX
-#endif
-
-/* This must match size_t in stddef.h, currently long unsigned int */
-#define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L)
-#define SIZE_MAX __STDINT_EXP(LONG_MAX)
-
-/* This must match sig_atomic_t in <signal.h> (currently int) */
-#define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
-#define SIG_ATOMIC_MAX __STDINT_EXP(INT_MAX)
-
-/* This must match ptrdiff_t in <stddef.h> (currently long int) */
-#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)
-#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)
-
-/** Macros for minimum-width integer constant expressions */
-#define INT8_C(x) x
-#define UINT8_C(x) x##U
-
-#define INT16_C(x) x
-#define UINT16_C(x) x##U
-
-#if __have_long32
-#define INT32_C(x) x##L
-#define UINT32_C(x) x##UL
-#else
-#define INT32_C(x) x
-#define UINT32_C(x) x##U
-#endif
-
-#if __int64_t_defined
-#if __have_longlong64
-#define INT64_C(x) x##LL
-#define UINT64_C(x) x##ULL
-#else
-#define INT64_C(x) x##L
-#define UINT64_C(x) x##UL
-#endif
-#endif
-
-/** Macros for greatest-width integer constant expression */
-#if __have_longlong64
-#define INTMAX_C(x) x##LL
-#define UINTMAX_C(x) x##ULL
-#else
-#define INTMAX_C(x) x##L
-#define UINTMAX_C(x) x##UL
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _STDINT_H */
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index ef8c2db18..b70772ab0 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -229,7 +229,6 @@ off_t _EXFUN(ftello, ( FILE *));
#ifndef _REENT_ONLY
int _EXFUN(asiprintf, (char **, const char *, ...));
int _EXFUN(asprintf, (char **, const char *, ...));
-int _EXFUN(dprintf, (int, const char *, ...));
int _EXFUN(fcloseall, (_VOID));
int _EXFUN(fiprintf, (FILE *, const char *, ...));
int _EXFUN(iprintf, (const char *, ...));
@@ -239,13 +238,11 @@ int _EXFUN(sniprintf, (char *, size_t, const char *, ...));
char * _EXFUN(tempnam, (const char *, const char *));
int _EXFUN(vasiprintf, (char **, const char *, __VALIST));
int _EXFUN(vasprintf, (char **, const char *, __VALIST));
-int _EXFUN(vdprintf, (int, const char *, __VALIST));
int _EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST));
int _EXFUN(vsnprintf, (char *, size_t, const char *, __VALIST));
int _EXFUN(vfiprintf, (FILE *, const char *, __VALIST));
int _EXFUN(vfiscanf, (FILE *, const char *, __VALIST));
int _EXFUN(vfscanf, (FILE *, const char *, __VALIST));
-int _EXFUN(viprintf, (const char *, __VALIST));
int _EXFUN(viscanf, (const char *, __VALIST));
int _EXFUN(vscanf, (const char *, __VALIST));
int _EXFUN(vsiscanf, (const char *, const char *, __VALIST));
@@ -283,7 +280,6 @@ int _EXFUN(putchar_unlocked, (int));
int _EXFUN(_asiprintf_r, (struct _reent *, char **, const char *, ...));
int _EXFUN(_asprintf_r, (struct _reent *, char **, const char *, ...));
-int _EXFUN(_dprintf_r, (struct _reent *, int, const char *, ...));
int _EXFUN(_fcloseall_r, (struct _reent *));
FILE * _EXFUN(_fdopen_r, (struct _reent *, int, const char *));
FILE * _EXFUN(_fopen_r, (struct _reent *, const char *, const char *));
@@ -318,7 +314,6 @@ char * _EXFUN(_tmpnam_r, (struct _reent *, char *));
int _EXFUN(_ungetc_r, (struct _reent *, int, FILE *));
int _EXFUN(_vasiprintf_r, (struct _reent *, char **, const char *, __VALIST));
int _EXFUN(_vasprintf_r, (struct _reent *, char **, const char *, __VALIST));
-int _EXFUN(_vdprintf_r, (struct _reent *, int, const char *, __VALIST));
int _EXFUN(_vfiprintf_r, (struct _reent *, FILE *, const char *, __VALIST));
int _EXFUN(_vfprintf_r, (struct _reent *, FILE *, const char *, __VALIST));
int _EXFUN(_viprintf_r, (struct _reent *, const char *, __VALIST));
diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
index 9bee3b187..e75558d27 100644
--- a/newlib/libc/include/stdlib.h
+++ b/newlib/libc/include/stdlib.h
@@ -19,10 +19,6 @@
#include <alloca.h>
#endif
-#ifdef __CYGWIN__
-#include <cygwin/stdlib.h>
-#endif
-
_BEGIN_STD_C
typedef struct
@@ -80,6 +76,9 @@ _VOID _EXFUN(exit,(int __status) _ATTRIBUTE ((noreturn)));
_VOID _EXFUN(free,(_PTR));
char * _EXFUN(getenv,(const char *__string));
char * _EXFUN(_getenv_r,(struct _reent *, const char *__string));
+#ifdef __CYGWIN__
+const char *_EXFUN(getprogname,(void));
+#endif
char * _EXFUN(_findenv,(_CONST char *, int *));
char * _EXFUN(_findenv_r,(struct _reent *, _CONST char *, int *));
long _EXFUN(labs,(long));
@@ -104,6 +103,9 @@ char * _EXFUN(mktemp,(char *));
_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR)));
int _EXFUN(rand,(_VOID));
_PTR _EXFUN(realloc,(_PTR __r, size_t __size));
+#ifdef __CYGWIN__
+void _EXFUN(setprogname,(const char *));
+#endif
_VOID _EXFUN(srand,(unsigned __seed));
double _EXFUN(strtod,(const char *__n, char **__end_PTR));
double _EXFUN(_strtod_r,(struct _reent *,const char *__n, char **__end_PTR));
@@ -174,8 +176,15 @@ unsigned long long _EXFUN(_strtoull_r,(struct _reent *, const char *__n, char **
#ifndef __CYGWIN__
_VOID _EXFUN(cfree,(_PTR));
+#else
+char * _EXFUN(realpath,(const char *, char *));
void _EXFUN(unsetenv,(const char *__string));
void _EXFUN(_unsetenv_r,(struct _reent *, const char *__string));
+int _EXFUN(random,(_VOID));
+long _EXFUN(srandom,(unsigned __seed));
+char * _EXFUN(ptsname, (int));
+int _EXFUN(grantpt, (int));
+int _EXFUN(unlockpt,(int));
#endif
#endif /* ! __STRICT_ANSI__ */
@@ -192,6 +201,35 @@ int _EXFUN(_system_r,(struct _reent *, const char *));
_VOID _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *));
+#ifdef __CYGWIN__
+#undef _malloc_r
+#define _malloc_r(r, s) malloc (s)
+#undef _free_r
+#define _free_r(r, p) free (p)
+#undef _realloc_r
+#define _realloc_r(r, p, s) realloc (p, s)
+#undef _calloc_r
+#define _calloc_r(r, s1, s2) calloc (s1, s2);
+#undef _memalign_r
+#define _memalign_r(r, s1, s2) memalign (s1, s2);
+#undef _mallinfo_r
+#define _mallinfo_r(r) mallinfo ()
+#undef _malloc_stats_r
+#define _malloc_stats_r(r) malloc_stats ()
+#undef _mallopt_r
+#define _mallopt_r(i1, i2) mallopt (i1, i2)
+#undef _malloc_usable_size_r
+#define _malloc_usable_size_r(r, p) malloc_usable_size (p)
+#undef _valloc_r
+#define _valloc_r(r, s) valloc (s)
+#undef _pvalloc_r
+#define _pvalloc_r(r, s) pvalloc (s)
+#undef _malloc_trim_r
+#define _malloc_trim_r(r, s) malloc_trim (s)
+#undef _mstats_r
+#define _mstats_r(r, p) mstats (p)
+#endif
+
_END_STD_C
#endif /* _STDLIB_H_ */
diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h
index 55a86b374..30756b7ca 100644
--- a/newlib/libc/include/string.h
+++ b/newlib/libc/include/string.h
@@ -56,9 +56,6 @@ int _EXFUN(ffs,(int));
char *_EXFUN(index,(const char *, int));
_PTR _EXFUN(memccpy,(_PTR, const _PTR, int, size_t));
_PTR _EXFUN(mempcpy,(_PTR, const _PTR, size_t));
-#ifdef __CYGWIN__
-extern void *memmem (__const void *, size_t, __const void *, size_t);
-#endif
char *_EXFUN(rindex,(const char *, int));
int _EXFUN(strcasecmp,(const char *, const char *));
char *_EXFUN(strdup,(const char *));
diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h
index c4e4dba9a..1dd045498 100644
--- a/newlib/libc/include/sys/config.h
+++ b/newlib/libc/include/sys/config.h
@@ -59,7 +59,7 @@
/* in other words, go32 */
#define _FLOAT_RET double
#endif
-#if defined(__linux__) || defined(__RDOS__)
+#ifdef __linux__
/* we want the reentrancy structure to be returned by a function */
#define __DYNAMIC_REENT__
#define HAVE_GETDATE
@@ -105,22 +105,6 @@
#define __BUFSIZ__ 16
#define _REENT_SMALL
#endif
-#ifdef __m32c__
-#define __SMALL_BITFIELDS
-#undef INT_MAX
-#undef UINT_MAX
-#define INT_MAX __INT_MAX__
-#define UINT_MAX (__INT_MAX__ * 2U + 1)
-#define MALLOC_ALIGNMENT 8
-#if defined(__r8c_cpu__) || defined(__m16c_cpu__)
-#define _POINTER_INT short
-#else
-#define _POINTER_INT long
-#endif
-#define __BUFSIZ__ 16
-#define _REENT_SMALL
-#endif /* __m32c__ */
-
/* This block should be kept in sync with GCC's limits.h. The point
of having these definitions here is to not include limits.h, which
diff --git a/newlib/libc/include/sys/dirent.h b/newlib/libc/include/sys/dirent.h
index a3fb5c02c..f2f2342d5 100644
--- a/newlib/libc/include/sys/dirent.h
+++ b/newlib/libc/include/sys/dirent.h
@@ -1,13 +1,15 @@
/* <dirent.h> includes <sys/dirent.h>, which is this file. On a
system which supports <dirent.h>, this file is overridden by
dirent.h in the libc/sys/.../sys directory. On a system which does
- not support <dirent.h>, we will get this file which uses #error to force
- an error. */
+ not support <dirent.h>, we will get this file which tries to find
+ any other <dirent.h> which may be lurking around. If there isn't
+ one, the user will get an error indicating that there is no
+ <dirent.h>. */
#ifdef __cplusplus
extern "C" {
#endif
-#error "<dirent.h> not supported"
+#include_next <dirent.h>
#ifdef __cplusplus
}
#endif
diff --git a/newlib/libc/include/sys/fcntl.h b/newlib/libc/include/sys/fcntl.h
index fd8917d1e..0a680a1da 100644
--- a/newlib/libc/include/sys/fcntl.h
+++ b/newlib/libc/include/sys/fcntl.h
@@ -37,9 +37,9 @@ extern "C" {
#define O_CREAT _FCREAT
#define O_TRUNC _FTRUNC
#define O_EXCL _FEXCL
-#define O_SYNC _FSYNC
+/* O_SYNC _FSYNC not posix, defined below */
/* O_NDELAY _FNDELAY set in include/fcntl.h */
-/* O_NDELAY _FNBIO set in include/fcntl.h */
+/* O_NDELAY _FNBIO set in 5include/fcntl.h */
#define O_NONBLOCK _FNONBLOCK
#define O_NOCTTY _FNOCTTY
/* For machines which care - */
@@ -68,6 +68,8 @@ extern "C" {
#ifndef _POSIX_SOURCE
+#define O_SYNC _FSYNC
+
/*
* Flags that work for fcntl(fd, F_SETFL, FXXXX)
*/
diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h
index 6754f1e9d..af31ce670 100644
--- a/newlib/libc/include/sys/features.h
+++ b/newlib/libc/include/sys/features.h
@@ -88,7 +88,6 @@ extern "C" {
# define _POSIX_THREAD_ATTR_STACKSIZE 1
# define _POSIX_SEMAPHORES 1
# define _POSIX_TIMERS 1
-# define _POSIX_MEMLOCK_RANGE 1
#endif
#ifdef __cplusplus
diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h
index df3164941..4771f5798 100644
--- a/newlib/libc/include/sys/time.h
+++ b/newlib/libc/include/sys/time.h
@@ -14,8 +14,8 @@ extern "C" {
#ifndef _WINSOCK_H
struct timeval {
- time_t tv_sec;
- suseconds_t tv_usec;
+ long tv_sec;
+ long tv_usec;
};
struct timezone {
@@ -24,7 +24,7 @@ struct timezone {
};
#ifdef __CYGWIN__
-#include <cygwin/sys_time.h>
+#include <sys/select.h>
#endif /* __CYGWIN__ */
#endif /* _WINSOCK_H */
diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h
index bf08616ab..5c288bfc0 100644
--- a/newlib/libc/include/sys/types.h
+++ b/newlib/libc/include/sys/types.h
@@ -251,6 +251,11 @@ typedef struct _types_fd_set {
#undef __MS_types__
#undef _ST_INT32
+/* The following are actually standard POSIX 1003.1b-1993 threads, mutexes,
+ condition variables, and keys. But since RTEMS is currently the only
+ newlib user of these, the ifdef is just on RTEMS. */
+
+#if defined(__rtems__) || defined(__CYGWIN__)
#ifndef __clockid_t_defined
typedef _CLOCKID_T_ clockid_t;
@@ -262,8 +267,9 @@ typedef _TIMER_T_ timer_t;
#define __timer_t_defined
#endif
-typedef unsigned long useconds_t;
-typedef long suseconds_t;
+#if defined(__CYGWIN__) || defined(__rtems__)
+typedef long useconds_t;
+#endif
#include <sys/features.h>
@@ -374,6 +380,8 @@ typedef struct {
#endif
#endif /* defined(_POSIX_THREADS) */
+#endif /* defined(__rtems__) */
+
#endif /* !__need_inttypes */
#undef __need_inttypes
diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h
index a670dd735..e9215e24d 100644
--- a/newlib/libc/include/sys/unistd.h
+++ b/newlib/libc/include/sys/unistd.h
@@ -211,9 +211,9 @@ void _EXFUN(sync, (void));
#else /* defined(__rtems__) */
int _EXFUN(sync, (void));
#endif
-#endif
int _EXFUN(readlink, (const char *__path, char *__buf, int __buflen));
int _EXFUN(symlink, (const char *__name1, const char *__name2));
+#endif
#define F_OK 0
#define R_OK 4
diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h
index 8d3a30c8a..0ef5e958e 100644
--- a/newlib/libc/include/time.h
+++ b/newlib/libc/include/time.h
@@ -123,6 +123,20 @@ extern __IMPORT char *_tzname[2];
#ifndef tzname
#define tzname _tzname
#endif
+
+/* CYGWIN also exposes daylight and timezone in the name space */
+#ifdef __CYGWIN__
+#ifndef daylight
+#define daylight _daylight
+#endif
+#ifdef timezonevar
+#ifndef timezone
+#define timezone _timezone
+#endif
+#else
+char *_EXFUN(timezone, (void));
+#endif
+#endif /* __CYGWIN__ */
#endif /* !__STRICT_ANSI__ */
#ifdef __cplusplus
@@ -131,10 +145,6 @@ extern __IMPORT char *_tzname[2];
#include <sys/features.h>
-#ifdef __CYGWIN__
-#include <cygwin/time.h>
-#endif /*__CYGWIN__*/
-
#if defined(_POSIX_TIMERS)
#include <signal.h>
@@ -173,6 +183,16 @@ int _EXFUN(nanosleep, (const struct timespec *rqtp, struct timespec *rmtp));
#ifdef __cplusplus
}
#endif
+#else
+#ifdef __CYGWIN__
+#ifdef __cplusplus
+extern "C" {
+#endif
+int _EXFUN(nanosleep, (const struct timespec *rqtp, struct timespec *rmtp));
+#ifdef __cplusplus
+}
+#endif
+#endif /* __CYGWIN__ */
#endif /* _POSIX_TIMERS */
#ifdef __cplusplus
@@ -203,6 +223,10 @@ extern "C" {
associated with a time. */
#define TIMER_ABSTIME 4
+#ifdef __CYGWIN__
+# define TIMER_RELTIME 0 /* For compatibility with HP/UX, Solaris,
+ others? */
+#endif
/* Manifest Constants, P1003.4b/D8, p. 55 */