diff options
Diffstat (limited to 'newlib/libc')
31 files changed, 120 insertions, 82 deletions
diff --git a/newlib/libc/include/reent.h b/newlib/libc/include/reent.h index 9430e7557..50b0b5746 100644 --- a/newlib/libc/include/reent.h +++ b/newlib/libc/include/reent.h @@ -137,7 +137,7 @@ struct timezone; /* Reentrant versions of system calls. */ extern int _close_r _PARAMS ((struct _reent *, int)); -extern int _execve_r _PARAMS ((struct _reent *, char *, char **, char **)); +extern int _execve_r _PARAMS ((struct _reent *, const char *, char *const *, char *const *)); 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 *)); @@ -170,6 +170,7 @@ struct stat64; extern _off64_t _lseek64_r _PARAMS ((struct _reent *, int, _off64_t, int)); extern int _fstat64_r _PARAMS ((struct _reent *, int, struct stat64 *)); extern int _open64_r _PARAMS ((struct _reent *, const char *, int, int)); +extern int _stat64_r _PARAMS ((struct _reent *, const char *, struct stat64 *)); #endif #endif diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index 95bceed34..a55dd6969 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -371,13 +371,22 @@ int _EXFUN(_fclose_r, (struct _reent *, FILE *)); int _EXFUN(_fcloseall_r, (struct _reent *)); FILE * _EXFUN(_fdopen_r, (struct _reent *, int, const char *)); int _EXFUN(_fflush_r, (struct _reent *, FILE *)); +int _EXFUN(_fgetc_r, (struct _reent *, FILE *)); char * _EXFUN(_fgets_r, (struct _reent *, char *, int, FILE *)); +#ifdef _COMPILING_NEWLIB +int _EXFUN(_fgetpos_r, (struct _reent *, FILE *, _fpos_t *)); +int _EXFUN(_fsetpos_r, (struct _reent *, FILE *, const _fpos_t *)); +#else +int _EXFUN(_fgetpos_r, (struct _reent *, FILE *, fpos_t *)); +int _EXFUN(_fsetpos_r, (struct _reent *, FILE *, const fpos_t *)); +#endif int _EXFUN(_fiprintf_r, (struct _reent *, FILE *, const char *, ...) _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); int _EXFUN(_fiscanf_r, (struct _reent *, FILE *, const char *, ...) _ATTRIBUTE ((__format__ (__scanf__, 3, 4)))); FILE * _EXFUN(_fmemopen_r, (struct _reent *, void *, size_t, const char *)); FILE * _EXFUN(_fopen_r, (struct _reent *, const char *, const char *)); +FILE * _EXFUN(_freopen_r, (struct _reent *, const char *, const char *, FILE *)); int _EXFUN(_fprintf_r, (struct _reent *, FILE *, const char *, ...) _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); int _EXFUN(_fputc_r, (struct _reent *, int, FILE *)); @@ -389,6 +398,7 @@ int _EXFUN(_fseek_r, (struct _reent *, FILE *, long, int)); int _EXFUN(_fseeko_r,(struct _reent *, FILE *, _off_t, int)); long _EXFUN(_ftell_r, (struct _reent *, FILE *)); _off_t _EXFUN(_ftello_r,(struct _reent *, FILE *)); +void _EXFUN(_rewind_r, (struct _reent *, FILE *)); size_t _EXFUN(_fwrite_r, (struct _reent *, const _PTR , size_t _size, size_t _n, FILE *)); int _EXFUN(_getc_r, (struct _reent *, FILE *)); int _EXFUN(_getc_unlocked_r, (struct _reent *, FILE *)); @@ -479,6 +489,7 @@ ssize_t _EXFUN(__getline, (char **, size_t *, FILE *)); #if !defined(__CYGWIN__) || defined(_COMPILING_NEWLIB) FILE * _EXFUN(fdopen64, (int, const char *)); FILE * _EXFUN(fopen64, (const char *, const char *)); +FILE * _EXFUN(freopen64, (_CONST char *, _CONST char *, FILE *)); _off64_t _EXFUN(ftello64, (FILE *)); _off64_t _EXFUN(fseeko64, (FILE *, _off64_t, int)); int _EXFUN(fgetpos64, (FILE *, _fpos64_t *)); @@ -487,6 +498,7 @@ FILE * _EXFUN(tmpfile64, (void)); FILE * _EXFUN(_fdopen64_r, (struct _reent *, int, const char *)); FILE * _EXFUN(_fopen64_r, (struct _reent *,const char *, const char *)); +FILE * _EXFUN(_freopen64_r, (struct _reent *, _CONST char *, _CONST char *, FILE *)); _off64_t _EXFUN(_ftello64_r, (struct _reent *, FILE *)); _off64_t _EXFUN(_fseeko64_r, (struct _reent *, FILE *, _off64_t, int)); int _EXFUN(_fgetpos64_r, (struct _reent *, FILE *, _fpos64_t *)); @@ -513,12 +525,22 @@ FILE *_EXFUN(funopen,(const _PTR __cookie, int (*__writefn)(_PTR __c, const char *__buf, int __n), _fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence), int (*__closefn)(_PTR __c))); +FILE *_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie, + int (*__readfn)(_PTR __c, char *__buf, int __n), + int (*__writefn)(_PTR __c, const char *__buf, int __n), + _fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence), + int (*__closefn)(_PTR __c))); # else FILE *_EXFUN(funopen,(const _PTR __cookie, int (*__readfn)(_PTR __cookie, char *__buf, int __n), int (*__writefn)(_PTR __cookie, const char *__buf, int __n), fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence), int (*__closefn)(_PTR __cookie))); +FILE *_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie, + int (*__readfn)(_PTR __cookie, char *__buf, int __n), + int (*__writefn)(_PTR __cookie, const char *__buf, int __n), + fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence), + int (*__closefn)(_PTR __cookie))); # endif /* !__LARGE64_FILES */ # define fropen(__cookie, __fn) funopen(__cookie, __fn, (int (*)())0, \ @@ -545,8 +567,10 @@ typedef struct cookie_seek_function_t *seek; cookie_close_function_t *close; } cookie_io_functions_t; -FILE *_EXFUN(fopencookie,(void *__cookie, const char *__mode, - cookie_io_functions_t __functions)); +FILE *_EXFUN(fopencookie,(void *__cookie, + const char *__mode, cookie_io_functions_t __functions)); +FILE *_EXFUN(_fopencookie_r,(struct _reent *, void *__cookie, + const char *__mode, cookie_io_functions_t __functions)); #endif /* ! __STRICT_ANSI__ */ #ifndef __CUSTOM_FILE_IO__ diff --git a/newlib/libc/include/sys/lock.h b/newlib/libc/include/sys/lock.h index c05814a2a..9075e35c9 100644 --- a/newlib/libc/include/sys/lock.h +++ b/newlib/libc/include/sys/lock.h @@ -5,18 +5,20 @@ typedef int _LOCK_T; typedef int _LOCK_RECURSIVE_T; + +#include <_ansi.h> #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) (_CAST_VOID 0) +#define __lock_init_recursive(lock) (_CAST_VOID 0) +#define __lock_close(lock) (_CAST_VOID 0) +#define __lock_close_recursive(lock) (_CAST_VOID 0) +#define __lock_acquire(lock) (_CAST_VOID 0) +#define __lock_acquire_recursive(lock) (_CAST_VOID 0) +#define __lock_try_acquire(lock) (_CAST_VOID 0) +#define __lock_try_acquire_recursive(lock) (_CAST_VOID 0) +#define __lock_release(lock) (_CAST_VOID 0) +#define __lock_release_recursive(lock) (_CAST_VOID 0) #endif /* __SYS_LOCK_H__ */ diff --git a/newlib/libc/include/sys/stdio.h b/newlib/libc/include/sys/stdio.h index fa9cd5d0a..5ead79462 100644 --- a/newlib/libc/include/sys/stdio.h +++ b/newlib/libc/include/sys/stdio.h @@ -12,7 +12,7 @@ #ifndef __SINGLE_THREAD__ # define _flockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_acquire_recursive((fp)->_lock)) #else -# define _flockfile(fp) +# define _flockfile(fp) (_CASTVOID 0) #endif #endif @@ -20,7 +20,7 @@ #ifndef __SINGLE_THREAD__ # define _funlockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_release_recursive((fp)->_lock)) #else -# define _funlockfile(fp) +# define _funlockfile(fp) (_CASTVOID 0) #endif #endif diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h index 26346056a..9edd70185 100644 --- a/newlib/libc/include/sys/time.h +++ b/newlib/libc/include/sys/time.h @@ -70,7 +70,7 @@ struct itimerval { } while (0) #endif /* defined (__rtems__) || defined (__CYGWIN__) */ -int _EXFUN(gettimeofday, (struct timeval *__p, void *__tz)); +int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__tz)); int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *)); int _EXFUN(utimes, (const char *__path, const struct timeval *__tvp)); int _EXFUN(getitimer, (int __which, struct itimerval *__value)); diff --git a/newlib/libc/misc/__dprintf.c b/newlib/libc/misc/__dprintf.c index 0b780f59b..eba45eaaa 100644 --- a/newlib/libc/misc/__dprintf.c +++ b/newlib/libc/misc/__dprintf.c @@ -4,6 +4,7 @@ We do assume _write_r is working. */ +#include <_ansi.h> #include "ctype.h" #include "reent.h" #include "string.h" @@ -19,10 +20,10 @@ static char *parse_number (); #endif -static long get_number (); -static void print_number (); -static void write_char (); -static void write_string (); +static long _EXFUN(get_number, (char *, long, int)); +static void _EXFUN(print_number, (int, int, long)); +static void _EXFUN(write_char, (char c)); +static void _EXFUN(write_string, (_CONST char *s)); /* Non-zero for big-endian systems. */ static int big_endian_p; @@ -39,7 +40,7 @@ static int big_endian_p; 20 words at a certain address). A modifier of `N' says the next argument is a count, and the one after that is a pointer. - Example: __dprintf (stderr, "%Nx\n", 20, p); /-* print 20 ints at `p' *-/ + Example: __dprintf ("%Nx\n", 20, p); /-* print 20 ints at `p' *-/ Supported formats are: c d u x s p. @@ -54,7 +55,7 @@ static int big_endian_p; void #ifdef __STDC__ -__dprintf (char *fmt, ...) +__dprintf (const char *fmt, ...) #else __dprintf (fmt, va_alist) char *fmt; @@ -176,10 +177,10 @@ parse_number (s, p) /* Fetch the number at S of SIZE bytes. */ static long -get_number (s, size, unsigned_p) - char *s; - long size; - int unsigned_p; +_DEFUN(get_number, (s, size, unsigned_p), + char *s _AND + long size _AND + int unsigned_p) { long x; unsigned char *p = (unsigned char *) s; @@ -219,10 +220,10 @@ get_number (s, size, unsigned_p) /* Print X in base BASE. */ static void -print_number (base, unsigned_p, n) - int base; - int unsigned_p; - long n; +_DEFUN(print_number, (base, unsigned_p, n), + int base _AND + int unsigned_p _AND + long n) { static char chars[16] = "0123456789abcdef"; char *p, buf[32]; @@ -253,8 +254,8 @@ print_number (base, unsigned_p, n) stdio is working. */ static void -write_char (c) - char c; +_DEFUN(write_char, (c), + char c) { _write_r (_REENT, CONSOLE_FD, &c, 1); } @@ -264,8 +265,8 @@ write_char (c) stdio is working. */ static void -write_string (s) - char *s; +_DEFUN(write_string, (s), + _CONST char *s) { _write_r (_REENT, CONSOLE_FD, s, strlen (s)); } diff --git a/newlib/libc/reent/execr.c b/newlib/libc/reent/execr.c index 8bc1208d7..744f56ae0 100644 --- a/newlib/libc/reent/execr.c +++ b/newlib/libc/reent/execr.c @@ -35,16 +35,16 @@ INDEX ANSI_SYNOPSIS #include <reent.h> - int _execve_r(struct _reent *<[ptr]>, char *<[name]>, - char **<[argv]>, char **<[env]>); + int _execve_r(struct _reent *<[ptr]>, const char *<[name]>, + char *const <[argv]>[], char *const <[env]>[]); TRAD_SYNOPSIS #include <reent.h> int _execve_r(<[ptr]>, <[name]>, <[argv]>, <[env]>) struct _reent *<[ptr]>; char *<[name]>; - char **<[argv]>; - char **<[env]>; + char *<[argv]>[]; + char *<[env]>[]; DESCRIPTION This is a reentrant version of <<execve>>. It @@ -55,9 +55,9 @@ DESCRIPTION int _DEFUN (_execve_r, (ptr, name, argv, env), struct _reent *ptr _AND - char *name _AND - char **argv _AND - char **env) + _CONST char *name _AND + char *_CONST argv[] _AND + char *_CONST env[]) { int ret; diff --git a/newlib/libc/stdio/asniprintf.c b/newlib/libc/stdio/asniprintf.c index d4ff901e8..16ccfde63 100644 --- a/newlib/libc/stdio/asniprintf.c +++ b/newlib/libc/stdio/asniprintf.c @@ -11,6 +11,7 @@ #include <stdarg.h> #include <limits.h> #include <errno.h> +#include "local.h" char * _DEFUN(_asniprintf_r, (ptr, buf, lenp, fmt), diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c index 15b48bb8b..8919554b9 100644 --- a/newlib/libc/stdio/fread.c +++ b/newlib/libc/stdio/fread.c @@ -87,7 +87,7 @@ _DEFUN(crlf_r, (ptr, fp, buf, count, eof), size_t count _AND int eof) { - int newcount = 0, r; + int r; char *s, *d, *e; if (count == 0) diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h index 8b1516f01..29e7cc6c1 100644 --- a/newlib/libc/stdio/local.h +++ b/newlib/libc/stdio/local.h @@ -33,6 +33,7 @@ #endif +extern u_char *_EXFUN(__sccl, (char *, u_char *fmt)); extern int _EXFUN(__svfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list)); extern int _EXFUN(__ssvfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list)); extern int _EXFUN(__svfiscanf_r,(struct _reent *,FILE *, _CONST char *,va_list)); diff --git a/newlib/libc/stdio/open_memstream.c b/newlib/libc/stdio/open_memstream.c index 6a0680fbd..27ff5be9a 100644 --- a/newlib/libc/stdio/open_memstream.c +++ b/newlib/libc/stdio/open_memstream.c @@ -254,7 +254,6 @@ _DEFUN(_open_memstream_r, (ptr, buf, size), { FILE *fp; memstream *c; - int flags; if (!buf || !size) { diff --git a/newlib/libc/stdio/vasniprintf.c b/newlib/libc/stdio/vasniprintf.c index bf9b7c5eb..56db45ec0 100644 --- a/newlib/libc/stdio/vasniprintf.c +++ b/newlib/libc/stdio/vasniprintf.c @@ -11,6 +11,7 @@ #include <stdarg.h> #include <limits.h> #include <errno.h> +#include "local.h" char * _DEFUN(_vasniprintf_r, (ptr, buf, lenp, fmt, ap), diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index cad50988f..98c3db696 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -250,8 +250,6 @@ static void * get_arg (int, va_list *, int *, void **); typedef unsigned long long u_long_long; #endif -/*static*/ u_char *__sccl (); - /* * vfscanf */ @@ -452,7 +450,8 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), size_t mbslen; /* length of converted multibyte sequence */ mbstate_t state; /* value to keep track of multibyte state */ - u_long (*ccfn) () = 0; /* conversion function (strtol/strtoul) */ + #define CCFN_PARAMS _PARAMS((struct _reent *, const char *, char **, int)) + u_long (*ccfn)CCFN_PARAMS=0; /* conversion function (strtol/strtoul) */ char ccltab[256]; /* character class table for %[...] */ char buf[BUF]; /* buffer for numeric conversions */ char *lptr; /* literal pointer */ @@ -658,13 +657,13 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), /* FALLTHROUGH */ case 'd': c = CT_INT; - ccfn = (u_long (*)())_strtol_r; + ccfn = (u_long (*)CCFN_PARAMS)_strtol_r; base = 10; break; case 'i': c = CT_INT; - ccfn = (u_long (*)())_strtol_r; + ccfn = (u_long (*)CCFN_PARAMS)_strtol_r; base = 0; break; @@ -786,7 +785,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), if (isupper (c)) flags |= LONG; c = CT_INT; - ccfn = (u_long (*)())_strtol_r; + ccfn = (u_long (*)CCFN_PARAMS)_strtol_r; base = 10; break; } diff --git a/newlib/libc/stdlib/__exp10.c b/newlib/libc/stdlib/__exp10.c index 967362347..4e368b830 100644 --- a/newlib/libc/stdlib/__exp10.c +++ b/newlib/libc/stdlib/__exp10.c @@ -3,6 +3,7 @@ */ #include <_ansi.h> +#include "std.h" double _DEFUN (__exp10, (x), diff --git a/newlib/libc/stdlib/__ten_mu.c b/newlib/libc/stdlib/__ten_mu.c index 439c226e1..637197be2 100644 --- a/newlib/libc/stdlib/__ten_mu.c +++ b/newlib/libc/stdlib/__ten_mu.c @@ -6,6 +6,7 @@ */ #include <_ansi.h> +#include "std.h" int _DEFUN (__ten_mul, (acc, digit), diff --git a/newlib/libc/stdlib/ldtoa.c b/newlib/libc/stdlib/ldtoa.c index 5c2972593..ab27e4718 100644 --- a/newlib/libc/stdlib/ldtoa.c +++ b/newlib/libc/stdlib/ldtoa.c @@ -719,8 +719,7 @@ return(0); /* Return nonzero if internal format number is infinite. */ static int -eiisinf (x) - unsigned short x[]; +eiisinf (unsigned short x[]) { #ifdef NANS diff --git a/newlib/libc/stdlib/std.h b/newlib/libc/stdlib/std.h index 287503eac..b20820be4 100644 --- a/newlib/libc/stdlib/std.h +++ b/newlib/libc/stdlib/std.h @@ -25,7 +25,7 @@ #ifdef _HAVE_STDC int __ten_mul(double *acc, int digit); double __adjust(struct _reent *ptr, double *acc, int dexp, int sign); -const double __exp10(unsigned x); +double __exp10(unsigned x); #else int __ten_mul(); double __adjust(); diff --git a/newlib/libc/stdlib/system.c b/newlib/libc/stdlib/system.c index 0b5d9a149..135a9d05b 100644 --- a/newlib/libc/stdlib/system.c +++ b/newlib/libc/stdlib/system.c @@ -53,6 +53,7 @@ Supporting OS subroutines required: <<_exit>>, <<_execve>>, <<_fork_r>>, <<_wait_r>>. */ +#include <_ansi.h> #include <errno.h> #include <stddef.h> #include <stdlib.h> @@ -61,13 +62,13 @@ Supporting OS subroutines required: <<_exit>>, <<_execve>>, <<_fork_r>>, #include <reent.h> #if defined (unix) || defined (__CYGWIN__) -static int do_system (); +static int _EXFUN(do_system, (struct _reent *ptr _AND _CONST char *s)); #endif int -_system_r (ptr, s) - struct _reent *ptr; - _CONST char *s; +_DEFUN(_system_r, (ptr, s), + struct _reent *ptr _AND + _CONST char *s) { #if defined(HAVE_SYSTEM) return _system (s); @@ -101,8 +102,8 @@ _system_r (ptr, s) #ifndef _REENT_ONLY int -system (s) - _CONST char *s; +_DEFUN(system, (s), + _CONST char *s) { return _system_r (_REENT, s); } @@ -118,9 +119,9 @@ extern char **environ; static char ***p_environ = &environ; static int -do_system (ptr, s) - struct _reent *ptr; - _CONST char *s; +_DEFUN(do_system, (ptr, s), + struct _reent *ptr _AND + _CONST char *s) { char *argv[4]; int pid, status; @@ -150,9 +151,9 @@ do_system (ptr, s) #if defined (__CYGWIN__) static int -do_system (ptr, s) - struct _reent *ptr; - _CONST char *s; +_DEFUN(do_system, (ptr, s), + struct _reent *ptr _AND + _CONST char *s) { char *argv[4]; int pid, status; diff --git a/newlib/libc/string/memcpy.c b/newlib/libc/string/memcpy.c index 5336f25a9..5a09ec4f4 100644 --- a/newlib/libc/string/memcpy.c +++ b/newlib/libc/string/memcpy.c @@ -7,6 +7,7 @@ ANSI_SYNOPSIS void* memcpy(void *<[out]>, const void *<[in]>, size_t <[n]>); TRAD_SYNOPSIS + #include <string.h> void *memcpy(<[out]>, <[in]>, <[n]> void *<[out]>; void *<[in]>; @@ -33,8 +34,7 @@ QUICKREF */ #include <_ansi.h> -#include <stddef.h> -#include <limits.h> +#include <string.h> /* Nonzero if either X or Y is not aligned on a "long" boundary. */ #define UNALIGNED(X, Y) \ diff --git a/newlib/libc/syscalls/sysclose.c b/newlib/libc/syscalls/sysclose.c index d05d2866c..946544bed 100644 --- a/newlib/libc/syscalls/sysclose.c +++ b/newlib/libc/syscalls/sysclose.c @@ -1,6 +1,7 @@ /* connector for close */ #include <reent.h> +#include <unistd.h> int _DEFUN (close, (fd), diff --git a/newlib/libc/syscalls/sysexecve.c b/newlib/libc/syscalls/sysexecve.c index 4917446a9..154c082f9 100644 --- a/newlib/libc/syscalls/sysexecve.c +++ b/newlib/libc/syscalls/sysexecve.c @@ -1,12 +1,13 @@ /* connector for execve */ #include <reent.h> +#include <unistd.h> int _DEFUN (execve, (name, argv, env), - char *name _AND - char **argv _AND - char **env) + _CONST char *name _AND + char *_CONST argv[] _AND + char *_CONST env[]) { return _execve_r (_REENT, name, argv, env); } diff --git a/newlib/libc/syscalls/sysfork.c b/newlib/libc/syscalls/sysfork.c index fd2839148..21e6be0e2 100644 --- a/newlib/libc/syscalls/sysfork.c +++ b/newlib/libc/syscalls/sysfork.c @@ -5,6 +5,7 @@ #ifndef NO_FORK #include <reent.h> +#include <unistd.h> int _DEFUN_VOID (fork) diff --git a/newlib/libc/syscalls/sysfstat.c b/newlib/libc/syscalls/sysfstat.c index 864c0ab9c..7ce2c9dfe 100644 --- a/newlib/libc/syscalls/sysfstat.c +++ b/newlib/libc/syscalls/sysfstat.c @@ -1,6 +1,7 @@ /* connector for fstat */ #include <reent.h> +#include <sys/stat.h> #include <unistd.h> int diff --git a/newlib/libc/syscalls/sysgetpid.c b/newlib/libc/syscalls/sysgetpid.c index a7048acc7..f18783c75 100644 --- a/newlib/libc/syscalls/sysgetpid.c +++ b/newlib/libc/syscalls/sysgetpid.c @@ -1,6 +1,7 @@ /* connector for getpid */ #include <reent.h> +#include <unistd.h> int _DEFUN_VOID (getpid) diff --git a/newlib/libc/syscalls/sysgettod.c b/newlib/libc/syscalls/sysgettod.c index 273d19e59..9f25b052e 100644 --- a/newlib/libc/syscalls/sysgettod.c +++ b/newlib/libc/syscalls/sysgettod.c @@ -2,10 +2,7 @@ #include <reent.h> #include <sys/types.h> -#include <sys/times.h> - -struct timeval; -struct timezone; +#include <sys/time.h> int _DEFUN (gettimeofday, (ptimeval, ptimezone), diff --git a/newlib/libc/syscalls/syskill.c b/newlib/libc/syscalls/syskill.c index fb364f511..27f16be97 100644 --- a/newlib/libc/syscalls/syskill.c +++ b/newlib/libc/syscalls/syskill.c @@ -1,6 +1,7 @@ /* connector for kill */ #include <reent.h> +#include <signal.h> int _DEFUN (kill, (pid, sig), diff --git a/newlib/libc/syscalls/syslink.c b/newlib/libc/syscalls/syslink.c index 841684f46..327870769 100644 --- a/newlib/libc/syscalls/syslink.c +++ b/newlib/libc/syscalls/syslink.c @@ -1,11 +1,12 @@ /* connector for link */ #include <reent.h> +#include <unistd.h> int _DEFUN (link, (old, new), - char *old _AND - char *new) + _CONST char *old _AND + _CONST char *new) { return _link_r (_REENT, old, new); } diff --git a/newlib/libc/syscalls/sysstat.c b/newlib/libc/syscalls/sysstat.c index e93f61919..fdf029cef 100644 --- a/newlib/libc/syscalls/sysstat.c +++ b/newlib/libc/syscalls/sysstat.c @@ -1,11 +1,12 @@ /* connector for stat */ #include <reent.h> +#include <sys/stat.h> #include <unistd.h> int _DEFUN (stat, (file, pstat), - char *file _AND + _CONST char *file _AND struct stat *pstat) { return _stat_r (_REENT, file, pstat); diff --git a/newlib/libc/syscalls/sysunlink.c b/newlib/libc/syscalls/sysunlink.c index 1c5a69cfe..1399a80e5 100644 --- a/newlib/libc/syscalls/sysunlink.c +++ b/newlib/libc/syscalls/sysunlink.c @@ -1,10 +1,11 @@ /* connector for unlink */ #include <reent.h> +#include <unistd.h> int _DEFUN (unlink, (file), - char *file) + _CONST char *file) { return _unlink_r (_REENT, file); } diff --git a/newlib/libc/syscalls/syswait.c b/newlib/libc/syscalls/syswait.c index ec38a321f..070160342 100644 --- a/newlib/libc/syscalls/syswait.c +++ b/newlib/libc/syscalls/syswait.c @@ -1,8 +1,9 @@ /* connector for wait */ #include <reent.h> +#include <sys/wait.h> -int +pid_t _DEFUN (wait, (status), int *status) { diff --git a/newlib/libc/time/mktime.c b/newlib/libc/time/mktime.c index 938513233..d75d7cc85 100644 --- a/newlib/libc/time/mktime.c +++ b/newlib/libc/time/mktime.c @@ -67,8 +67,8 @@ static _CONST int _DAYS_BEFORE_MONTH[12] = #define _DAYS_IN_YEAR(year) (_ISLEAP(year) ? 366 : 365) static void -validate_structure (tim_p) - struct tm *tim_p; +_DEFUN(validate_structure, (tim_p), + struct tm *tim_p) { div_t res; int days_in_feb = 28; @@ -154,8 +154,8 @@ validate_structure (tim_p) } time_t -mktime (tim_p) - struct tm *tim_p; +_DEFUN(mktime, (tim_p), + struct tm *tim_p) { time_t tim = 0; long days = 0; |