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/_ansi.h6
-rw-r--r--newlib/libc/include/_syslist.h1
-rw-r--r--newlib/libc/include/assert.h8
-rw-r--r--newlib/libc/include/ctype.h28
-rw-r--r--newlib/libc/include/getopt.h102
-rw-r--r--newlib/libc/include/machine/_default_types.h4
-rw-r--r--newlib/libc/include/machine/ieeefp.h2
-rw-r--r--newlib/libc/include/machine/setjmp.h25
-rw-r--r--newlib/libc/include/math.h6
-rw-r--r--newlib/libc/include/reent.h87
-rw-r--r--newlib/libc/include/stdint.h3
-rw-r--r--newlib/libc/include/stdio.h5
-rw-r--r--newlib/libc/include/string.h6
-rw-r--r--newlib/libc/include/sys/_default_fcntl.h17
-rw-r--r--newlib/libc/include/sys/reent.h198
-rw-r--r--newlib/libc/include/sys/stat.h15
-rw-r--r--newlib/libc/include/sys/unistd.h17
17 files changed, 160 insertions, 370 deletions
diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h
index a3f0334e3..b84f37791 100644
--- a/newlib/libc/include/_ansi.h
+++ b/newlib/libc/include/_ansi.h
@@ -45,8 +45,8 @@
#ifndef _LONG_DOUBLE
#define _LONG_DOUBLE long double
#endif
-#ifndef _LONG_LONG_TYPE
-#define _LONG_LONG_TYPE long long
+#ifndef _LONG_LONG
+#define _LONG_LONG long long
#endif
#ifndef _PARAMS
#define _PARAMS(paramlist) paramlist
@@ -65,7 +65,7 @@
#define _DEFUN_VOID(name) name()
#define _CAST_VOID
#define _LONG_DOUBLE double
-#define _LONG_LONG_TYPE long
+#define _LONG_LONG long
#ifndef _PARAMS
#define _PARAMS(paramlist) ()
#endif
diff --git a/newlib/libc/include/_syslist.h b/newlib/libc/include/_syslist.h
index 09da79336..0bf76e108 100644
--- a/newlib/libc/include/_syslist.h
+++ b/newlib/libc/include/_syslist.h
@@ -11,7 +11,6 @@
#define _fstat fstat
#define _getpid getpid
#define _gettimeofday gettimeofday
-#define _isatty isatty
#define _kill kill
#define _link link
#define _lseek lseek
diff --git a/newlib/libc/include/assert.h b/newlib/libc/include/assert.h
index e542b214f..ed14928ba 100644
--- a/newlib/libc/include/assert.h
+++ b/newlib/libc/include/assert.h
@@ -21,14 +21,10 @@ extern "C" {
# if defined __cplusplus && defined __GNUC__
# define __ASSERT_FUNC __PRETTY_FUNCTION__
- /* C99 requires the use of __func__. */
-# elif __STDC_VERSION__ >= 199901L
+ /* C99 requires the use of __func__, gcc also supports it. */
+# elif defined __GNUC__ || __STDC_VERSION__ >= 199901L
# define __ASSERT_FUNC __func__
- /* Older versions of gcc don't have __func__ but can use __FUNCTION__. */
-# elif __GNUC__ >= 2
-# define __ASSERT_FUNC __FUNCTION__
-
/* failed to detect __func__ support. */
# else
# define __ASSERT_FUNC ((char *) 0)
diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h
index 17a486ebb..c1ace5077 100644
--- a/newlib/libc/include/ctype.h
+++ b/newlib/libc/include/ctype.h
@@ -36,20 +36,21 @@ int _EXFUN(_toupper, (int __c));
#define _X 0100
#define _B 0200
-extern __IMPORT _CONST char *__ctype_ptr__;
+extern __IMPORT _CONST char *__ctype_ptr;
+extern __IMPORT _CONST char _ctype_[]; /* For backward compatibility. */
#ifndef __cplusplus
-#define isalpha(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_U|_L))
-#define isupper(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_U)
-#define islower(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_L)
-#define isdigit(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_N)
-#define isxdigit(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_X|_N))
-#define isspace(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_S)
-#define ispunct(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_P)
-#define isalnum(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_U|_L|_N))
-#define isprint(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_P|_U|_L|_N|_B))
-#define isgraph(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_P|_U|_L|_N))
-#define iscntrl(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_C)
+#define isalpha(c) ((__ctype_ptr)[(unsigned)(c)]&(_U|_L))
+#define isupper(c) ((__ctype_ptr)[(unsigned)(c)]&_U)
+#define islower(c) ((__ctype_ptr)[(unsigned)(c)]&_L)
+#define isdigit(c) ((__ctype_ptr)[(unsigned)(c)]&_N)
+#define isxdigit(c) ((__ctype_ptr)[(unsigned)(c)]&(_X|_N))
+#define isspace(c) ((__ctype_ptr)[(unsigned)(c)]&_S)
+#define ispunct(c) ((__ctype_ptr)[(unsigned)(c)]&_P)
+#define isalnum(c) ((__ctype_ptr)[(unsigned)(c)]&(_U|_L|_N))
+#define isprint(c) ((__ctype_ptr)[(unsigned)(c)]&(_P|_U|_L|_N|_B))
+#define isgraph(c) ((__ctype_ptr)[(unsigned)(c)]&(_P|_U|_L|_N))
+#define iscntrl(c) ((__ctype_ptr)[(unsigned)(c)]&_C)
/* Non-gcc versions will get the library versions, and will be
@@ -67,9 +68,6 @@ extern __IMPORT _CONST char *__ctype_ptr__;
#define toascii(c) ((c)&0177)
#endif
-/* For C++ backward-compatibility only. */
-extern __IMPORT _CONST char _ctype_[];
-
_END_STD_C
#endif /* _CTYPE_H_ */
diff --git a/newlib/libc/include/getopt.h b/newlib/libc/include/getopt.h
index 13cf99c5f..7179298ae 100644
--- a/newlib/libc/include/getopt.h
+++ b/newlib/libc/include/getopt.h
@@ -82,8 +82,6 @@ Gregory Pietsch's current e-mail address:
gpietsch@comcast.net
****************************************************************************/
-/* This is a glibc-extension header file. */
-
#ifndef GETOPT_H
#define GETOPT_H
@@ -91,60 +89,31 @@ gpietsch@comcast.net
/* include files needed by this include file */
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
+/* 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 /* __cplusplus */
-
-/* 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. */
-
- };
-
-/* While getopt.h is a glibc extension, the following are newlib extensions.
- * They are optionally included via the __need_getopt_newlib flag. */
-
-#ifdef __need_getopt_newlib
-
- /* macros defined by this include file */
- #define NO_ARG no_argument
- #define REQUIRED_ARG required_argument
- #define OPTIONAL_ARG optional_argument
-
- /* The GETOPT_DATA_INITIALIZER macro is used to initialize a statically-
- allocated variable of type struct getopt_data. */
- #define GETOPT_DATA_INITIALIZER {0,0,0,0,0}
-
- /* These #defines are to make accessing the reentrant functions easier. */
- #define getopt_r __getopt_r
- #define getopt_long_r __getopt_long_r
- #define getopt_long_only_r __getopt_long_only_r
-
- /* The getopt_data structure is for reentrancy. Its members are similar to
- the externally-defined variables. */
- typedef struct getopt_data
- {
- char *optarg;
- int optind, opterr, optopt, optwhere;
- } getopt_data;
-
-#endif /* __need_getopt_newlib */
+#endif
/* externally-defined variables */
extern char *optarg;
@@ -153,35 +122,14 @@ extern "C"
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));
-
- int _EXFUN (__getopt_r,
- (int __argc, char *const __argv[], const char *__optstring,
- struct getopt_data * __data));
-
- int _EXFUN (__getopt_long_r,
- (int __argc, char *const __argv[], const char *__shortopts,
- const struct option * __longopts, int *__longind,
- struct getopt_data * __data));
-
- int _EXFUN (__getopt_long_only_r,
- (int __argc, char *const __argv[], const char *__shortopts,
- const struct option * __longopts, int *__longind,
- struct getopt_data * __data));
+ 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 /* __cplusplus */
+#endif
#endif /* GETOPT_H */
diff --git a/newlib/libc/include/machine/_default_types.h b/newlib/libc/include/machine/_default_types.h
index e79f99399..a20abce84 100644
--- a/newlib/libc/include/machine/_default_types.h
+++ b/newlib/libc/include/machine/_default_types.h
@@ -12,8 +12,8 @@ extern "C" {
/*
* Guess on types by examining *_MIN / *_MAX defines.
*/
-#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ >= 3 ) \
- && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 2 ))
+#if defined(__GNUC__) && (__GNUC__ >= 3 ) \
+ && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 2 )
/* GCC >= 3.3.0 has __<val>__ implicitly defined. */
#define __EXP(x) __##x##__
#else
diff --git a/newlib/libc/include/machine/ieeefp.h b/newlib/libc/include/machine/ieeefp.h
index 9384a8781..b7f0b0d2f 100644
--- a/newlib/libc/include/machine/ieeefp.h
+++ b/newlib/libc/include/machine/ieeefp.h
@@ -38,7 +38,7 @@
whereby multiple words of an IEEE floating point are in big endian order, but the
words themselves are little endian with respect to the bytes.
- _DOUBLE_IS_32BITS
+ _DOUBLE_IS_32_BITS
This is used on platforms that support double by using the 32-bit IEEE
float type.
diff --git a/newlib/libc/include/machine/setjmp.h b/newlib/libc/include/machine/setjmp.h
index 9d798ffb6..2b7aeb278 100644
--- a/newlib/libc/include/machine/setjmp.h
+++ b/newlib/libc/include/machine/setjmp.h
@@ -268,12 +268,6 @@ typedef int sigjmp_buf[_JBLEN+2];
# define _CYGWIN_WORKING_SIGSETJMP
#endif
-#ifdef _POSIX_THREADS
-#define __SIGMASK_FUNC pthread_sigmask
-#else
-#define __SIGMASK_FUNC sigprocmask
-#endif
-
#if defined(__GNUC__)
#define sigsetjmp(env, savemask) \
@@ -281,7 +275,7 @@ typedef int sigjmp_buf[_JBLEN+2];
({ \
sigjmp_buf *_sjbuf = &(env); \
((*_sjbuf)[_SAVEMASK] = savemask,\
- __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
+ sigprocmask (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
setjmp (*_sjbuf)); \
})
@@ -290,7 +284,7 @@ typedef int sigjmp_buf[_JBLEN+2];
({ \
sigjmp_buf *_sjbuf = &(env); \
((((*_sjbuf)[_SAVEMASK]) ? \
- __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
+ sigprocmask (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
: 0), \
longjmp (*_sjbuf, val)); \
})
@@ -298,26 +292,15 @@ typedef int sigjmp_buf[_JBLEN+2];
#else /* !__GNUC__ */
#define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\
- __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
+ sigprocmask (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
setjmp (env))
#define siglongjmp(env, val) ((((env)[_SAVEMASK])?\
- __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
+ sigprocmask (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
longjmp (env, val))
#endif
-/* POSIX _setjmp/_longjmp, maintained for XSI compatibility. These
- are equivalent to sigsetjmp/siglongjmp when not saving the signal mask.
- New applications should use sigsetjmp/siglongjmp instead. */
-#ifdef __CYGWIN__
-extern void _longjmp(jmp_buf, int);
-extern int _setjmp(jmp_buf);
-#else
-#define _setjmp(env) sigsetjmp ((env), 0)
-#define _longjmp(env, val) siglongjmp ((env), (val))
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index ce7263194..3f7001a0c 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -226,7 +226,7 @@ extern double scalbln _PARAMS((double, long int));
extern double tgamma _PARAMS((double));
extern double nearbyint _PARAMS((double));
extern long int lrint _PARAMS((double));
-extern _LONG_LONG_TYPE int llrint _PARAMS((double));
+extern _LONG_LONG int llrint _PARAMS((double));
extern double round _PARAMS((double));
extern long int lround _PARAMS((double));
extern double trunc _PARAMS((double));
@@ -293,7 +293,7 @@ extern float scalblnf _PARAMS((float, long int));
extern float tgammaf _PARAMS((float));
extern float nearbyintf _PARAMS((float));
extern long int lrintf _PARAMS((float));
-extern _LONG_LONG_TYPE llrintf _PARAMS((float));
+extern _LONG_LONG llrintf _PARAMS((float));
extern float roundf _PARAMS((float));
extern long int lroundf _PARAMS((float));
extern float truncf _PARAMS((float));
@@ -335,7 +335,7 @@ extern float hypotf _PARAMS((float, float));
/* Other long double precision functions. */
extern _LONG_DOUBLE rintl _PARAMS((_LONG_DOUBLE));
extern long int lrintl _PARAMS((_LONG_DOUBLE));
-extern _LONG_LONG_TYPE llrintl _PARAMS((_LONG_DOUBLE));
+extern _LONG_LONG llrintl _PARAMS((_LONG_DOUBLE));
#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L */
diff --git a/newlib/libc/include/reent.h b/newlib/libc/include/reent.h
index dfd0c9a36..639789e71 100644
--- a/newlib/libc/include/reent.h
+++ b/newlib/libc/include/reent.h
@@ -10,7 +10,7 @@
be declared here. It documents them all in one place. All library access
to the system is via some form of these functions.
- The target may provide the needed syscalls by any of the following:
+ There are three ways a target may provide the needed syscalls.
1) Define the reentrant versions of the syscalls directly.
(eg: _open_r, _close_r, etc.). Please keep the namespace clean.
@@ -29,56 +29,11 @@
When you do this, add -DMISSING_SYSCALL_NAMES to newlib_cflags in
configure.host.
- 4) Define or otherwise provide the regular versions of the syscalls,
- and do not supply functional interfaces for any of the reentrant
- calls. With this method, the reentrant syscalls are redefined to
- directly call the regular system call without the reentrancy argument.
- When you do this, specify both -DREENTRANT_SYSCALLS_PROVIDED and
- -DMISSING_SYSCALL_NAMES via newlib_cflags in configure.host and do
- not specify "syscall_dir".
-
Stubs of the reentrant versions of the syscalls exist in the libc/reent
- source directory and are provided if REENTRANT_SYSCALLS_PROVIDED isn't
- defined. These stubs call the native system calls: _open, _close, etc.
- if MISSING_SYSCALL_NAMES is *not* defined, otherwise they call the
- non-underscored versions: open, close, etc. when MISSING_SYSCALL_NAMES
- *is* defined.
-
- By default, newlib functions call the reentrant syscalls internally,
- passing a reentrancy structure as an argument. This reentrancy structure
- contains data that is thread-specific. For example, the errno value is
- kept in the reentrancy structure. If multiple threads exist, each will
- keep a separate errno value which is intuitive since the application flow
- cannot check for failure reliably otherwise.
-
- The reentrant syscalls are either provided by the platform, by the
- libc/reent stubs, or in the case of both MISSING_SYSCALL_NAMES and
- REENTRANT_SYSCALLS_PROVIDED being defined, the calls are redefined to
- simply call the regular syscalls with no reentrancy struct argument.
-
- A single-threaded application does not need to worry about the reentrancy
- structure. It is used internally.
-
- A multi-threaded application needs either to manually manage reentrancy
- structures or use dynamic reentrancy.
-
- Manually managing reentrancy structures entails calling special reentrant
- versions of newlib functions that have an additional reentrancy argument.
- For example, _printf_r. By convention, the first argument is the
- reentrancy structure. By default, the normal version of the function
- uses the default reentrancy structure: _REENT. The reentrancy structure
- is passed internally, eventually to the reentrant syscalls themselves.
- How the structures are stored and accessed in this model is up to the
- application.
-
- Dynamic reentrancy is specified by the __DYNAMIC_REENT__ flag. This
- flag denotes setting up a macro to replace _REENT with a function call
- to __getreent(). This function needs to be implemented by the platform
- and it is meant to return the reentrancy structure for the current
- thread. When the regular C functions (e.g. printf) go to call internal
- routines with the default _REENT structure, they end up calling with
- the reentrancy structure for the thread. Thus, application code does not
- need to call the _r routines nor worry about reentrancy structures. */
+ source directory and are used if REENTRANT_SYSCALLS_PROVIDED isn't defined.
+ They use the native system calls: _open, _close, etc. if they're available
+ (MISSING_SYSCALL_NAMES is *not* defined), otherwise open, close, etc.
+ (MISSING_SYSCALL_NAMES *is* defined). */
/* WARNING: All identifiers here must begin with an underscore. This file is
included by stdio.h and others and we therefore must only use identifiers
@@ -104,35 +59,6 @@ struct tms;
struct timeval;
struct timezone;
-#if defined(REENTRANT_SYSCALLS_PROVIDED) && defined(MISSING_SYSCALL_NAMES)
-
-#define _close_r(__reent, __fd) close(__fd)
-#define _execve_r(__reent, __f, __arg, __env) execve(__f, __arg, __env)
-#define _fcntl_r(__reent, __fd, __cmd, __arg) fcntl(__fd, __cmd, __arg)
-#define _fork_r(__reent) fork()
-#define _fstat_r(__reent, __fdes, __stat) fstat(__fdes, __stat)
-#define _getpid_r(__reent) getpid()
-#define _isatty_r(__reent, __desc) isatty(__desc)
-#define _kill_r(__reent, __pid, __signal) kill(__pid, __signal)
-#define _link_r(__reent, __oldpath, __newpath) link(__oldpath, __newpath)
-#define _lseek_r(__reent, __fdes, __off, __w) lseek(__fdes, __off, __w)
-#define _open_r(__reent, __path, __flag, __m) open(__path, __flag, __m)
-#define _read_r(__reent, __fd, __buff, __cnt) read(__fd, __buff, __cnt)
-#define _sbrk_r(__reent, __incr) sbrk(__incr)
-#define _stat_r(__reent, __path, __buff) stat(__path, __buff)
-#define _times_r(__reent, __time) times(__time)
-#define _unlink_r(__reent, __path) unlink(__path)
-#define _wait_r(__reent, __status) wait(__status)
-#define _write_r(__reent, __fd, __buff, __cnt) write(__fd, __buff, __cnt)
-#define _gettimeofday_r(__reent, __tp, __tzp) gettimeofday(__tp, __tzp)
-
-#ifdef __LARGE64_FILES
-#define _lseek64_r(__reent, __fd, __off, __w) lseek64(__fd, __off, __w)
-#define _fstat64_r(__reent, __fd, __buff) fstat64(__fd, __buff)
-#define _open64_r(__reent, __path, __flag, __m) open64(__path, __flag, __m)
-#endif
-
-#else
/* Reentrant versions of system calls. */
extern int _close_r _PARAMS ((struct _reent *, int));
@@ -141,7 +67,6 @@ extern int _fcntl_r _PARAMS ((struct _reent *, int, int, int));
extern int _fork_r _PARAMS ((struct _reent *));
extern int _fstat_r _PARAMS ((struct _reent *, int, struct stat *));
extern int _getpid_r _PARAMS ((struct _reent *));
-extern int _isatty_r _PARAMS ((struct _reent *, int));
extern int _kill_r _PARAMS ((struct _reent *, int, int));
extern int _link_r _PARAMS ((struct _reent *, const char *, const char *));
extern _off_t _lseek_r _PARAMS ((struct _reent *, int, _off_t, int));
@@ -170,8 +95,6 @@ extern int _fstat64_r _PARAMS ((struct _reent *, int, struct stat64 *));
extern int _open64_r _PARAMS ((struct _reent *, const char *, int, int));
#endif
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/newlib/libc/include/stdint.h b/newlib/libc/include/stdint.h
index 821462d8a..1fa36517a 100644
--- a/newlib/libc/include/stdint.h
+++ b/newlib/libc/include/stdint.h
@@ -348,7 +348,8 @@ typedef unsigned long uintptr_t;
#endif
/* This must match size_t in stddef.h, currently long unsigned int */
-#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
+#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)
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index 3f4fa6724..51c72a447 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -339,10 +339,7 @@ FILE * _EXFUN(fmemopen, (void *, size_t, const char *));
/* getdelim - see __getdelim for now */
/* getline - see __getline for now */
FILE * _EXFUN(open_memstream, (char **, size_t *));
-#if defined (__CYGWIN__)
-int _EXFUN(renameat, (int, const char *, int, const char *));
-int _EXFUN(symlinkat, (const char *, int, const char *));
-#endif
+/* renameat - unimplemented for now */
int _EXFUN(vdprintf, (int, const char *, __VALIST)
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
# endif
diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h
index 9962768cf..27c314620 100644
--- a/newlib/libc/include/string.h
+++ b/newlib/libc/include/string.h
@@ -56,7 +56,9 @@ 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));
-_PTR _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t));
+#ifdef __CYGWIN__
+extern void *memmem (__const void *, size_t, __const void *, size_t);
+#endif
char *_EXFUN(rindex,(const char *, int));
char *_EXFUN(stpcpy,(char *, const char *));
char *_EXFUN(stpncpy,(char *, const char *, size_t));
@@ -76,7 +78,7 @@ char *_EXFUN(strlwr,(char *));
char *_EXFUN(strupr,(char *));
#ifdef __CYGWIN__
#ifndef DEFS_H /* Kludge to work around problem compiling in gdb */
-char *_EXFUN(strsignal, (int __signo));
+const char *_EXFUN(strsignal, (int __signo));
#endif
int _EXFUN(strtosigno, (const char *__name));
#endif
diff --git a/newlib/libc/include/sys/_default_fcntl.h b/newlib/libc/include/sys/_default_fcntl.h
index ccef6132e..b10503933 100644
--- a/newlib/libc/include/sys/_default_fcntl.h
+++ b/newlib/libc/include/sys/_default_fcntl.h
@@ -131,17 +131,6 @@ extern "C" {
#define F_UNLKSYS 4 /* remove remote locks for a given system */
#endif /* !_POSIX_SOURCE */
-#ifdef __CYGWIN__
-/* Special descriptor value to denote the cwd in calls to openat(2) etc. */
-#define AT_FDCWD -2
-
-/* Flag values for faccessat2) et al. */
-#define AT_EACCESS 1
-#define AT_SYMLINK_NOFOLLOW 2
-#define AT_SYMLINK_FOLLOW 4
-#define AT_REMOVEDIR 8
-#endif
-
/*#include <sys/stdtypes.h>*/
#ifndef __CYGWIN__
@@ -177,12 +166,6 @@ struct eflock {
extern int open _PARAMS ((const char *, int, ...));
extern int creat _PARAMS ((const char *, mode_t));
extern int fcntl _PARAMS ((int, int, ...));
-#ifdef __CYGWIN__
-#include <sys/time.h>
-extern int futimesat _PARAMS ((int, const char *, const struct timeval *));
-extern int openat _PARAMS ((int, const char *, int, ...));
-extern int unlinkat _PARAMS ((int, const char *, int));
-#endif
/* Provide _<systemcall> prototypes for functions provided by some versions
of newlib. */
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index fffb05de0..39785d77d 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -149,19 +149,8 @@ struct __sFILE_fake {
struct _reent *_data;
};
-
-/* Following is needed both in libc/stdio and libc/stdlib so we put it
- * here instead of libc/stdio/local.h where it was previously. */
-
-extern _VOID _EXFUN(__sinit,(struct _reent *));
-
-# define _REENT_SMALL_CHECK_INIT(ptr) \
- do \
- { \
- if ((ptr) && !(ptr)->__sdidinit) \
- __sinit (ptr); \
- } \
- while (0)
+/* CHECK_STD_INIT() comes from stdio/local.h; be sure to include that. */
+# define _REENT_SMALL_CHECK_INIT(ptr) CHECK_STD_INIT(ptr)
#else
# define _REENT_SMALL_CHECK_INIT(ptr) /* nothing */
#endif
@@ -430,35 +419,35 @@ extern const struct __sFILE_fake __sf_fake_stderr;
}
#define _REENT_INIT_PTR(var) \
- { (var)->_stdin = (__FILE *)&__sf_fake_stdin; \
- (var)->_stdout = (__FILE *)&__sf_fake_stdout; \
- (var)->_stderr = (__FILE *)&__sf_fake_stderr; \
- (var)->_errno = 0; \
- (var)->_inc = 0; \
- (var)->_emergency = _NULL; \
- (var)->__sdidinit = 0; \
- (var)->_current_category = 0; \
- (var)->_current_locale = "C"; \
- (var)->_mp = _NULL; \
- (var)->__cleanup = _NULL; \
- (var)->_gamma_signgam = 0; \
- (var)->_cvtlen = 0; \
- (var)->_cvtbuf = _NULL; \
- (var)->_r48 = _NULL; \
- (var)->_localtime_buf = _NULL; \
- (var)->_asctime_buf = _NULL; \
- (var)->_sig_func = _NULL; \
- (var)->_atexit = _NULL; \
- (var)->_atexit0._next = _NULL; \
- (var)->_atexit0._ind = 0; \
- (var)->_atexit0._fns[0] = _NULL; \
- (var)->_atexit0._on_exit_args_ptr = _NULL; \
- (var)->__sglue._next = _NULL; \
- (var)->__sglue._niobs = 0; \
- (var)->__sglue._iobs = _NULL; \
- (var)->__sf = 0; \
- (var)->_misc = _NULL; \
- (var)->_signal_buf = _NULL; \
+ { var->_stdin = (__FILE *)&__sf_fake_stdin; \
+ var->_stdout = (__FILE *)&__sf_fake_stdout; \
+ var->_stderr = (__FILE *)&__sf_fake_stderr; \
+ var->_errno = 0; \
+ var->_inc = 0; \
+ var->_emergency = _NULL; \
+ var->__sdidinit = 0; \
+ var->_current_category = 0; \
+ var->_current_locale = "C"; \
+ var->_mp = _NULL; \
+ var->__cleanup = _NULL; \
+ var->_gamma_signgam = 0; \
+ var->_cvtlen = 0; \
+ var->_cvtbuf = _NULL; \
+ var->_r48 = _NULL; \
+ var->_localtime_buf = _NULL; \
+ var->_asctime_buf = _NULL; \
+ var->_sig_func = _NULL; \
+ var->_atexit = _NULL; \
+ var->_atexit0._next = _NULL; \
+ var->_atexit0._ind = 0; \
+ var->_atexit0._fns[0] = _NULL; \
+ var->_atexit0._on_exit_args_ptr = _NULL; \
+ var->__sglue._next = _NULL; \
+ var->__sglue._niobs = 0; \
+ var->__sglue._iobs = _NULL; \
+ var->__sf = 0; \
+ var->_misc = _NULL; \
+ var->_signal_buf = _NULL; \
}
/* Only built the assert() calls if we are built with debugging. */
@@ -623,7 +612,6 @@ struct _reent
_mbstate_t _mbsrtowcs_state;
_mbstate_t _wcrtomb_state;
_mbstate_t _wcsrtombs_state;
- int _h_errno;
} _reent;
/* Two next two fields were once used by malloc. They are no longer
used. They are used to preserve the space used before so as to
@@ -652,9 +640,9 @@ struct _reent
#define _REENT_INIT(var) \
{ 0, \
- &(var).__sf[0], \
- &(var).__sf[1], \
- &(var).__sf[2], \
+ &var.__sf[0], \
+ &var.__sf[1], \
+ &var.__sf[2], \
0, \
"", \
0, \
@@ -700,65 +688,65 @@ struct _reent
}
#define _REENT_INIT_PTR(var) \
- { (var)->_errno = 0; \
- (var)->_stdin = &(var)->__sf[0]; \
- (var)->_stdout = &(var)->__sf[1]; \
- (var)->_stderr = &(var)->__sf[2]; \
- (var)->_inc = 0; \
- memset(&(var)->_emergency, 0, sizeof((var)->_emergency)); \
- (var)->_current_category = 0; \
- (var)->_current_locale = "C"; \
- (var)->__sdidinit = 0; \
- (var)->__cleanup = _NULL; \
- (var)->_result = _NULL; \
- (var)->_result_k = 0; \
- (var)->_p5s = _NULL; \
- (var)->_freelist = _NULL; \
- (var)->_cvtlen = 0; \
- (var)->_cvtbuf = _NULL; \
- (var)->_new._reent._unused_rand = 0; \
- (var)->_new._reent._strtok_last = _NULL; \
- (var)->_new._reent._asctime_buf[0] = 0; \
- memset(&(var)->_new._reent._localtime_buf, 0, sizeof((var)->_new._reent._localtime_buf)); \
- (var)->_new._reent._gamma_signgam = 0; \
- (var)->_new._reent._rand_next = 1; \
- (var)->_new._reent._r48._seed[0] = _RAND48_SEED_0; \
- (var)->_new._reent._r48._seed[1] = _RAND48_SEED_1; \
- (var)->_new._reent._r48._seed[2] = _RAND48_SEED_2; \
- (var)->_new._reent._r48._mult[0] = _RAND48_MULT_0; \
- (var)->_new._reent._r48._mult[1] = _RAND48_MULT_1; \
- (var)->_new._reent._r48._mult[2] = _RAND48_MULT_2; \
- (var)->_new._reent._r48._add = _RAND48_ADD; \
- (var)->_new._reent._mblen_state.__count = 0; \
- (var)->_new._reent._mblen_state.__value.__wch = 0; \
- (var)->_new._reent._mbtowc_state.__count = 0; \
- (var)->_new._reent._mbtowc_state.__value.__wch = 0; \
- (var)->_new._reent._wctomb_state.__count = 0; \
- (var)->_new._reent._wctomb_state.__value.__wch = 0; \
- (var)->_new._reent._mbrlen_state.__count = 0; \
- (var)->_new._reent._mbrlen_state.__value.__wch = 0; \
- (var)->_new._reent._mbrtowc_state.__count = 0; \
- (var)->_new._reent._mbrtowc_state.__value.__wch = 0; \
- (var)->_new._reent._mbsrtowcs_state.__count = 0; \
- (var)->_new._reent._mbsrtowcs_state.__value.__wch = 0; \
- (var)->_new._reent._wcrtomb_state.__count = 0; \
- (var)->_new._reent._wcrtomb_state.__value.__wch = 0; \
- (var)->_new._reent._wcsrtombs_state.__count = 0; \
- (var)->_new._reent._wcsrtombs_state.__value.__wch = 0; \
- (var)->_new._reent._l64a_buf[0] = '\0'; \
- (var)->_new._reent._signal_buf[0] = '\0'; \
- (var)->_new._reent._getdate_err = 0; \
- (var)->_atexit = _NULL; \
- (var)->_atexit0._next = _NULL; \
- (var)->_atexit0._ind = 0; \
- (var)->_atexit0._fns[0] = _NULL; \
- (var)->_atexit0._on_exit_args._fntypes = 0; \
- (var)->_atexit0._on_exit_args._fnargs[0] = _NULL; \
- (var)->_sig_func = _NULL; \
- (var)->__sglue._next = _NULL; \
- (var)->__sglue._niobs = 0; \
- (var)->__sglue._iobs = _NULL; \
- memset(&(var)->__sf, 0, sizeof((var)->__sf)); \
+ { var->_errno = 0; \
+ var->_stdin = &var->__sf[0]; \
+ var->_stdout = &var->__sf[1]; \
+ var->_stderr = &var->__sf[2]; \
+ var->_inc = 0; \
+ memset(&var->_emergency, 0, sizeof(var->_emergency)); \
+ var->_current_category = 0; \
+ var->_current_locale = "C"; \
+ var->__sdidinit = 0; \
+ var->__cleanup = _NULL; \
+ var->_result = _NULL; \
+ var->_result_k = 0; \
+ var->_p5s = _NULL; \
+ var->_freelist = _NULL; \
+ var->_cvtlen = 0; \
+ var->_cvtbuf = _NULL; \
+ var->_new._reent._unused_rand = 0; \
+ var->_new._reent._strtok_last = _NULL; \
+ var->_new._reent._asctime_buf[0] = 0; \
+ memset(&var->_new._reent._localtime_buf, 0, sizeof(var->_new._reent._localtime_buf)); \
+ var->_new._reent._gamma_signgam = 0; \
+ var->_new._reent._rand_next = 1; \
+ var->_new._reent._r48._seed[0] = _RAND48_SEED_0; \
+ var->_new._reent._r48._seed[1] = _RAND48_SEED_1; \
+ var->_new._reent._r48._seed[2] = _RAND48_SEED_2; \
+ var->_new._reent._r48._mult[0] = _RAND48_MULT_0; \
+ var->_new._reent._r48._mult[1] = _RAND48_MULT_1; \
+ var->_new._reent._r48._mult[2] = _RAND48_MULT_2; \
+ var->_new._reent._r48._add = _RAND48_ADD; \
+ var->_new._reent._mblen_state.__count = 0; \
+ var->_new._reent._mblen_state.__value.__wch = 0; \
+ var->_new._reent._mbtowc_state.__count = 0; \
+ var->_new._reent._mbtowc_state.__value.__wch = 0; \
+ var->_new._reent._wctomb_state.__count = 0; \
+ var->_new._reent._wctomb_state.__value.__wch = 0; \
+ var->_new._reent._mbrlen_state.__count = 0; \
+ var->_new._reent._mbrlen_state.__value.__wch = 0; \
+ var->_new._reent._mbrtowc_state.__count = 0; \
+ var->_new._reent._mbrtowc_state.__value.__wch = 0; \
+ var->_new._reent._mbsrtowcs_state.__count = 0; \
+ var->_new._reent._mbsrtowcs_state.__value.__wch = 0; \
+ var->_new._reent._wcrtomb_state.__count = 0; \
+ var->_new._reent._wcrtomb_state.__value.__wch = 0; \
+ var->_new._reent._wcsrtombs_state.__count = 0; \
+ var->_new._reent._wcsrtombs_state.__value.__wch = 0; \
+ var->_new._reent._l64a_buf[0] = '\0'; \
+ var->_new._reent._signal_buf[0] = '\0'; \
+ var->_new._reent._getdate_err = 0; \
+ var->_atexit = _NULL; \
+ var->_atexit0._next = _NULL; \
+ var->_atexit0._ind = 0; \
+ var->_atexit0._fns[0] = _NULL; \
+ var->_atexit0._on_exit_args._fntypes = 0; \
+ var->_atexit0._on_exit_args._fnargs[0] = _NULL; \
+ var->_sig_func = _NULL; \
+ var->__sglue._next = _NULL; \
+ var->__sglue._niobs = 0; \
+ var->__sglue._iobs = _NULL; \
+ memset(&var->__sf, 0, sizeof(var->__sf)); \
}
#define _REENT_CHECK_RAND48(ptr) /* nothing */
diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h
index 06a71a978..1eb16ecd3 100644
--- a/newlib/libc/include/sys/stat.h
+++ b/newlib/libc/include/sys/stat.h
@@ -115,11 +115,6 @@ struct stat
#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK)
#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK)
-#if defined(__CYGWIN__)
-/* Special tv_nsec values for futimens(2) and utimensat(2). */
-#define UTIME_NOW -2L
-#define UTIME_OMIT -1L
-#endif
int _EXFUN(chmod,( const char *__path, mode_t __mode ));
int _EXFUN(fchmod,(int __fd, mode_t __mode));
@@ -134,16 +129,6 @@ int _EXFUN(lstat,( const char *__path, struct stat *__buf ));
int _EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev ));
#endif
-#if defined (__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
-int _EXFUN(fchmodat, (int, const char *, mode_t, int));
-int _EXFUN(fstatat, (int, const char *, struct stat *, int));
-int _EXFUN(mkdirat, (int, const char *, mode_t));
-int _EXFUN(mkfifoat, (int, const char *, mode_t));
-int _EXFUN(mknodat, (int, const char *, mode_t, dev_t));
-int _EXFUN(utimensat, (int, const char *, const struct timespec *, int));
-int _EXFUN(futimens, (int, const struct timespec *));
-#endif
-
/* Provide prototypes for most of the _<systemcall> names that are
provided in newlib for some compilers. */
#ifdef _COMPILING_NEWLIB
diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h
index fa7361a25..619652ffc 100644
--- a/newlib/libc/include/sys/unistd.h
+++ b/newlib/libc/include/sys/unistd.h
@@ -46,9 +46,6 @@ int _EXFUN(execlp, (const char *__file, const char *, ... ));
int _EXFUN(execv, (const char *__path, char * const __argv[] ));
int _EXFUN(execve, (const char *__path, char * const __argv[], char * const __envp[] ));
int _EXFUN(execvp, (const char *__file, char * const __argv[] ));
-#if defined(__CYGWIN__)
-int _EXFUN(faccessat, (int __dirfd, const char *__path, int __mode, int __flags));
-#endif
#if defined(__CYGWIN__) || defined(__rtems__) || defined(__SPU__)
int _EXFUN(fchdir, (int __fildes));
#endif
@@ -56,9 +53,6 @@ int _EXFUN(fchmod, (int __fildes, mode_t __mode ));
#if !defined(__INSIDE_CYGWIN__)
int _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group ));
#endif
-#if defined(__CYGWIN__)
-int _EXFUN(fchownat, (int __dirfd, const char *__path, uid_t __owner, gid_t __group, int __flags));
-#endif
pid_t _EXFUN(fork, (void ));
long _EXFUN(fpathconf, (int __fd, int __name ));
int _EXFUN(fsync, (int __fd));
@@ -105,14 +99,11 @@ int _EXFUN(isatty, (int __fildes ));
int _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group ));
#endif
int _EXFUN(link, (const char *__path1, const char *__path2 ));
-#if defined(__CYGWIN__)
-int _EXFUN(linkat, (int __dirfd1, const char *__path1, int __dirfd2, const char *__path2, int __flags ));
-#endif
int _EXFUN(nice, (int __nice_value ));
#if !defined(__INSIDE_CYGWIN__)
off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
#endif
-#if defined(__SPU__) || defined(__CYGWIN__)
+#if defined(__SPU__)
#define F_ULOCK 0
#define F_LOCK 1
#define F_TLOCK 2
@@ -198,7 +189,6 @@ int getsubopt(char **, char * const *, char **);
int _EXFUN(_close, (int __fildes ));
pid_t _EXFUN(_fork, (void ));
pid_t _EXFUN(_getpid, (void ));
-int _EXFUN(_isatty, (int __fildes ));
int _EXFUN(_link, (const char *__path1, const char *__path2 ));
_off_t _EXFUN(_lseek, (int __fildes, _off_t __offset, int __whence ));
#ifdef __LARGE64_FILES
@@ -235,10 +225,7 @@ void _EXFUN(sync, (void));
int _EXFUN(sync, (void));
#endif
-ssize_t _EXFUN(readlink, (const char *__path, char *__buf, size_t __buflen));
-#if defined(__CYGWIN__)
-ssize_t _EXFUN(readlinkat, (int __dirfd1, const char *__path, char *__buf, size_t __buflen));
-#endif
+int _EXFUN(readlink, (const char *__path, char *__buf, int __buflen));
int _EXFUN(symlink, (const char *__name1, const char *__name2));
#define F_OK 0