From 08a0c88da5f52f43b4c995984a91257b5ce352dd Mon Sep 17 00:00:00 2001 From: Chris Sutcliffe Date: Wed, 3 Oct 2007 18:55:56 +0000 Subject: [PATCH] 2007-10-03 Bernd Becker * include/io.h (__finddata64_t, __wfinddata64_t): changed member 'size' from '_fsize_t' to '__int64' to be consistent with the other ...64 structures and the value set there is 8 bytes not 4. Add guard for both as the are only used by functions available from 6.1 on. * include/malloc.h (_HEAP_MAXREQ): Define. (_aligned_offset_recalloc): Define. (_aligned_recalloc()): Define. * include/math.h: fixed a typo in a comment. (atanhf): Fixed declaration. * include/wchar.h (__wfinddata64_t): changed member 'size' from '_fsize_t' to '__int64' to be consistent with the other ...64 structures and the value set there is 8 bytes not 4. Added guard as this function is only used by functions available from 6.1 on. * include/sys/stat.h: some members of 'stat' were declared with types with a prefixed underscore, while the ones without the underscore should have been used. Added guard to '__stat64' as it is only used by functions available from 6.1 on. Added the wide character versions of the exec()/spawn() family for completion (_stati64): changed the type of the 'st_mode' member from 'unsigned int' to '_mode_t' * include/sys/timeb.h (timeb, _timb): changed the type of the 'time' member from 'long' to 'time_t' (__timeb64): moved declaration of structure directly before the declaration of the function '_ftime64()', so it is guarded as well * include/sys/utime.h (__utimbuf64): moved declaration of structure directly before the declaration of the functions using it, so it is guarded as well --- winsup/mingw/ChangeLog | 35 +++++++++++++++++++++ winsup/mingw/include/io.h | 23 ++++++++------ winsup/mingw/include/malloc.h | 5 +++ winsup/mingw/include/math.h | 4 +-- winsup/mingw/include/sys/stat.h | 15 ++++----- winsup/mingw/include/sys/timeb.h | 20 ++++++------ winsup/mingw/include/sys/utime.h | 13 ++++---- winsup/mingw/include/wchar.h | 54 ++++++++++++++++++++++++-------- 8 files changed, 121 insertions(+), 48 deletions(-) diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 3bddce9f3..371278f20 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,38 @@ +2007-10-03 Bernd Becker + + * include/io.h (__finddata64_t, __wfinddata64_t): changed member 'size' + from '_fsize_t' to '__int64' to be consistent with the other ...64 + structures and the value set there is 8 bytes not 4. Add guard for both + as the are only used by functions available from 6.1 on. + + * include/malloc.h (_HEAP_MAXREQ): Define. + (_aligned_offset_recalloc): Define. + (_aligned_recalloc()): Define. + + * include/math.h: fixed a typo in a comment. + (atanhf): Fixed declaration. + + * include/wchar.h (__wfinddata64_t): changed member 'size' from '_fsize_t' + to '__int64' to be consistent with the other ...64 structures and the value + set there is 8 bytes not 4. Added guard as this function is only used by + functions available from 6.1 on. + + * include/sys/stat.h: some members of 'stat' were declared with types with + a prefixed underscore, while the ones without the underscore should have + been used. Added guard to '__stat64' as it is only used by functions + available from 6.1 on. Added the wide character versions of the + exec()/spawn() family for completion + (_stati64): changed the type of the 'st_mode' member from 'unsigned int' to + '_mode_t' + + * include/sys/timeb.h (timeb, _timb): changed the type of the 'time' member + from 'long' to 'time_t' + (__timeb64): moved declaration of structure directly before the declaration + of the function '_ftime64()', so it is guarded as well + + * include/sys/utime.h (__utimbuf64): moved declaration of structure directly + before the declaration of the functions using it, so it is guarded as well + 2007-09-24 David C. Daeschler * mingwex/gdtoa/mingw_snprintf.c (x_sprintf): Correct LEN_L typo in 'l' diff --git a/winsup/mingw/include/io.h b/winsup/mingw/include/io.h index e49a6b7e4..0d3c11045 100644 --- a/winsup/mingw/include/io.h +++ b/winsup/mingw/include/io.h @@ -1,4 +1,4 @@ -/* +/* * io.h * This file has no copyright assigned and is placed in the Public Domain. * This file is a part of the mingw-runtime package. @@ -50,7 +50,7 @@ typedef unsigned long _fsize_t; /* * The maximum length of a file name. You should use GetVolumeInformation * instead of this constant. But hey, this works. - * Also defined in stdio.h. + * Also defined in stdio.h. */ #ifndef FILENAME_MAX #define FILENAME_MAX (260) @@ -79,14 +79,17 @@ struct _finddatai64_t { char name[FILENAME_MAX]; }; +#if __MSVCRT_VERSION__ >= 0x0601 struct __finddata64_t { unsigned attrib; - __time64_t time_create; - __time64_t time_access; + __time64_t time_create; + __time64_t time_access; __time64_t time_write; - _fsize_t size; +/* 8 bytes are returned so it can't be _fsize_t */ + __int64 size; char name[FILENAME_MAX]; }; +#endif #ifndef _WFINDDATA_T_DEFINED struct _wfinddata_t { @@ -107,14 +110,17 @@ struct _wfinddatai64_t { wchar_t name[FILENAME_MAX]; }; +#if __MSVCRT_VERSION__ >= 0x0601 struct __wfinddata64_t { unsigned attrib; - __time64_t time_create; + __time64_t time_create; __time64_t time_access; __time64_t time_write; - _fsize_t size; +/* 8 bytes are returned so it can't be _fsize_t */ + __int64 size; wchar_t name[FILENAME_MAX]; }; +#endif #define _WFINDDATA_T_DEFINED #endif @@ -152,10 +158,9 @@ _CRTIMP __int64 __cdecl __MINGW_NOTHROW _telli64(int); _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findfirst64(const char*, struct __finddata64_t*); _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findnext64(intptr_t, struct __finddata64_t*); #endif /* __MSVCRT_VERSION__ >= 0x0601 */ - #ifndef __NO_MINGW_LFS __CRT_INLINE off64_t lseek64 (int, off64_t, int); -__CRT_INLINE off64_t lseek64 (int fd, off64_t offset, int whence) +__CRT_INLINE off64_t lseek64 (int fd, off64_t offset, int whence) { return _lseeki64(fd, (__int64) offset, whence); } diff --git a/winsup/mingw/include/malloc.h b/winsup/mingw/include/malloc.h index 9d2c33f07..5931b5e42 100644 --- a/winsup/mingw/include/malloc.h +++ b/winsup/mingw/include/malloc.h @@ -43,6 +43,9 @@ typedef struct _heapinfo #define _HEAPEND (-5) #define _HEAPBADPTR (-6) +/* maximum size of a user request for memory */ +#define _HEAP_MAXREQ 0xFFFFFFE0 + #ifdef __cplusplus extern "C" { #endif @@ -75,9 +78,11 @@ _CRTIMP void* __cdecl __MINGW_NOTHROW _expand (void*, size_t); #if __MSVCRT_VERSION__ >= 0x0700 _CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_offset_malloc(size_t, size_t, size_t); _CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_offset_realloc(void*, size_t, size_t, size_t); +_CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_offset_recalloc(void*, size_t, size_t, size_t, size_t); _CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_malloc (size_t, size_t); _CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_realloc (void*, size_t, size_t); +_CRTIMP void* __cdecl __MINGW_NOTHROW _aligned_recalloc(void*, size_t, size_t, size_t); _CRTIMP void __cdecl __MINGW_NOTHROW _aligned_free (void*); #endif /* __MSVCRT_VERSION__ >= 0x0700 */ diff --git a/winsup/mingw/include/math.h b/winsup/mingw/include/math.h index b03bc541f..788c2449a 100644 --- a/winsup/mingw/include/math.h +++ b/winsup/mingw/include/math.h @@ -346,7 +346,7 @@ __CRT_INLINE int __cdecl __fpclassifyl (long double x){ #define isinf(x) (fpclassify(x) == FP_INFINITE) /* 7.12.3.4 */ -/* We don't need to worry about trucation here: +/* We don't need to worry about truncation here: A NaN stays a NaN. */ __CRT_INLINE int __cdecl __isnan (double _x) @@ -455,7 +455,7 @@ extern long double __cdecl asinhl (long double); /* 7.12.5.3 */ extern double __cdecl atanh (double); -extern float __cdecl atanf (float); +extern float __cdecl atanhf (float); extern long double __cdecl atanhl (long double); /* Exponentials and logarithms */ diff --git a/winsup/mingw/include/sys/stat.h b/winsup/mingw/include/sys/stat.h index 30f9a63c4..3bd462714 100644 --- a/winsup/mingw/include/sys/stat.h +++ b/winsup/mingw/include/sys/stat.h @@ -103,14 +103,14 @@ struct _stat /* NOTE: Must be the same as _stat above. */ struct stat { - _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ - _ino_t st_ino; /* Always zero ? */ - _mode_t st_mode; /* See above constants */ + dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ + ino_t st_ino; /* Always zero ? */ + mode_t st_mode; /* See above constants */ short st_nlink; /* Number of links. */ short st_uid; /* User: Maybe significant on NT ? */ short st_gid; /* Group: Ditto */ - _dev_t st_rdev; /* Seems useless (not even filled in) */ - _off_t st_size; /* File size in bytes */ + dev_t st_rdev; /* Seems useless (not even filled in) */ + off_t st_size; /* File size in bytes */ time_t st_atime; /* Accessed date (always 00:00 hrs local * on FAT) */ time_t st_mtime; /* Modified time */ @@ -122,7 +122,7 @@ struct stat struct _stati64 { _dev_t st_dev; _ino_t st_ino; - unsigned short st_mode; + _mode_t st_mode; short st_nlink; short st_uid; short st_gid; @@ -132,7 +132,7 @@ struct _stati64 { time_t st_mtime; time_t st_ctime; }; - +#if __MSVCRT_VERSION__ >= 0x0601 struct __stat64 { _dev_t st_dev; @@ -147,6 +147,7 @@ struct __stat64 __time64_t st_mtime; __time64_t st_ctime; }; +#endif /* __MSVCRT_VERSION__ */ #endif /* __MSVCRT__ */ #define _STAT_DEFINED #endif /* _STAT_DEFINED */ diff --git a/winsup/mingw/include/sys/timeb.h b/winsup/mingw/include/sys/timeb.h index 9e9308c5e..24af3673f 100644 --- a/winsup/mingw/include/sys/timeb.h +++ b/winsup/mingw/include/sys/timeb.h @@ -22,7 +22,7 @@ */ struct _timeb { - long time; + time_t time; short millitm; short timezone; short dstflag; @@ -34,21 +34,13 @@ struct _timeb */ struct timeb { - long time; + time_t time; short millitm; short timezone; short dstflag; }; #endif -struct __timeb64 -{ - __time64_t time; - short millitm; - short timezone; - short dstflag; -}; - #ifdef __cplusplus extern "C" { #endif @@ -62,6 +54,14 @@ _CRTIMP void __cdecl __MINGW_NOTHROW ftime (struct timeb*); /* This requires newer versions of msvcrt.dll (6.10 or higher). */ #if __MSVCRT_VERSION__ >= 0x0601 +struct __timeb64 +{ + __time64_t time; + short millitm; + short timezone; + short dstflag; +}; + _CRTIMP void __cdecl __MINGW_NOTHROW _ftime64 (struct __timeb64*); #endif /* __MSVCRT_VERSION__ >= 0x0601 */ diff --git a/winsup/mingw/include/sys/utime.h b/winsup/mingw/include/sys/utime.h index 9c7ac0a53..b44479256 100644 --- a/winsup/mingw/include/sys/utime.h +++ b/winsup/mingw/include/sys/utime.h @@ -41,13 +41,6 @@ struct utimbuf }; #endif /* Not _NO_OLDNAMES */ -struct __utimbuf64 -{ - __time64_t actime; - __time64_t modtime; -}; - - #ifdef __cplusplus extern "C" { #endif @@ -68,6 +61,12 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _wutime (const wchar_t*, struct _utimbuf*); /* These require newer versions of msvcrt.dll (6.10 or higher). */ #if __MSVCRT_VERSION__ >= 0x0601 +struct __utimbuf64 +{ + __time64_t actime; + __time64_t modtime; +}; + _CRTIMP int __cdecl __MINGW_NOTHROW _utime64 (const char*, struct __utimbuf64*); _CRTIMP int __cdecl __MINGW_NOTHROW _wutime64 (const wchar_t*, struct __utimbuf64*); _CRTIMP int __cdecl __MINGW_NOTHROW _futime64 (int, struct __utimbuf64*); diff --git a/winsup/mingw/include/wchar.h b/winsup/mingw/include/wchar.h index 2e86c766e..007994669 100644 --- a/winsup/mingw/include/wchar.h +++ b/winsup/mingw/include/wchar.h @@ -59,7 +59,7 @@ #ifndef RC_INVOKED -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -115,7 +115,7 @@ _CRTIMP wint_t __cdecl __MINGW_NOTHROW fgetwc (FILE*); _CRTIMP wint_t __cdecl __MINGW_NOTHROW fputwc (wchar_t, FILE*); _CRTIMP wint_t __cdecl __MINGW_NOTHROW ungetwc (wchar_t, FILE*); -#ifdef __MSVCRT__ +#ifdef __MSVCRT__ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW fgetws (wchar_t*, int, FILE*); _CRTIMP int __cdecl __MINGW_NOTHROW fputws (const wchar_t*, FILE*); _CRTIMP wint_t __cdecl __MINGW_NOTHROW getwc (FILE*); @@ -152,6 +152,7 @@ int __cdecl __MINGW_NOTHROW vswscanf (const wchar_t * __restrict__, #define _WSTDIO_DEFINED #endif /* _WSTDIO_DEFINED */ + #ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */ _CRTIMP long __cdecl __MINGW_NOTHROW wcstol (const wchar_t*, wchar_t**, int); _CRTIMP unsigned long __cdecl __MINGW_NOTHROW wcstoul (const wchar_t*, wchar_t**, int); @@ -187,7 +188,7 @@ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime64 (const __time64_t*); #endif /* __STRICT_ANSI__ */ _CRTIMP size_t __cdecl __MINGW_NOTHROW wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*); #define _WTIME_DEFINED -#endif /* _WTIME_DEFINED */ +#endif /* _WTIME_DEFINED */ #ifndef _WSTRING_DEFINED @@ -288,7 +289,7 @@ int __cdecl __MINGW_NOTHROW wctob(wint_t); #ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */ __CRT_INLINE int __cdecl __MINGW_NOTHROW fwide(FILE* __UNUSED_PARAM(stream), int __UNUSED_PARAM(mode)) - {return -1;} /* limited to byte orientation */ + {return -1;} /* limited to byte orientation */ __CRT_INLINE int __cdecl __MINGW_NOTHROW mbsinit(const mbstate_t* __UNUSED_PARAM(ps)) {return 1;} wchar_t* __cdecl __MINGW_NOTHROW wmemset(wchar_t *, wchar_t, size_t); @@ -329,14 +330,17 @@ struct _wfinddatai64_t { __int64 size; wchar_t name[260]; }; +#if __MSVCRT_VERSION__ >= 0x0601 struct __wfinddata64_t { unsigned attrib; - __time64_t time_create; + __time64_t time_create; __time64_t time_access; __time64_t time_write; - _fsize_t size; +/* 8 bytes are returned so it can't be _fsize_t */ + __int64 size; wchar_t name[260]; }; +#endif #define _WFINDDATA_T_DEFINED #endif @@ -367,7 +371,7 @@ _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindnext64(intptr_t, struct __wfindda #ifndef _WDIRECT_DEFINED /* Also in direct.h */ -#ifdef __MSVCRT__ +#ifdef __MSVCRT__ _CRTIMP int __cdecl __MINGW_NOTHROW _wchdir (const wchar_t*); _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetcwd (wchar_t*, int); _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetdcwd (int, wchar_t*, int); @@ -405,14 +409,14 @@ struct _stat /* NOTE: Must be the same as _stat above. */ struct stat { - _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ - _ino_t st_ino; /* Always zero ? */ - _mode_t st_mode; /* See above constants */ + dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ + ino_t st_ino; /* Always zero ? */ + mode_t st_mode; /* See above constants */ short st_nlink; /* Number of links. */ short st_uid; /* User: Maybe significant on NT ? */ short st_gid; /* Group: Ditto */ - _dev_t st_rdev; /* Seems useless (not even filled in) */ - _off_t st_size; /* File size in bytes */ + dev_t st_rdev; /* Seems useless (not even filled in) */ + off_t st_size; /* File size in bytes */ time_t st_atime; /* Accessed date (always 00:00 hrs local * on FAT) */ time_t st_mtime; /* Modified time */ @@ -433,8 +437,9 @@ struct _stati64 { time_t st_atime; time_t st_mtime; time_t st_ctime; - }; +}; +#if __MSVCRT_VERSION__ >= 0x0601 struct __stat64 { _dev_t st_dev; @@ -449,6 +454,7 @@ struct __stat64 __time64_t st_mtime; __time64_t st_ctime; }; +#endif /* __MSVCRT_VERSION__ */ #endif /* __MSVCRT__ */ #define _STAT_DEFINED #endif /* _STAT_DEFINED */ @@ -472,6 +478,28 @@ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wsetlocale (int, const wchar_t*); #endif /* not __STRICT_ANSI__ */ +#ifndef _WPROCESS_DEFINED /* also declared in process.h */ +_CRTIMP int __cdecl __MINGW_NOTHROW _wexecl (const wchar_t*, const wchar_t*, ...); +_CRTIMP int __cdecl __MINGW_NOTHROW _wexecle (const wchar_t*, const wchar_t*, ...); +_CRTIMP int __cdecl __MINGW_NOTHROW _wexeclp (const wchar_t*, const wchar_t*, ...); +_CRTIMP int __cdecl __MINGW_NOTHROW _wexeclpe (const wchar_t*, const wchar_t*, ...); +_CRTIMP int __cdecl __MINGW_NOTHROW _wexecv (const wchar_t*, const wchar_t* const*); +_CRTIMP int __cdecl __MINGW_NOTHROW _wexecve (const wchar_t*, const wchar_t* const*, const wchar_t* const*); +_CRTIMP int __cdecl __MINGW_NOTHROW _wexecvp (const wchar_t*, const wchar_t* const*); +_CRTIMP int __cdecl __MINGW_NOTHROW _wexecvpe (const wchar_t*, const wchar_t* const*, const wchar_t* const*); + +_CRTIMP int __cdecl __MINGW_NOTHROW _wspawnl (int, const wchar_t*, const wchar_t*, ...); +_CRTIMP int __cdecl __MINGW_NOTHROW _wspawnle (int, const wchar_t*, const wchar_t*, ...); +_CRTIMP int __cdecl __MINGW_NOTHROW _wspawnlp (int, const wchar_t*, const wchar_t*, ...); +_CRTIMP int __cdecl __MINGW_NOTHROW _wspawnlpe (int, const wchar_t*, const wchar_t*, ...); +_CRTIMP int __cdecl __MINGW_NOTHROW _wspawnv (int, const wchar_t*, const wchar_t* const*); +_CRTIMP int __cdecl __MINGW_NOTHROW _wspawnve (int, const wchar_t*, const wchar_t* const*, const wchar_t* const*); +_CRTIMP int __cdecl __MINGW_NOTHROW _wspawnvp (int, const wchar_t*, const wchar_t* const*); +_CRTIMP int __cdecl __MINGW_NOTHROW _wspawnvpe (int, const wchar_t*, const wchar_t* const*, const wchar_t* const*); + +#define _WPROCESS_DEFINED +#endif + #ifdef __cplusplus } /* end of extern "C" */ #endif -- 2.43.5