Add POSIX fstat, stat, and wstat to crt. Put inline code of stat into crt. git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@105 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-crt/ChangeLog b/mingw-w64-crt/ChangeLog index fe436aa..6dc888c 100755 --- a/mingw-w64-crt/ChangeLog +++ b/mingw-w64-crt/ChangeLog
@@ -1,3 +1,7 @@ +2007-10-09 Kai Tietz <kai.tietz@onevision.com> + + * _fstat64i32.c,_fwstat64i32.c: New. + 2007-10-05 zhou drangon <drangon.mail@gmail.com> * misc/spawnv.c: Corrected mode argument.
diff --git a/mingw-w64-crt/Makefile b/mingw-w64-crt/Makefile index 7fd5176..0e055bf 100755 --- a/mingw-w64-crt/Makefile +++ b/mingw-w64-crt/Makefile
@@ -169,7 +169,8 @@ STDIO_OBJS = \ fopen64.o fseeko64.o ftello64.o lseek64.o \ snprintf.o vsnprintf.o snwprintf.o vsnwprintf.o \ - vfscanf.o vfwscanf.o vscanf.o vsscanf.o vswscanf.o vwscanf.o + vfscanf.o vfwscanf.o vscanf.o vsscanf.o vswscanf.o vwscanf.o \ + _fstat64i32.o _fwstat64i32.o STDLIB_STUB_OBJS = \ lltoa.o ulltoa.o \
diff --git a/mingw-w64-crt/stdio/_fstat64i32.c b/mingw-w64-crt/stdio/_fstat64i32.c new file mode 100755 index 0000000..0235fd5 --- /dev/null +++ b/mingw-w64-crt/stdio/_fstat64i32.c
@@ -0,0 +1,59 @@ +#include <sys/stat.h> + +int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat) +{ + struct _stat64 st; + int ret=_fstat64(_FileDes,&st); + _Stat->st_dev=st.st_dev; + _Stat->st_ino=st.st_ino; + _Stat->st_mode=st.st_mode; + _Stat->st_nlink=st.st_nlink; + _Stat->st_uid=st.st_uid; + _Stat->st_gid=st.st_gid; + _Stat->st_rdev=st.st_rdev; + _Stat->st_size=(_off_t) st.st_size; + _Stat->st_atime=st.st_atime; + _Stat->st_mtime=st.st_mtime; + _Stat->st_ctime=st.st_ctime; + return ret; +} + +int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat) +{ + struct _stat64 st; + int ret=_stat64(_Name,&st); + _Stat->st_dev=st.st_dev; + _Stat->st_ino=st.st_ino; + _Stat->st_mode=st.st_mode; + _Stat->st_nlink=st.st_nlink; + _Stat->st_uid=st.st_uid; + _Stat->st_gid=st.st_gid; + _Stat->st_rdev=st.st_rdev; + _Stat->st_size=(_off_t) st.st_size; + _Stat->st_atime=st.st_atime; + _Stat->st_mtime=st.st_mtime; + _Stat->st_ctime=st.st_ctime; + return ret; +} + +#ifdef _USE_32BIT_TIME_T +int __cdecl fstat(int _Desc,struct stat *_Stat) +{ + return _fstat32(_Desc,(struct _stat32 *)_Stat); +} + +int __cdecl stat(const char *_Filename,struct stat *_Stat) +{ + return _stat32(_Filename,(struct _stat32 *)_Stat); +} +#else +int __cdecl fstat(int _Desc,struct stat *_Stat) +{ + return _fstat64i32(_Desc,(struct _stat64i32 *)_Stat); +} + +int __cdecl stat(const char *_Filename,struct stat *_Stat) +{ + return _stat64i32(_Filename,(struct _stat64i32 *)_Stat); +} +#endif
diff --git a/mingw-w64-crt/stdio/_fwstat64i32.c b/mingw-w64-crt/stdio/_fwstat64i32.c new file mode 100755 index 0000000..b5ee9f9 --- /dev/null +++ b/mingw-w64-crt/stdio/_fwstat64i32.c
@@ -0,0 +1,31 @@ +#include <sys/stat.h> + +int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat) +{ + struct _stat64 st; + int ret=_wstat64(_Name,&st); + _Stat->st_dev=st.st_dev; + _Stat->st_ino=st.st_ino; + _Stat->st_mode=st.st_mode; + _Stat->st_nlink=st.st_nlink; + _Stat->st_uid=st.st_uid; + _Stat->st_gid=st.st_gid; + _Stat->st_rdev=st.st_rdev; + _Stat->st_size=(_off_t) st.st_size; + _Stat->st_atime=st.st_atime; + _Stat->st_mtime=st.st_mtime; + _Stat->st_ctime=st.st_ctime; + return ret; +} + +#ifdef _USE_32BIT_TIME_T +int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat) +{ + return _wstat32(_Filename,(struct _stat32 *)_Stat); +} +#else +int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat) +{ + return _wstat64i32(_Filename,(struct _stat64i32 *)_Stat); +} +#endif
diff --git a/mingw-w64-headers/include/ChangeLog b/mingw-w64-headers/include/ChangeLog index 31c958e..0e77f1a 100755 --- a/mingw-w64-headers/include/ChangeLog +++ b/mingw-w64-headers/include/ChangeLog
@@ -1,3 +1,7 @@ +2007-10-09 Kai Tietz <kai.tietz@onevision.com> + + * sys/stat.h, wstat.h: Changed POSIX prototypes. + 2007-10-08 Kai Tietz <kai.tietz@onevision.com> * winsock.h, winsock2.h: Make SOCKET definition signed.
diff --git a/mingw-w64-headers/include/sys/stat.h b/mingw-w64-headers/include/sys/stat.h index 17fe5ca..604c61b 100755 --- a/mingw-w64-headers/include/sys/stat.h +++ b/mingw-w64-headers/include/sys/stat.h
@@ -171,6 +171,7 @@ #if _INTEGRAL_MAX_BITS >= 64 _CRTIMP int __cdecl _fstat64(int _FileDes,struct _stat64 *_Stat); _CRTIMP int __cdecl _fstat32i64(int _FileDes,struct _stat32i64 *_Stat); + int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat); __CRT_INLINE int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat) { struct _stat64 st; @@ -190,6 +191,7 @@ } _CRTIMP int __cdecl _stat64(const char *_Name,struct _stat64 *_Stat); _CRTIMP int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat); + int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat); __CRT_INLINE int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat) { struct _stat64 st; @@ -214,7 +216,7 @@ _CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat); #if _INTEGRAL_MAX_BITS >= 64 _CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat); - _CRTIMP int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); + int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat); #endif #endif @@ -251,6 +253,9 @@ #endif #if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) +int __cdecl stat(const char *_Filename,struct stat *_Stat); +int __cdecl fstat(int _Desc,struct stat *_Stat); +int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat); #ifdef _USE_32BIT_TIME_T __CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) { return _fstat32(_Desc,(struct _stat32 *)_Stat);
diff --git a/mingw-w64-headers/include/wchar.h b/mingw-w64-headers/include/wchar.h index c307bae..d9beae7 100755 --- a/mingw-w64-headers/include/wchar.h +++ b/mingw-w64-headers/include/wchar.h
@@ -492,7 +492,7 @@ _CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat); #if _INTEGRAL_MAX_BITS >= 64 _CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat); - _CRTIMP int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); + int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat); #endif #endif