diff options
Diffstat (limited to 'newlib/libc/include/sys')
-rw-r--r-- | newlib/libc/include/sys/_types.h | 4 | ||||
-rw-r--r-- | newlib/libc/include/sys/config.h | 20 | ||||
-rw-r--r-- | newlib/libc/include/sys/dirent.h | 8 | ||||
-rw-r--r-- | newlib/libc/include/sys/fcntl.h | 6 | ||||
-rw-r--r-- | newlib/libc/include/sys/features.h | 20 | ||||
-rw-r--r-- | newlib/libc/include/sys/iconvnls.h | 77 | ||||
-rw-r--r-- | newlib/libc/include/sys/lock.h | 20 | ||||
-rw-r--r-- | newlib/libc/include/sys/param.h | 23 | ||||
-rw-r--r-- | newlib/libc/include/sys/reent.h | 136 | ||||
-rw-r--r-- | newlib/libc/include/sys/signal.h | 7 | ||||
-rw-r--r-- | newlib/libc/include/sys/stdio.h | 15 | ||||
-rw-r--r-- | newlib/libc/include/sys/string.h | 2 | ||||
-rw-r--r-- | newlib/libc/include/sys/time.h | 8 | ||||
-rw-r--r-- | newlib/libc/include/sys/types.h | 54 | ||||
-rw-r--r-- | newlib/libc/include/sys/unistd.h | 14 |
15 files changed, 110 insertions, 304 deletions
diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h index d3f68cef5..c498f7c8f 100644 --- a/newlib/libc/include/sys/_types.h +++ b/newlib/libc/include/sys/_types.h @@ -9,8 +9,6 @@ #ifndef _SYS__TYPES_H #define _SYS__TYPES_H -#include <sys/lock.h> - typedef long _off_t; __extension__ typedef long long _off64_t; @@ -34,7 +32,7 @@ typedef struct } __value; /* Value so far. */ } _mbstate_t; -typedef _LOCK_RECURSIVE_T _flock_t; +typedef int _flock_t; /* Iconv descriptor type */ typedef void *_iconv_t; diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h index c4e4dba9a..0859392bb 100644 --- a/newlib/libc/include/sys/config.h +++ b/newlib/libc/include/sys/config.h @@ -20,7 +20,7 @@ #define UINT_MAX 65535 #endif -#if defined (__H8300__) || defined (__H8300H__) || defined(__H8300S__) || defined (__H8300SX__) +#if defined (__H8300__) || defined (__H8300H__) || defined(__H8300S__) #define __SMALL_BITFIELDS #define H8300 1 #undef INT_MAX @@ -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..f69c803ff 100644 --- a/newlib/libc/include/sys/features.h +++ b/newlib/libc/include/sys/features.h @@ -78,17 +78,15 @@ extern "C" { #endif #ifdef __CYGWIN__ -# define _POSIX_JOB_CONTROL 1 -# define _POSIX_SAVED_IDS 0 -# define _POSIX_VERSION 199009L -# define _POSIX_THREADS 1 -# define _POSIX_THREAD_PROCESS_SHARED 1 -# define _POSIX_THREAD_SAFE_FUNCTIONS 1 -# define _POSIX_THREAD_PRIORITY_SCHEDULING 1 -# define _POSIX_THREAD_ATTR_STACKSIZE 1 -# define _POSIX_SEMAPHORES 1 -# define _POSIX_TIMERS 1 -# define _POSIX_MEMLOCK_RANGE 1 +# define _POSIX_JOB_CONTROL 1 +# define _POSIX_SAVED_IDS 0 +# define _POSIX_VERSION 199009L +# define _POSIX_THREADS 1 +# define _POSIX_THREAD_PROCESS_SHARED 1 +# define _POSIX_THREAD_SAFE_FUNCTIONS 1 +# define _POSIX_THREAD_PRIORITY_SCHEDULING 1 +# define _POSIX_THREAD_ATTR_STACKSIZE 1 +# define _POSIX_SEMAPHORES 1 #endif #ifdef __cplusplus diff --git a/newlib/libc/include/sys/iconvnls.h b/newlib/libc/include/sys/iconvnls.h deleted file mode 100644 index 09ea18316..000000000 --- a/newlib/libc/include/sys/iconvnls.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2003-2004, Artem B. Bityuckiy. - * Rights transferred to Franklin Electronic Publishers. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Funtions, macros, etc implimented in iconv library but used by other - * NLS-related subsystems too. - */ -#ifndef __SYS_ICONVNLS_H__ -#define __SYS_ICONVNLS_H__ - -#include <_ansi.h> -#include <reent.h> -#include <wchar.h> -#include <iconv.h> - -/* Iconv data path environment variable name */ -#define NLS_ENVVAR_NAME "NLSPATH" -/* Default NLSPATH value */ -#define ICONV_DEFAULT_NLSPATH "/usr/locale" -/* Direction markers */ -#define ICONV_NLS_FROM 0 -#define ICONV_NLS_TO 1 - -_VOID -_EXFUN(_iconv_nls_get_state, (iconv_t cd, mbstate_t *ps, int direction)); - -int -_EXFUN(_iconv_nls_set_state, (iconv_t cd, mbstate_t *ps, int direction)); - -int -_EXFUN(_iconv_nls_is_stateful, (iconv_t cd, int direction)); - -int -_EXFUN(_iconv_nls_get_mb_cur_max, (iconv_t cd, int direction)); - -size_t -_EXFUN(_iconv_nls_conv, (struct _reent *rptr, iconv_t cd, - _CONST char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft)); - -_CONST char * -_EXFUN(_iconv_nls_construct_filename, (struct _reent *rptr, _CONST char *file, - _CONST char *dir, _CONST char *ext)); - - -int -_EXFUN(_iconv_nls_open, (struct _reent *rptr, _CONST char *encoding, - iconv_t *towc, iconv_t *fromwc, int flag)); - -char * -_EXFUN(_iconv_resolve_encoding_name, (struct _reent *rptr, _CONST char *ca)); - -#endif /* __SYS_ICONVNLS_H__ */ - diff --git a/newlib/libc/include/sys/lock.h b/newlib/libc/include/sys/lock.h index c05814a2a..984bc5f80 100644 --- a/newlib/libc/include/sys/lock.h +++ b/newlib/libc/include/sys/lock.h @@ -8,15 +8,15 @@ typedef int _LOCK_RECURSIVE_T; #define __LOCK_INIT(class,lock) static int lock = 0; #define __LOCK_INIT_RECURSIVE(class,lock) static int lock = 0; -#define __lock_init(lock) (0) -#define __lock_init_recursive(lock) (0) -#define __lock_close(lock) (0) -#define __lock_close_recursive(lock) (0) -#define __lock_acquire(lock) (0) -#define __lock_acquire_recursive(lock) (0) -#define __lock_try_acquire(lock) (0) -#define __lock_try_acquire_recursive(lock) (0) -#define __lock_release(lock) (0) -#define __lock_release_recursive(lock) (0) +#define __lock_init(lock) {} +#define __lock_init_recursive(lock) {} +#define __lock_close(lock) {} +#define __lock_close_recursive(lock) {} +#define __lock_acquire(lock) {} +#define __lock_acquire_recursive(lock) {} +#define __lock_try_acquire(lock) {} +#define __lock_try_acquire_recursive(lock) {} +#define __lock_release(lock) {} +#define __lock_release_recursive(lock) {} #endif /* __SYS_LOCK_H__ */ diff --git a/newlib/libc/include/sys/param.h b/newlib/libc/include/sys/param.h index 7e8762a65..9676c910a 100644 --- a/newlib/libc/include/sys/param.h +++ b/newlib/libc/include/sys/param.h @@ -6,20 +6,27 @@ # define _SYS_PARAM_H #include <sys/config.h> -#include <machine/endian.h> -#include <machine/param.h> -#ifndef HZ -# define HZ (60) +#ifndef BIG_ENDIAN +#define BIG_ENDIAN 4321 #endif -#ifndef NOFILE -# define NOFILE (60) +#ifndef LITTLE_ENDIAN +#define LITTLE_ENDIAN 1234 #endif -#ifndef PATHSIZE + +# define HZ (60) +# define NOFILE (60) # define PATHSIZE (1024) -#endif #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b)) +#ifndef BYTE_ORDER +#ifdef __IEEE_LITTLE_ENDIAN +#define BYTE_ORDER LITTLE_ENDIAN +#else +#define BYTE_ORDER BIG_ENDIAN +#endif +#endif + #endif diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index 7911b6cbc..e783e842e 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -59,24 +59,19 @@ struct __tm }; /* - * atexit() support. + * atexit() support. For _REENT_SMALL, we limit to 32 max. */ #define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */ struct _on_exit_args { - void * _fnargs[_ATEXIT_SIZE]; /* user fn args */ - void * _dso_handle[_ATEXIT_SIZE]; - /* Bitmask is set if user function takes arguments. */ + void * _fnargs[_ATEXIT_SIZE]; /* fn args for on_exit */ __ULong _fntypes; /* type of exit routine - - Must have at least _ATEXIT_SIZE bits */ - /* Bitmask is set if function was registered via __cxa_atexit. */ - __ULong _is_cxa; + Must have at least _ATEXIT_SIZE bits */ }; #ifdef _REENT_SMALL struct _atexit { - struct _atexit *_next; /* next in list */ int _ind; /* next index in this table */ void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */ struct _on_exit_args * _on_exit_args_ptr; @@ -85,7 +80,6 @@ struct _atexit { struct _atexit { struct _atexit *_next; /* next in list */ int _ind; /* next index in this table */ - /* Some entries may already have been called, and will be NULL. */ void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */ struct _on_exit_args _on_exit_args; }; @@ -158,9 +152,9 @@ struct __sFILE_fake { struct _reent *_data; }; /* CHECK_INIT() comes from stdio/local.h; be sure to include that. */ -# define _REENT_SMALL_CHECK_INIT(ptr) CHECK_INIT(ptr) +# define _REENT_SMALL_CHECK_INIT(fp) CHECK_INIT(fp) #else -# define _REENT_SMALL_CHECK_INIT(ptr) /* nothing */ +# define _REENT_SMALL_CHECK_INIT(fp) /* nothing */ #endif struct __sFILE { @@ -377,8 +371,7 @@ struct _reent void (**(_sig_func))(int); /* atexit stuff */ - struct _atexit *_atexit; - struct _atexit _atexit0; + struct _atexit _atexit; struct _glue __sglue; /* root of glue chain */ __FILE *__sf; /* file descriptors */ @@ -388,32 +381,10 @@ struct _reent }; #define _REENT_INIT(var) \ - { (__FILE *)&var.__sf_fake, \ - (__FILE *)&var.__sf_fake, \ - (__FILE *)&var.__sf_fake, \ - 0, \ - 0, \ - _NULL, \ - 0, \ - 0, \ - "C", \ - _NULL, \ - _NULL, \ - 0, \ - 0, \ - _NULL, \ - _NULL, \ - _NULL, \ - _NULL, \ - _NULL, \ - _NULL, \ - {_NULL, 0, {_NULL}, _NULL}, \ - {_NULL, 0, _NULL}, \ - _NULL, \ - {_NULL, 0, 0, 0, 0, {_NULL, 0}, 0, _NULL}, \ - _NULL, \ - _NULL \ - } + { (__FILE *)&var.__sf_fake, (__FILE *)&var.__sf_fake, \ + (__FILE *)&var.__sf_fake, 0, 0, _NULL, 0, 0, \ + "C", _NULL, _NULL, 0, 0, _NULL, _NULL, _NULL, _NULL, _NULL, \ + { 0, _NULL, _NULL, 0 }, { _NULL, 0, _NULL }, _NULL, 0, _NULL, _NULL } #define _REENT_INIT_PTR(var) \ { var->_stdin = (__FILE *)&var->__sf_fake; \ @@ -434,26 +405,23 @@ struct _reent 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->_atexit._ind = 0; \ + var->_atexit._fns[0] = _NULL; \ + var->_atexit._on_exit_args = _NULL; \ var->__sglue._next = _NULL; \ var->__sglue._niobs = 0; \ var->__sglue._iobs = _NULL; \ var->__sf = 0; \ + var->_misc = _NULL; \ + var->_signal_buf = _NULL; \ + var->_getdate_err = 0; \ var->__sf_fake._p = _NULL; \ var->__sf_fake._r = 0; \ var->__sf_fake._w = 0; \ var->__sf_fake._flags = 0; \ var->__sf_fake._file = 0; \ - var->__sf_fake._bf._base = _NULL; \ - var->__sf_fake._bf._size = 0; \ var->__sf_fake._lbfsize = 0; \ var->__sf_fake._data = _NULL; \ - var->_misc = _NULL; \ - var->_signal_buf = _NULL; \ } /* Only built the assert() calls if we are built with debugging. */ @@ -640,61 +608,23 @@ struct _reent }; #define _REENT_INIT(var) \ - { 0, \ - &var.__sf[0], \ - &var.__sf[1], \ - &var.__sf[2], \ - 0, \ - "", \ - 0, \ - "C", \ - 0, \ - _NULL, \ - _NULL, \ - 0, \ - _NULL, \ - _NULL, \ - 0, \ - _NULL, \ - { \ - { \ - 0, \ - _NULL, \ - "", \ - {0, 0, 0, 0, 0, 0, 0, 0, 0}, \ - 0, \ - 1, \ - { \ - {_RAND48_SEED_0, _RAND48_SEED_1, _RAND48_SEED_2}, \ - {_RAND48_MULT_0, _RAND48_MULT_1, _RAND48_MULT_2}, \ - _RAND48_ADD \ - }, \ - {0, {0}}, \ - {0, {0}}, \ - {0, {0}}, \ - "", \ - "", \ - 0, \ - {0, {0}}, \ - {0, {0}}, \ - {0, {0}}, \ - {0, {0}}, \ - {0, {0}} \ - } \ - }, \ - _NULL, \ - {_NULL, 0, {_NULL}, {{_NULL}, {_NULL}, 0, 0}}, \ - _NULL, \ - {_NULL, 0, _NULL} \ - } + { 0, &var.__sf[0], &var.__sf[1], &var.__sf[2], 0, "", 0, "C", \ + 0, _NULL, _NULL, 0, _NULL, _NULL, 0, _NULL, { {0, _NULL, "", \ + { 0,0,0,0,0,0,0,0}, 0, 1, \ + {{_RAND48_SEED_0, _RAND48_SEED_1, _RAND48_SEED_2}, \ + {_RAND48_MULT_0, _RAND48_MULT_1, _RAND48_MULT_2}, _RAND48_ADD}, \ + {0, {0}}, {0, {0}}, {0, {0}}, "", "", 0, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}} } } } #define _REENT_INIT_PTR(var) \ - { var->_errno = 0; \ + { int i; \ + char *tmp_ptr; \ + 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)); \ + for (i = 0; i < _REENT_EMERGENCY_SIZE; ++i) \ + var->_emergency[i] = 0; \ var->_current_category = 0; \ var->_current_locale = "C"; \ var->__sdidinit = 0; \ @@ -708,7 +638,9 @@ struct _reent 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)); \ + tmp_ptr = (char *)&var->_new._reent._localtime_buf; \ + for (i = 0; i < sizeof(struct __tm); ++i) \ + tmp_ptr[i] = 0; \ var->_new._reent._gamma_signgam = 0; \ var->_new._reent._rand_next = 1; \ var->_new._reent._r48._seed[0] = _RAND48_SEED_0; \ @@ -738,7 +670,6 @@ struct _reent 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; \ @@ -747,7 +678,7 @@ struct _reent var->__sglue._next = _NULL; \ var->__sglue._niobs = 0; \ var->__sglue._iobs = _NULL; \ - memset(&var->__sf, 0, sizeof(var->__sf)); \ + memset(var->__sf,0,sizeof(var->__sf)); \ } #define _REENT_CHECK_RAND48(ptr) /* nothing */ @@ -797,7 +728,6 @@ struct _reent #endif extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__; -extern struct _reent *_CONST _global_impure_ptr __ATTRIBUTE_IMPURE_PTR__; void _reclaim_reent _PARAMS ((struct _reent *)); @@ -806,9 +736,7 @@ void _reclaim_reent _PARAMS ((struct _reent *)); #ifndef _REENT_ONLY #if defined(__DYNAMIC_REENT__) && !defined(__SINGLE_THREAD__) -#ifndef __getreent struct _reent * _EXFUN(__getreent, (void)); -#endif # define _REENT (__getreent()) #else /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */ # define _REENT _impure_ptr @@ -816,7 +744,7 @@ void _reclaim_reent _PARAMS ((struct _reent *)); #endif /* !_REENT_ONLY */ -#define _GLOBAL_REENT _global_impure_ptr +#define _GLOBAL_REENT _impure_ptr #ifdef __cplusplus } diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h index 78f06951e..2bfbbf0a8 100644 --- a/newlib/libc/include/sys/signal.h +++ b/newlib/libc/include/sys/signal.h @@ -2,6 +2,7 @@ #ifndef _SYS_SIGNAL_H #define _SYS_SIGNAL_H + #ifdef __cplusplus extern "C" { #endif @@ -301,10 +302,4 @@ int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value)); #ifdef __cplusplus } #endif - -#ifndef _SIGNAL_H_ -/* Some applications take advantage of the fact that <sys/signal.h> - * and <signal.h> are equivalent in glibc. Allow for that here. */ -#include <signal.h> -#endif #endif /* _SYS_SIGNAL_H */ diff --git a/newlib/libc/include/sys/stdio.h b/newlib/libc/include/sys/stdio.h index fa9cd5d0a..8177322a0 100644 --- a/newlib/libc/include/sys/stdio.h +++ b/newlib/libc/include/sys/stdio.h @@ -1,27 +1,14 @@ #ifndef _NEWLIB_STDIO_H #define _NEWLIB_STDIO_H -#include <sys/lock.h> -#include <sys/reent.h> - /* Internal locking macros, used to protect stdio functions. In the - general case, expand to nothing. Use __SSTR flag in FILE _flags to - detect if FILE is private to sprintf/sscanf class of functions; if - set then do nothing as lock is not initialised. */ + general case, expand to nothing. */ #if !defined(_flockfile) -#ifndef __SINGLE_THREAD__ -# define _flockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_acquire_recursive((fp)->_lock)) -#else # define _flockfile(fp) #endif -#endif #if !defined(_funlockfile) -#ifndef __SINGLE_THREAD__ -# define _funlockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_release_recursive((fp)->_lock)) -#else # define _funlockfile(fp) #endif -#endif #endif /* _NEWLIB_STDIO_H */ diff --git a/newlib/libc/include/sys/string.h b/newlib/libc/include/sys/string.h deleted file mode 100644 index ceedf4be1..000000000 --- a/newlib/libc/include/sys/string.h +++ /dev/null @@ -1,2 +0,0 @@ -/* This is a dummy <sys/string.h> used as a placeholder for - systems that need to have a special header file. */ diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h index df3164941..20f2903c3 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 */ @@ -72,7 +72,7 @@ struct itimerval { int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z)); int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *)); -int _EXFUN(utimes, (const char *__path, const struct timeval *__tvp)); +int _EXFUN(utimes, (const char *__path, struct timeval *__tvp)); int _EXFUN(getitimer, (int __which, struct itimerval *__value)); int _EXFUN(setitimer, (int __which, const struct itimerval *__value, struct itimerval *__ovalue)); diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h index bf08616ab..238af1f50 100644 --- a/newlib/libc/include/sys/types.h +++ b/newlib/libc/include/sys/types.h @@ -21,38 +21,24 @@ #ifndef __INTTYPES_DEFINED__ #define __INTTYPES_DEFINED__ +typedef short int __int16_t; +typedef unsigned short int __uint16_t; -#include <machine/_types.h> - -#if defined(__rtems__) -/* - * The following section is RTEMS specific and is needed to more - * closely match the types defined in the BSD sys/types.h. - * This is needed to let the RTEMS/BSD TCP/IP stack compile. - */ - -/* deprecated */ -#if ___int8_t_defined -typedef __uint8_t u_int8_t; -#endif -#if ___int16_t_defined -typedef __uint16_t u_int16_t; -#endif -#if ___int32_t_defined -typedef __uint32_t u_int32_t; -#endif - -#if ___int64_t_defined -typedef __uint64_t u_int64_t; - -/* deprecated */ -typedef __uint64_t u_quad_t; -typedef __int64_t quad_t; -typedef quad_t * qaddr_t; +#if __INT_MAX__ == 32767 +typedef long int __int32_t; +typedef unsigned long int __uint32_t; +#else +typedef int __int32_t; +typedef unsigned int __uint32_t; #endif +#if __LONG_MAX__ > 2147483647 || !defined(__GNUC__) +typedef long int __int64_t; +typedef unsigned long int __uint64_t; +#else +__extension__ typedef long long __int64_t; +__extension__ typedef unsigned long long __uint64_t; #endif - #endif /* ! __INTTYPES_DEFINED */ #ifndef __need_inttypes @@ -251,6 +237,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 +253,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 +366,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..387e2ef17 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -71,11 +71,8 @@ char _EXFUN(*getlogin, (void )); #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) int _EXFUN(getlogin_r, (char *name, size_t namesize) ); #endif -char _EXFUN(*getpass, (const char *__prompt)); +char _EXFUN(*getpass, (__const char *__prompt)); size_t _EXFUN(getpagesize, (void)); -#if defined(__CYGWIN__) -int _EXFUN(getpeereid, (int, uid_t *, gid_t *)); -#endif pid_t _EXFUN(getpgid, (pid_t)); pid_t _EXFUN(getpgrp, (void )); pid_t _EXFUN(getpid, (void )); @@ -147,9 +144,6 @@ long _EXFUN(sysconf, (int __name )); pid_t _EXFUN(tcgetpgrp, (int __fildes )); int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id )); char _EXFUN(*ttyname, (int __fildes )); -#if defined(__CYGWIN__) -int _EXFUN(ttyname_r, (int, char *, size_t)); -#endif int _EXFUN(unlink, (const char *__path )); int _EXFUN(vhangup, (void )); _READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte )); @@ -206,14 +200,10 @@ unsigned _EXFUN(usleep, (unsigned int __useconds)); int _EXFUN(gethostname, (char *__name, size_t __len)); #endif char * _EXFUN(mktemp, (char *)); -#if defined(__CYGWIN__) -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 |