From 3f1ed52d8b37bcf445839928355523c8ac0fa400 Mon Sep 17 00:00:00 2001 From: Marcus Meissner <marcus@jet.franken.de> Date: Mon, 14 May 2001 20:09:37 +0000 Subject: [PATCH] Implemented 64bit file size handling. Removed several unneeded sys/stat.h includes. --- configure | 202 ++++++++++++++++++++++++++++----------- configure.in | 42 ++++++++ dlls/shell32/shelllink.c | 1 - dlls/winaspi/aspi.c | 1 - dlls/winaspi/winaspi16.c | 1 - dlls/winaspi/winaspi32.c | 1 - dlls/winedos/dosvm.c | 1 - dlls/wineps/afm.c | 1 - dlls/wininet/ftp.c | 1 - files/file.c | 36 ++++--- graphics/x11drv/xfont.c | 2 - include/acconfig.h | 6 ++ include/config.h.in | 21 ++++ include/wine/port.h | 54 ++++++++++- library/loader.c | 2 +- library/port.c | 88 ++++++++++++++++- loader/dos/dosmod.c | 1 - loader/ne/resource.c | 1 - loader/ne/segment.c | 1 - msdos/int13.c | 3 +- msdos/int21.c | 1 - server/console.c | 4 - server/file.c | 58 +++++------ server/pipe.c | 1 - server/serial.c | 1 - server/sock.c | 1 - win32/device.c | 7 -- win32/file.c | 5 +- windows/clipboard.c | 1 - 29 files changed, 404 insertions(+), 141 deletions(-) diff --git a/configure b/configure index def03ed6e37..f4480f2127c 100755 --- a/configure +++ b/configure @@ -5792,6 +5792,8 @@ for ac_func in \ ecvt \ finite \ fpclass \ + fstat64 \ + ftruncate64 \ getnetbyaddr \ getnetbyname \ getpagesize \ @@ -5801,7 +5803,9 @@ for ac_func in \ getservbyport \ getsockopt \ inet_network \ + lseek64 \ lstat \ + lstat64 \ memmove \ mmap \ rfork \ @@ -5809,6 +5813,7 @@ for ac_func in \ sendmsg \ settimeofday \ sigaltstack \ + stat64 \ statfs \ strcasecmp \ strerror \ @@ -5822,12 +5827,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5826: checking for $ac_func" >&5 +echo "configure:5831: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5831 "configure" +#line 5836 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5850,7 +5855,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5932,17 +5937,17 @@ for ac_hdr in \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5936: checking for $ac_hdr" >&5 +echo "configure:5941: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5941 "configure" +#line 5946 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5946: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5951: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5969,12 +5974,12 @@ fi done echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:5973: checking whether stat file-mode macros are broken" >&5 +echo "configure:5978: checking whether stat file-mode macros are broken" >&5 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5978 "configure" +#line 5983 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -6027,12 +6032,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:6031: checking for working const" >&5 +echo "configure:6036: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6036 "configure" +#line 6041 "configure" #include "confdefs.h" int main() { @@ -6081,7 +6086,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:6085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6090: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -6102,21 +6107,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:6106: checking for inline" >&5 +echo "configure:6111: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 6113 "configure" +#line 6118 "configure" #include "confdefs.h" int main() { } int $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:6120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -6142,12 +6147,12 @@ EOF esac echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:6146: checking for ANSI C header files" >&5 +echo "configure:6151: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6151 "configure" +#line 6156 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -6155,7 +6160,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6159: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6164: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6172,7 +6177,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 6176 "configure" +#line 6181 "configure" #include "confdefs.h" #include <string.h> EOF @@ -6190,7 +6195,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 6194 "configure" +#line 6199 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -6211,7 +6216,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 6215 "configure" +#line 6220 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -6222,7 +6227,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:6226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -6246,12 +6251,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:6250: checking for size_t" >&5 +echo "configure:6255: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6255 "configure" +#line 6260 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -6279,7 +6284,7 @@ EOF fi echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:6283: checking size of long long" >&5 +echo "configure:6288: checking size of long long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6287,7 +6292,7 @@ else ac_cv_sizeof_long_long=0 else cat > conftest.$ac_ext <<EOF -#line 6291 "configure" +#line 6296 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -6298,7 +6303,7 @@ main() exit(0); } EOF -if { (eval echo configure:6302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_long=`cat conftestval` else @@ -6318,13 +6323,94 @@ EOF +echo $ac_n "checking "for off64_t"""... $ac_c" 1>&6 +echo "configure:6328: checking "for off64_t"" >&5 +if eval "test \"`echo '$''{'wine_cv_off64_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6333 "configure" +#include "confdefs.h" + + #define _LARGEFILE64_SOURCE + #include <sys/types.h> + +int main() { + + off64_t testoffset; + +; return 0; } +EOF +if { (eval echo configure:6345: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + wine_cv_off64_t="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + wine_cv_off64_t="no" +fi +rm -f conftest* + +fi + +echo "$ac_t""$wine_cv_off64_t" 1>&6 + if test "$wine_cv_off64_t" = "yes" + then + cat >> confdefs.h <<\EOF +#define HAVE_OFF64_T 1 +EOF + + fi + +echo $ac_n "checking "for struct stat64"""... $ac_c" 1>&6 +echo "configure:6368: checking "for struct stat64"" >&5 +if eval "test \"`echo '$''{'wine_cv_struct_stat64'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6373 "configure" +#include "confdefs.h" + + #define _LARGEFILE64_SOURCE + #include <sys/types.h> + #include <sys/stat.h> + +int main() { + + struct stat64 tst64; + +; return 0; } +EOF +if { (eval echo configure:6386: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + wine_cv_struct_stat64="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + wine_cv_struct_stat64="no" +fi +rm -f conftest* + +fi + +echo "$ac_t""$wine_cv_struct_stat64" 1>&6 + if test "$wine_cv_struct_stat64" = "yes" + then + cat >> confdefs.h <<\EOF +#define HAVE_STRUCT_STAT64 1 +EOF + + fi + echo $ac_n "checking "whether linux/input.h is for real"""... $ac_c" 1>&6 -echo "configure:6323: checking "whether linux/input.h is for real"" >&5 +echo "configure:6409: checking "whether linux/input.h is for real"" >&5 if eval "test \"`echo '$''{'wine_cv_linux_input_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6328 "configure" +#line 6414 "configure" #include "confdefs.h" #include <linux/input.h> @@ -6337,7 +6423,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6341: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6427: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wine_cv_linux_input_h=yes else @@ -6361,12 +6447,12 @@ EOF echo $ac_n "checking "whether we can use re-entrant gethostbyname_r Linux style"""... $ac_c" 1>&6 -echo "configure:6365: checking "whether we can use re-entrant gethostbyname_r Linux style"" >&5 +echo "configure:6451: checking "whether we can use re-entrant gethostbyname_r Linux style"" >&5 if eval "test \"`echo '$''{'wine_cv_linux_gethostbyname_r_6'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6370 "configure" +#line 6456 "configure" #include "confdefs.h" #include <netdb.h> @@ -6387,7 +6473,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6391: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6477: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wine_cv_linux_gethostbyname_r_6=yes else @@ -6413,12 +6499,12 @@ EOF if test "$ac_cv_header_linux_joystick_h" = "yes" then echo $ac_n "checking "whether linux/joystick.h uses the Linux 2.2+ API"""... $ac_c" 1>&6 -echo "configure:6417: checking "whether linux/joystick.h uses the Linux 2.2+ API"" >&5 +echo "configure:6503: checking "whether linux/joystick.h uses the Linux 2.2+ API"" >&5 if eval "test \"`echo '$''{'wine_cv_linux_joystick_22_api'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6422 "configure" +#line 6508 "configure" #include "confdefs.h" #include <sys/ioctl.h> @@ -6433,7 +6519,7 @@ int main() { /*empty*/ ; return 0; } EOF -if { (eval echo configure:6437: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6523: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wine_cv_linux_joystick_22_api=yes else @@ -6460,12 +6546,12 @@ fi if test "$ac_cv_header_sys_vfs_h" = "yes" then echo $ac_n "checking "whether sys/vfs.h defines statfs"""... $ac_c" 1>&6 -echo "configure:6464: checking "whether sys/vfs.h defines statfs"" >&5 +echo "configure:6550: checking "whether sys/vfs.h defines statfs"" >&5 if eval "test \"`echo '$''{'wine_cv_sys_vfs_has_statfs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6469 "configure" +#line 6555 "configure" #include "confdefs.h" #include <sys/types.h> @@ -6482,7 +6568,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6486: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wine_cv_sys_vfs_has_statfs=yes else @@ -6509,12 +6595,12 @@ fi if test "$ac_cv_header_sys_statfs_h" = "yes" then echo $ac_n "checking "whether sys/statfs.h defines statfs"""... $ac_c" 1>&6 -echo "configure:6513: checking "whether sys/statfs.h defines statfs"" >&5 +echo "configure:6599: checking "whether sys/statfs.h defines statfs"" >&5 if eval "test \"`echo '$''{'wine_cv_sys_statfs_has_statfs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6518 "configure" +#line 6604 "configure" #include "confdefs.h" #include <sys/types.h> @@ -6529,7 +6615,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wine_cv_sys_statfs_has_statfs=yes else @@ -6556,12 +6642,12 @@ fi if test "$ac_cv_header_sys_mount_h" = "yes" then echo $ac_n "checking "whether sys/mount.h defines statfs"""... $ac_c" 1>&6 -echo "configure:6560: checking "whether sys/mount.h defines statfs"" >&5 +echo "configure:6646: checking "whether sys/mount.h defines statfs"" >&5 if eval "test \"`echo '$''{'wine_cv_sys_mount_has_statfs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6565 "configure" +#line 6651 "configure" #include "confdefs.h" #include <sys/types.h> @@ -6576,7 +6662,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6580: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6666: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wine_cv_sys_mount_has_statfs=yes else @@ -6602,7 +6688,7 @@ fi echo $ac_n "checking "for statfs.f_bfree"""... $ac_c" 1>&6 -echo "configure:6606: checking "for statfs.f_bfree"" >&5 +echo "configure:6692: checking "for statfs.f_bfree"" >&5 if eval "test \"`echo '$''{'wine_cv_statfs_bfree'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6611,7 +6697,7 @@ else wine_cv_statfs_bfree=no else cat > conftest.$ac_ext <<EOF -#line 6615 "configure" +#line 6701 "configure" #include "confdefs.h" #include <sys/types.h> @@ -6638,7 +6724,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wine_cv_statfs_bfree=yes else @@ -6662,7 +6748,7 @@ EOF fi echo $ac_n "checking "for statfs.f_bavail"""... $ac_c" 1>&6 -echo "configure:6666: checking "for statfs.f_bavail"" >&5 +echo "configure:6752: checking "for statfs.f_bavail"" >&5 if eval "test \"`echo '$''{'wine_cv_statfs_bavail'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6671,7 +6757,7 @@ else wine_cv_statfs_bavail=no else cat > conftest.$ac_ext <<EOF -#line 6675 "configure" +#line 6761 "configure" #include "confdefs.h" #include <sys/types.h> @@ -6698,7 +6784,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6702: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* wine_cv_statfs_bavail=yes else @@ -6723,12 +6809,12 @@ fi echo $ac_n "checking "for msg_accrights in struct msghdr"""... $ac_c" 1>&6 -echo "configure:6727: checking "for msg_accrights in struct msghdr"" >&5 +echo "configure:6813: checking "for msg_accrights in struct msghdr"" >&5 if eval "test \"`echo '$''{'ac_cv_c_msg_accrights'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6732 "configure" +#line 6818 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/socket.h> @@ -6736,7 +6822,7 @@ int main() { struct msghdr hdr; hdr.msg_accrights=0 ; return 0; } EOF -if { (eval echo configure:6740: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6826: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_msg_accrights="yes" else @@ -6759,12 +6845,12 @@ fi echo $ac_n "checking "for sun_len in struct sockaddr_un"""... $ac_c" 1>&6 -echo "configure:6763: checking "for sun_len in struct sockaddr_un"" >&5 +echo "configure:6849: checking "for sun_len in struct sockaddr_un"" >&5 if eval "test \"`echo '$''{'ac_cv_c_sun_len'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6768 "configure" +#line 6854 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/socket.h> @@ -6773,7 +6859,7 @@ int main() { static struct sockaddr_un addr; addr.sun_len = 1 ; return 0; } EOF -if { (eval echo configure:6777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_sun_len="yes" else @@ -6796,12 +6882,12 @@ fi echo $ac_n "checking "whether we need to define __i386__"""... $ac_c" 1>&6 -echo "configure:6800: checking "whether we need to define __i386__"" >&5 +echo "configure:6886: checking "whether we need to define __i386__"" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_def_i386'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6805 "configure" +#line 6891 "configure" #include "confdefs.h" #if (defined(i386) || defined(__i386)) && !defined(__i386__) yes diff --git a/configure.in b/configure.in index 55ea2cf3783..56bbdb68e14 100644 --- a/configure.in +++ b/configure.in @@ -757,6 +757,8 @@ AC_CHECK_FUNCS(\ ecvt \ finite \ fpclass \ + fstat64 \ + ftruncate64 \ getnetbyaddr \ getnetbyname \ getpagesize \ @@ -766,7 +768,9 @@ AC_CHECK_FUNCS(\ getservbyport \ getsockopt \ inet_network \ + lseek64 \ lstat \ + lstat64 \ memmove \ mmap \ rfork \ @@ -774,6 +778,7 @@ AC_CHECK_FUNCS(\ sendmsg \ settimeofday \ sigaltstack \ + stat64 \ statfs \ strcasecmp \ strerror \ @@ -850,6 +855,43 @@ AC_C_INLINE() AC_TYPE_SIZE_T() AC_CHECK_SIZEOF(long long,0) +AC_CACHE_CHECK("for off64_t", + wine_cv_off64_t, + AC_TRY_COMPILE([ + #define _LARGEFILE64_SOURCE + #include <sys/types.h> + ],[ + off64_t testoffset; + ], + wine_cv_off64_t="yes", + wine_cv_off64_t="no", + wine_cv_off64_t="yes" + ) + ) + if test "$wine_cv_off64_t" = "yes" + then + AC_DEFINE(HAVE_OFF64_T) + fi + +AC_CACHE_CHECK("for struct stat64", + wine_cv_struct_stat64, + AC_TRY_COMPILE([ + #define _LARGEFILE64_SOURCE + #include <sys/types.h> + #include <sys/stat.h> + ],[ + struct stat64 tst64; + ], + wine_cv_struct_stat64="yes", + wine_cv_struct_stat64="no", + wine_cv_struct_stat64="yes" + ) + ) + if test "$wine_cv_struct_stat64" = "yes" + then + AC_DEFINE(HAVE_STRUCT_STAT64) + fi + AC_CACHE_CHECK("whether linux/input.h is for real", wine_cv_linux_input_h, AC_TRY_COMPILE([ diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index 27f1cd9fdd9..94d7e080e38 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -8,7 +8,6 @@ #include "config.h" #include <string.h> -#include <sys/stat.h> #include <stdio.h> #include <unistd.h> #include <errno.h> diff --git a/dlls/winaspi/aspi.c b/dlls/winaspi/aspi.c index 0c07182fcca..feb8bfaa1f1 100644 --- a/dlls/winaspi/aspi.c +++ b/dlls/winaspi/aspi.c @@ -25,7 +25,6 @@ HKEY_DYN_DATA */ #include <stdio.h> #include <sys/types.h> -#include <sys/stat.h> #include <sys/ioctl.h> #include <fcntl.h> #include <dirent.h> diff --git a/dlls/winaspi/winaspi16.c b/dlls/winaspi/winaspi16.c index dfad8ea96c7..d26151193ce 100644 --- a/dlls/winaspi/winaspi16.c +++ b/dlls/winaspi/winaspi16.c @@ -2,7 +2,6 @@ #include <stdlib.h> #include <sys/types.h> -#include <sys/stat.h> #include <errno.h> #include <fcntl.h> #include <memory.h> diff --git a/dlls/winaspi/winaspi32.c b/dlls/winaspi/winaspi32.c index 6c024a2df2f..6bd4ad09ddc 100644 --- a/dlls/winaspi/winaspi32.c +++ b/dlls/winaspi/winaspi32.c @@ -4,7 +4,6 @@ #include <stdlib.h> #include <stdio.h> #include <sys/types.h> -#include <sys/stat.h> #include <errno.h> #include <fcntl.h> #include <memory.h> diff --git a/dlls/winedos/dosvm.c b/dlls/winedos/dosvm.c index 6af6ca86ce4..87ba3a3d004 100644 --- a/dlls/winedos/dosvm.c +++ b/dlls/winedos/dosvm.c @@ -17,7 +17,6 @@ #include <unistd.h> #include <sys/time.h> #include <sys/types.h> -#include <sys/stat.h> #include "wine/winbase16.h" #include "wine/exception.h" diff --git a/dlls/wineps/afm.c b/dlls/wineps/afm.c index 8095e71071b..3bbfee69169 100644 --- a/dlls/wineps/afm.c +++ b/dlls/wineps/afm.c @@ -9,7 +9,6 @@ #include <string.h> #include <stdlib.h> /* qsort() & bsearch() */ #include <stdio.h> -#include <sys/stat.h> #include <dirent.h> #include <limits.h> /* INT_MIN */ #include <float.h> /* FLT_MAX */ diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index ea4604b0ba6..f9a0f67cc07 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -22,7 +22,6 @@ #ifdef HAVE_SYS_SOCKET_H # include <sys/socket.h> #endif -#include <sys/stat.h> #include <unistd.h> #include <time.h> #ifdef HAVE_NETINET_IN_SYSTM_H diff --git a/files/file.c b/files/file.c index 04e3bb7d48a..3fba2e30f4b 100644 --- a/files/file.c +++ b/files/file.c @@ -10,6 +10,7 @@ */ #include "config.h" +#include "wine/port.h" #include <assert.h> #include <ctype.h> @@ -36,7 +37,6 @@ #include "windef.h" #include "winbase.h" #include "wine/winbase16.h" -#include "wine/port.h" #include "drive.h" #include "file.h" #include "heap.h" @@ -491,7 +491,7 @@ HANDLE WINAPI CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing, * * Fill a file information from a struct stat. */ -static void FILE_FillInfo( struct stat *st, BY_HANDLE_FILE_INFORMATION *info ) +static void FILE_FillInfo( struct stat64 *st, BY_HANDLE_FILE_INFORMATION *info ) { if (S_ISDIR(st->st_mode)) info->dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; @@ -506,7 +506,11 @@ static void FILE_FillInfo( struct stat *st, BY_HANDLE_FILE_INFORMATION *info ) info->dwVolumeSerialNumber = 0; /* FIXME */ info->nFileSizeHigh = 0; - info->nFileSizeLow = S_ISDIR(st->st_mode) ? 0 : st->st_size; + info->nFileSizeLow = 0; + if (!S_ISDIR(st->st_mode)) { + info->nFileSizeHigh = st->st_size >> 32; + info->nFileSizeLow = st->st_size & 0xffffffff; + } info->nNumberOfLinks = st->st_nlink; info->nFileIndexHigh = 0; info->nFileIndexLow = st->st_ino; @@ -520,9 +524,9 @@ static void FILE_FillInfo( struct stat *st, BY_HANDLE_FILE_INFORMATION *info ) */ BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info ) { - struct stat st; + struct stat64 st; - if (lstat( unixName, &st ) == -1) + if (lstat64( unixName, &st ) == -1) { FILE_SetDosError(); return FALSE; @@ -532,7 +536,7 @@ BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info ) { /* do a "real" stat to find out about the type of the symlink destination */ - if (stat( unixName, &st ) == -1) + if (stat64( unixName, &st ) == -1) { FILE_SetDosError(); return FALSE; @@ -1644,17 +1648,8 @@ DWORD WINAPI SetFilePointer( HANDLE hFile, LONG distance, LONG *highword, { DWORD ret = 0xffffffff; - if (highword && - ((distance >= 0 && *highword != 0) || (distance < 0 && *highword != -1))) - { - FIXME("64-bit offsets not supported yet\n" - "SetFilePointer(%08x,%08lx,%08lx,%08lx)\n", - hFile,distance,*highword,method); - SetLastError( ERROR_INVALID_PARAMETER ); - return ret; - } - TRACE("handle %d offset %ld origin %ld\n", - hFile, distance, method ); + TRACE("handle %d offset %ld high %ld origin %ld\n", + hFile, distance, highword?*highword:0, method ); SERVER_START_REQ( set_file_pointer ) { @@ -2015,7 +2010,10 @@ BOOL WINAPI MoveFileExW( LPCWSTR fn1, LPCWSTR fn2, DWORD flag ) BOOL WINAPI MoveFileA( LPCSTR fn1, LPCSTR fn2 ) { DOS_FULL_NAME full_name1, full_name2; - struct stat fstat; + /* Even though we do not need the size, stat will fail for large files, + * so we need to use stat64 here. */ + struct stat64 fstat; + TRACE("(%s,%s)\n", fn1, fn2 ); @@ -2035,7 +2033,7 @@ BOOL WINAPI MoveFileA( LPCSTR fn1, LPCSTR fn2 ) } else return TRUE; else /*copy */ { - if (stat( full_name1.long_name, &fstat )) + if (stat64( full_name1.long_name, &fstat )) { WARN("Invalid source file %s\n", full_name1.long_name); diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index d58f3ec1f38..1d4e6de52f8 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -19,10 +19,8 @@ #include <string.h> #include <unistd.h> #include <sys/types.h> -#include <sys/stat.h> #include <fcntl.h> #include <math.h> -#include <assert.h> #include "windef.h" #include "wingdi.h" diff --git a/include/acconfig.h b/include/acconfig.h index 1d4ae87728e..c17452b5cb4 100644 --- a/include/acconfig.h +++ b/include/acconfig.h @@ -122,3 +122,9 @@ /* Define if we have CUPS */ #undef HAVE_CUPS + +/* Define if we have 64 bit file offsets */ +#undef HAVE_OFF64_T + +/* Define if we have struct stat64 */ +#undef HAVE_STRUCT_STAT64 diff --git a/include/config.h.in b/include/config.h.in index 44d6db260a8..eee0c58a18b 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -154,6 +154,12 @@ /* Define if we have CUPS */ #undef HAVE_CUPS +/* Define if we have 64 bit file offsets */ +#undef HAVE_OFF64_T + +/* Define if we have struct stat64 */ +#undef HAVE_STRUCT_STAT64 + /* The number of bytes in a long long. */ #undef SIZEOF_LONG_LONG @@ -181,6 +187,12 @@ /* Define if you have the fpclass function. */ #undef HAVE_FPCLASS +/* Define if you have the fstat64 function. */ +#undef HAVE_FSTAT64 + +/* Define if you have the ftruncate64 function. */ +#undef HAVE_FTRUNCATE64 + /* Define if you have the gethostbyname function. */ #undef HAVE_GETHOSTBYNAME @@ -214,9 +226,15 @@ /* Define if you have the iswalnum function. */ #undef HAVE_ISWALNUM +/* Define if you have the lseek64 function. */ +#undef HAVE_LSEEK64 + /* Define if you have the lstat function. */ #undef HAVE_LSTAT +/* Define if you have the lstat64 function. */ +#undef HAVE_LSTAT64 + /* Define if you have the memmove function. */ #undef HAVE_MEMMOVE @@ -241,6 +259,9 @@ /* Define if you have the sigaltstack function. */ #undef HAVE_SIGALTSTACK +/* Define if you have the stat64 function. */ +#undef HAVE_STAT64 + /* Define if you have the statfs function. */ #undef HAVE_STATFS diff --git a/include/wine/port.h b/include/wine/port.h index de6d588e8fb..4bbeb9c755d 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -6,9 +6,10 @@ #ifndef __WINE_WINE_PORT_H #define __WINE_WINE_PORT_H +#define _LARGEFILE64_SOURCE /* for glibc 64 bit file functions */ + #include "config.h" #include "winnt.h" - #include <sys/types.h> #include <sys/time.h> #include <sys/stat.h> @@ -131,6 +132,57 @@ int lstat(const char *file_name, struct stat *buf); #define S_ISLNK(mod) (0) #endif /* S_ISLNK */ +#ifndef HAVE_OFF64_T +# if SIZEOF_LONG_LONG > 0 +typedef long long off64_t; +# else +typedef long off64_t; +# endif +#endif + +#ifndef HAVE_STRUCT_STAT64 +/* This does not convert all struct members to 64bit, only size. */ +struct stat64 { + dev_t st_dev; /* device */ + ino_t st_ino; /* inode */ + mode_t st_mode; /* protection */ + nlink_t st_nlink; /* number of hard links */ + uid_t st_uid; /* user ID of owner */ + gid_t st_gid; /* group ID of owner */ + dev_t st_rdev; /* device type (if inode device) */ + off64_t st_size; /* total size, in bytes */ + unsigned long st_blksize; /* blocksize for filesystem I/O */ + unsigned long st_blocks; /* number of blocks allocated */ + time_t st_atime; /* time of last access */ + time_t st_mtime; /* time of last modification */ + time_t st_ctime; /* time of last change */ +}; +#endif + +#ifndef HAVE_LSEEK64 +extern off64_t lseek64(int fildes, off64_t offset, int whence); +#endif + +#ifndef HAVE_STAT64 +extern int stat64(const char *file_name, struct stat64 *buf); +#endif + +#ifndef HAVE_LSTAT64 +extern int lstat64(const char *file_name, struct stat64 *buf); +#endif + +#ifndef HAVE_FSTAT64 +extern int fstat64(int fd, struct stat64 *buf); +#endif + +#ifndef HAVE_FTRUNCATE64 +extern int ftruncate64(int fd, off64_t offset); +#endif + +#ifndef O_LARGEFILE +# define O_LARGEFILE 0 +#endif + extern void *wine_dlopen( const char *filename, int flag, char *error, int errorsize ); extern void *wine_dlsym( void *handle, const char *symbol, char *error, int errorsize ); extern int wine_dlclose( void *handle, char *error, int errorsize ); diff --git a/library/loader.c b/library/loader.c index 1b3341157ce..93095462640 100644 --- a/library/loader.c +++ b/library/loader.c @@ -5,6 +5,7 @@ */ #include "config.h" +#include "wine/port.h" #include <assert.h> #include <ctype.h> @@ -18,7 +19,6 @@ #include "winnt.h" #include "wine/library.h" -#include "wine/port.h" #define MAX_DLLS 100 diff --git a/library/port.c b/library/port.c index 004f8538401..c32a714bf41 100644 --- a/library/port.c +++ b/library/port.c @@ -5,6 +5,7 @@ */ #include "config.h" +#include "wine/port.h" #ifdef __BEOS__ #include <be/kernel/fs_info.h> @@ -43,7 +44,6 @@ # include <dlfcn.h> #endif -#include "wine/port.h" /*********************************************************************** * usleep @@ -389,7 +389,93 @@ int lstat(const char *file_name, struct stat *buf) } #endif /* HAVE_LSTAT */ +static void +_convert_stat_stat64(struct stat64 *stto,struct stat *stfrom) +{ + stto->st_dev = stfrom->st_dev; + stto->st_ino = stfrom->st_ino; + stto->st_mode = stfrom->st_mode; + stto->st_nlink = stfrom->st_nlink; + stto->st_uid = stfrom->st_uid; + stto->st_gid = stfrom->st_gid; + stto->st_rdev = stfrom->st_rdev; + stto->st_blksize = stfrom->st_blksize; + stto->st_blocks = stfrom->st_blocks; + stto->st_atime = stfrom->st_atime; + stto->st_mtime = stfrom->st_mtime; + stto->st_ctime = stfrom->st_ctime; + stto->st_size = (off64_t)stfrom->st_size; +} + +/*********************************************************************** + * stat64 + */ +#ifndef HAVE_STAT64 +int stat64(const char *file_name, struct stat64 *buf) +{ + struct stat stbuf; + int res = stat(file_name,&stbuf); + _convert_stat_stat64(buf,&stbuf); + return res; +} +#endif /* HAVE_STAT64 */ + +/*********************************************************************** + * lstat64 + */ +#ifndef HAVE_LSTAT64 +int lstat64(const char *file_name, struct stat64 *buf) +{ + struct stat stbuf; + int res = lstat(file_name,&stbuf); + _convert_stat_stat64(buf,&stbuf); + return res; +} +#endif /* HAVE_LSTAT64 */ +/*********************************************************************** + * fstat64 + */ +#ifndef HAVE_FSTAT64 +int fstat64(int fd, struct stat64 *buf) +{ + struct stat stbuf; + int res = fstat(fd,&stbuf); + _convert_stat_stat64(buf,&stbuf); + return res; +} +#endif /* HAVE_FSTAT */ + +/*********************************************************************** + * lseek64 + */ +#ifndef HAVE_LSEEK64 +off64_t lseek64(int fd, off64_t where, int whence) +{ + off_t res; + if ((where >= 0x8000000LL) || ( where <= -0x7fffffffLL)) { + errno = EFBIG; /* FIXME: hack */ + return -1; + } + + res = lseek(fd,(off_t)where,whence); + return (off64_t)res; +} +#endif /* HAVE_LSEEK64 */ + +/*********************************************************************** + * ftruncate64 + */ +#ifndef HAVE_FTRUNCATE64 +int ftruncate64(int fd, off64_t where) +{ + if ((where >= 0x8000000LL) || ( where <= -0x7fffffffLL)) { + errno = EFBIG; /* FIXME: hack */ + return -1; + } + return ftruncate(fd,(off_t)where); +} +#endif /* HAVE_LSEEK64 */ /*********************************************************************** * getrlimit */ diff --git a/loader/dos/dosmod.c b/loader/dos/dosmod.c index 8aea170bb41..06516b69637 100644 --- a/loader/dos/dosmod.c +++ b/loader/dos/dosmod.c @@ -21,7 +21,6 @@ asm(".org 0x110000"); #include <unistd.h> #include <fcntl.h> #include <signal.h> -#include <sys/stat.h> #ifdef HAVE_SYS_MMAN_H # include <sys/mman.h> #endif diff --git a/loader/ne/resource.c b/loader/ne/resource.c index 799e939f97c..cb0d196c4f2 100644 --- a/loader/ne/resource.c +++ b/loader/ne/resource.c @@ -10,7 +10,6 @@ #include <stdlib.h> #include <string.h> #include <sys/types.h> -#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include "windef.h" diff --git a/loader/ne/segment.c b/loader/ne/segment.c index de61c3c75ed..a3ca8c7cd02 100644 --- a/loader/ne/segment.c +++ b/loader/ne/segment.c @@ -9,7 +9,6 @@ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> -#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <ctype.h> diff --git a/msdos/int13.c b/msdos/int13.c index 91d6568087e..3a39463bc38 100644 --- a/msdos/int13.c +++ b/msdos/int13.c @@ -5,11 +5,10 @@ #include <stdlib.h> #include <unistd.h> #include <sys/types.h> -#include <sys/stat.h> #include <sys/ioctl.h> #include <fcntl.h> #ifdef linux -#include <linux/fd.h> +# include <linux/fd.h> #endif #include "miscemu.h" /* #define DEBUG_INT */ diff --git a/msdos/int21.c b/msdos/int21.c index 51e45313b1a..236f66b6d30 100644 --- a/msdos/int21.c +++ b/msdos/int21.c @@ -12,7 +12,6 @@ # include <sys/file.h> #endif #include <string.h> -#include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> diff --git a/server/console.c b/server/console.c index 60324e95844..1561070c556 100644 --- a/server/console.c +++ b/server/console.c @@ -15,10 +15,6 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> -#ifdef HAVE_SYS_ERRNO_H -#include <sys/errno.h> -#endif -#include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #include <time.h> diff --git a/server/file.c b/server/file.c index 6ffba87c90a..7b315b2539f 100644 --- a/server/file.c +++ b/server/file.c @@ -5,6 +5,7 @@ */ #include "config.h" +#include "wine/port.h" #include <assert.h> #include <fcntl.h> @@ -152,7 +153,7 @@ static struct file *create_file( const char *nameptr, size_t len, unsigned int a } /* FIXME: should set error to STATUS_OBJECT_NAME_COLLISION if file existed before */ - if ((fd = open( name, flags | O_NONBLOCK, + if ((fd = open( name, flags | O_NONBLOCK | O_LARGEFILE, (attrs & FILE_ATTRIBUTE_READONLY) ? 0444 : 0666 )) == -1) goto file_error; /* refuse to open a directory */ @@ -161,7 +162,7 @@ static struct file *create_file( const char *nameptr, size_t len, unsigned int a { set_error( STATUS_ACCESS_DENIED ); goto error; - } + } if (!(file = create_file_for_fd( fd, access, sharing, attrs ))) { @@ -258,11 +259,11 @@ static int file_flush( struct object *obj ) static int file_get_info( struct object *obj, struct get_file_info_request *req ) { - struct stat st; + struct stat64 st; struct file *file = (struct file *)obj; assert( obj->ops == &file_ops ); - if (fstat( file->obj.fd, &st ) == -1) + if (fstat64( file->obj.fd, &st ) == -1) { file_set_error(); return 0; @@ -275,8 +276,16 @@ static int file_get_info( struct object *obj, struct get_file_info_request *req if (!(st.st_mode & S_IWUSR)) req->attr |= FILE_ATTRIBUTE_READONLY; req->access_time = st.st_atime; req->write_time = st.st_mtime; - req->size_high = 0; - req->size_low = S_ISDIR(st.st_mode) ? 0 : st.st_size; + if (S_ISDIR(st.st_mode)) + { + req->size_high = 0; + req->size_low = 0; + } + else + { + req->size_high = st.st_size >> 32; + req->size_low = st.st_size & 0xffffffff; + } req->links = st.st_nlink; req->index_high = st.st_dev; req->index_low = st.st_ino; @@ -331,21 +340,15 @@ struct file *get_file_obj( struct process *process, handle_t handle, unsigned in return (struct file *)get_handle_obj( process, handle, access, &file_ops ); } -static int set_file_pointer( handle_t handle, int *low, int *high, int whence ) +static int set_file_pointer( handle_t handle, unsigned int *low, int *high, int whence ) { struct file *file; - int result; - - if ((*low >= 0 && *high != 0) || (*low < 0 && *high != -1)) - { - fprintf( stderr, "set_file_pointer: offset > 2Gb not supported yet\n" ); - set_error( STATUS_INVALID_PARAMETER ); - return 0; - } + off64_t result,xto; + xto = *low+((off64_t)*high<<32); if (!(file = get_file_obj( current->process, handle, 0 ))) return 0; - if ((result = lseek( file->obj.fd, *low, whence )) == -1) + if ((result = lseek64(file->obj.fd,xto,whence))==-1) { /* Check for seek before start of file */ @@ -358,7 +361,8 @@ static int set_file_pointer( handle_t handle, int *low, int *high, int whence ) release_object( file ); return 0; } - *low = result; + *low = result & 0xffffffff; + *high = result >> 32; release_object( file ); return 1; } @@ -366,12 +370,12 @@ static int set_file_pointer( handle_t handle, int *low, int *high, int whence ) static int truncate_file( handle_t handle ) { struct file *file; - int result; + off64_t result; if (!(file = get_file_obj( current->process, handle, GENERIC_WRITE ))) return 0; - if (((result = lseek( file->obj.fd, 0, SEEK_CUR )) == -1) || - (ftruncate( file->obj.fd, result ) == -1)) + if (((result = lseek64( file->obj.fd, 0, SEEK_CUR )) == -1) || + (ftruncate64( file->obj.fd, result ) == -1)) { file_set_error(); release_object( file ); @@ -384,20 +388,16 @@ static int truncate_file( handle_t handle ) /* try to grow the file to the specified size */ int grow_file( struct file *file, int size_high, int size_low ) { - struct stat st; + struct stat64 st; + off64_t size = size_low + (((off64_t)size_high)<<32); - if (size_high) - { - set_error( STATUS_INVALID_PARAMETER ); - return 0; - } - if (fstat( file->obj.fd, &st ) == -1) + if (fstat64( file->obj.fd, &st ) == -1) { file_set_error(); return 0; } - if (st.st_size >= size_low) return 1; /* already large enough */ - if (ftruncate( file->obj.fd, size_low ) != -1) return 1; + if (st.st_size >= size) return 1; /* already large enough */ + if (ftruncate64( file->obj.fd, size ) != -1) return 1; file_set_error(); return 0; } diff --git a/server/pipe.c b/server/pipe.c index 789c201f242..8ade62547b2 100644 --- a/server/pipe.c +++ b/server/pipe.c @@ -14,7 +14,6 @@ #ifdef HAVE_SYS_ERRNO_H #include <sys/errno.h> #endif -#include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #include <time.h> diff --git a/server/serial.c b/server/serial.c index 738bcbc8bdd..4979d390a0f 100644 --- a/server/serial.c +++ b/server/serial.c @@ -20,7 +20,6 @@ #ifdef HAVE_SYS_ERRNO_H #include <sys/errno.h> #endif -#include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #include <time.h> diff --git a/server/sock.c b/server/sock.c index 1617fb3e59f..b5c77a8e3f0 100644 --- a/server/sock.c +++ b/server/sock.c @@ -18,7 +18,6 @@ #ifdef HAVE_SYS_ERRNO_H # include <sys/errno.h> #endif -#include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H diff --git a/win32/device.c b/win32/device.c index 4b659793f35..0b30099ec63 100644 --- a/win32/device.c +++ b/win32/device.c @@ -9,16 +9,9 @@ #include "config.h" -#include <errno.h> -#include <assert.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> -#include <sys/stat.h> -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif -#include <fcntl.h> #include <string.h> #include <stdarg.h> #include <time.h> diff --git a/win32/file.c b/win32/file.c index ea7e470ac80..8202fd9a259 100644 --- a/win32/file.c +++ b/win32/file.c @@ -5,6 +5,7 @@ */ #include "config.h" +#include "wine/port.h" #include <errno.h> #ifdef HAVE_SYS_ERRNO_H @@ -56,7 +57,7 @@ BOOL16 WINAPI SetFileAttributes16( LPCSTR lpFileName, DWORD attributes ) */ BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD attributes) { - struct stat buf; + struct stat64 buf; DOS_FULL_NAME full_name; if (!DOSFS_GetFullName( lpFileName, TRUE, &full_name )) @@ -69,7 +70,7 @@ BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD attributes) FIXME("(%s):%lx illegal combination with FILE_ATTRIBUTE_NORMAL.\n", lpFileName,attributes); } - if(stat(full_name.long_name,&buf)==-1) + if(stat64(full_name.long_name,&buf)==-1) { FILE_SetDosError(); return FALSE; diff --git a/windows/clipboard.c b/windows/clipboard.c index 06fe2363a65..25b7adeac53 100644 --- a/windows/clipboard.c +++ b/windows/clipboard.c @@ -19,7 +19,6 @@ #include <stdlib.h> #include <sys/types.h> -#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <string.h> -- GitLab