Commit 6bb990f7 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Drop any file64 functions, try to use system supplied 64-bit mode by

using proper defines.
parent 0925d6ec
......@@ -781,7 +781,6 @@ AC_CHECK_FUNCS(\
ecvt \
finite \
fpclass \
fstat64 \
ftruncate64 \
getnetbyaddr \
getnetbyname \
......@@ -794,7 +793,6 @@ AC_CHECK_FUNCS(\
inet_network \
lseek64 \
lstat \
lstat64 \
memmove \
mmap \
rfork \
......@@ -802,7 +800,6 @@ AC_CHECK_FUNCS(\
sendmsg \
settimeofday \
sigaltstack \
stat64 \
statfs \
strcasecmp \
strerror \
......@@ -879,43 +876,6 @@ 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([
......
......@@ -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 stat64 *st, BY_HANDLE_FILE_INFORMATION *info )
static void FILE_FillInfo( struct stat *st, BY_HANDLE_FILE_INFORMATION *info )
{
if (S_ISDIR(st->st_mode))
info->dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
......@@ -524,9 +524,9 @@ static void FILE_FillInfo( struct stat64 *st, BY_HANDLE_FILE_INFORMATION *info )
*/
BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info )
{
struct stat64 st;
struct stat st;
if (lstat64( unixName, &st ) == -1)
if (lstat( unixName, &st ) == -1)
{
FILE_SetDosError();
return FALSE;
......@@ -536,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 (stat64( unixName, &st ) == -1)
if (stat( unixName, &st ) == -1)
{
FILE_SetDosError();
return FALSE;
......@@ -2010,9 +2010,7 @@ BOOL WINAPI MoveFileExW( LPCWSTR fn1, LPCWSTR fn2, DWORD flag )
BOOL WINAPI MoveFileA( LPCSTR fn1, LPCSTR fn2 )
{
DOS_FULL_NAME full_name1, full_name2;
/* Even though we do not need the size, stat will fail for large files,
* so we need to use stat64 here. */
struct stat64 fstat;
struct stat fstat;
TRACE("(%s,%s)\n", fn1, fn2 );
......@@ -2033,7 +2031,7 @@ BOOL WINAPI MoveFileA( LPCSTR fn1, LPCSTR fn2 )
}
else return TRUE;
else /*copy */ {
if (stat64( full_name1.long_name, &fstat ))
if (stat( full_name1.long_name, &fstat ))
{
WARN("Invalid source file %s\n",
full_name1.long_name);
......
......@@ -3,6 +3,10 @@
* defined in the 'configure' script.
*/
/* This is for glibc on Linux, it will turn on 64 bit file support at compile time */
#define _FILE_OFFSET_BITS 64
@TOP@
/* Define if .type asm directive must be inside a .def directive */
#undef NEED_TYPE_IN_DEF
......@@ -125,9 +129,3 @@
/* Define if FreeType 2 is installed */
#undef HAVE_FREETYPE
/* Define if we have 64 bit file offsets */
#undef HAVE_OFF64_T
/* Define if we have struct stat64 */
#undef HAVE_STRUCT_STAT64
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
/*
* This file is used by 'autoheader' to generate the list of symbols
* defined in the 'configure' script.
*/
/* This is for glibc on Linux, it will turn on 64 bit file support at compile time */
#define _FILE_OFFSET_BITS 64
/* Define if using alloca.c. */
#undef C_ALLOCA
......@@ -157,12 +164,6 @@
/* Define if FreeType 2 is installed */
#undef HAVE_FREETYPE
/* 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
......@@ -190,9 +191,6 @@
/* 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
......@@ -235,9 +233,6 @@
/* 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
......@@ -262,9 +257,6 @@
/* 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
......
......@@ -6,8 +6,6 @@
#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 <fcntl.h>
......@@ -133,53 +131,7 @@ 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
/* So we open files in 64 bit access mode on Linux */
#ifndef O_LARGEFILE
# define O_LARGEFILE 0
#endif
......
......@@ -389,94 +389,6 @@ int lstat(const char *file_name, struct stat *buf)
}
#endif /* HAVE_LSTAT */
#if !defined(HAVE_STAT64) || !defined(HAVE_LSTAT64) || !defined(HAVE_FSTAT64)
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;
}
#endif /* HAVE_STAT64 || HAVE_LSTAT64 || HAVE_FSTAT64 */
/***********************************************************************
* 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
*/
......
......@@ -259,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 stat64 st;
struct stat st;
struct file *file = (struct file *)obj;
assert( obj->ops == &file_ops );
if (fstat64( file->obj.fd, &st ) == -1)
if (fstat( file->obj.fd, &st ) == -1)
{
file_set_error();
return 0;
......@@ -343,12 +343,12 @@ struct file *get_file_obj( struct process *process, handle_t handle, unsigned in
static int set_file_pointer( handle_t handle, unsigned int *low, int *high, int whence )
{
struct file *file;
off64_t result,xto;
off_t result,xto;
xto = *low+((off64_t)*high<<32);
xto = *low+((off_t)*high<<32);
if (!(file = get_file_obj( current->process, handle, 0 )))
return 0;
if ((result = lseek64(file->obj.fd,xto,whence))==-1)
if ((result = lseek(file->obj.fd,xto,whence))==-1)
{
/* Check for seek before start of file */
......@@ -370,17 +370,18 @@ static int set_file_pointer( handle_t handle, unsigned int *low, int *high, int
static int truncate_file( handle_t handle )
{
struct file *file;
off64_t result;
off_t result;
if (!(file = get_file_obj( current->process, handle, GENERIC_WRITE )))
return 0;
if (((result = lseek64( file->obj.fd, 0, SEEK_CUR )) == -1) ||
(ftruncate64( file->obj.fd, result ) == -1))
if (((result = lseek( file->obj.fd, 0, SEEK_CUR )) == -1) ||
(ftruncate( file->obj.fd, result ) == -1))
{
file_set_error();
release_object( file );
return 0;
}
fprintf(stderr,"server:truncated to %Ld\n",result);
release_object( file );
return 1;
}
......@@ -388,16 +389,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 stat64 st;
off64_t size = size_low + (((off64_t)size_high)<<32);
struct stat st;
off_t size = size_low + (((off_t)size_high)<<32);
if (fstat64( file->obj.fd, &st ) == -1)
if (fstat( file->obj.fd, &st ) == -1)
{
file_set_error();
return 0;
}
if (st.st_size >= size) return 1; /* already large enough */
if (ftruncate64( file->obj.fd, size ) != -1) return 1;
if (ftruncate( file->obj.fd, size ) != -1) return 1;
file_set_error();
return 0;
}
......
......@@ -57,7 +57,7 @@ BOOL16 WINAPI SetFileAttributes16( LPCSTR lpFileName, DWORD attributes )
*/
BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD attributes)
{
struct stat64 buf;
struct stat buf;
DOS_FULL_NAME full_name;
if (!DOSFS_GetFullName( lpFileName, TRUE, &full_name ))
......@@ -70,7 +70,7 @@ BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD attributes)
FIXME("(%s):%lx illegal combination with FILE_ATTRIBUTE_NORMAL.\n",
lpFileName,attributes);
}
if(stat64(full_name.long_name,&buf)==-1)
if(stat(full_name.long_name,&buf)==-1)
{
FILE_SetDosError();
return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment