* cygwin.din (fstat64): New symbol.

(ftruncate64): Ditto.
	(lseek64): Ditto.
	(lstat64): Ditto.
	(mmap64): Ditto.
	(seekdir64): Ditto.
	(stat64): Ditto.
	(telldir64): Ditto.
	(truncate64): Ditto.
	* dir.cc (telldir64): New function.
	(telldir): Call telldir64().
	(seekdir64): New function.
	(seekdir): Call seekdir64().
	* fhandler.h: Redefine all methods using __off32_t to use __off64_t.
	* fhandler.cc: Use __off64_t and struct __stat64 throughout.
	* fhandler_clipboard.cc: Ditto.
	* fhandler_disk_file.cc: Ditto.
	* fhandler_dsp.cc: Ditto.
	* fhandler_floppy.cc: Ditto.
	* fhandler_mem.cc: Ditto.
	* fhandler_random.cc: Ditto.
	* fhandler_socket.cc: Ditto.
	* fhandler_tape.cc: Ditto.
	* fhandler_zero.cc: Ditto.
	* pipe.cc: Ditto.
	* glob.c: Ditto, call lstat64 and stat64 in Cygwin.
	* mmap.cc: Use __off64_t throughout.
	(mmap64): New function.
	* sec_acl.cc (acl_worker): Use struct __stat64, call stat64 and lstat64.
	* syscalls.cc (lseek64): New function.
	(stat64_to_stat32): Ditto.
	(fstat64): Ditto.
	(stat64): Ditto.
	(lstat64): Ditto.
	(ftruncate64): Ditto.
	(truncate64): Ditto.
	(_fstat): Call fstat64.
	(_stat): Call stat64.
	(cygwin_lstat): Rename to avoid declaration problem.  Call lstat64.
	(stat_worker): Use struct __stat64.
	(access): Ditto.
	(ftruncate): Call ftruncate64.
	(truncate): Call truncate64.
	* wincap.cc: Set flag has_64bit_file_access appropriately.
	* wincap.h: Add flag has_64bit_file_access.
	* winsup.h (ILLEGAL_SEEK): Define as __off64_t.
	(stat_dev): Declare using struct __stat64.
	(stat_worker): Ditto.
	* include/cygwin/stat.h (struct __stat32): Define if compiling Cygwin.
	(struct __stat64): Ditto.
	(struct stat): Revert definition with explicitly sized datatypes.
	Eliminate sized field names.
	* include/cygwin/types.h (blksize_t): New type.
	(__blkcnt32_t): Ditto.
	(__blkcnt64_t): Ditto.
	(blkcnt_t): Ditto.
This commit is contained in:
Corinna Vinschen 2002-02-25 17:47:51 +00:00
parent 5a909729b1
commit acb5617538
24 changed files with 433 additions and 238 deletions

View File

@ -1,3 +1,62 @@
2002-02-23 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (fstat64): New symbol.
(ftruncate64): Ditto.
(lseek64): Ditto.
(lstat64): Ditto.
(mmap64): Ditto.
(seekdir64): Ditto.
(stat64): Ditto.
(telldir64): Ditto.
(truncate64): Ditto.
* dir.cc (telldir64): New function.
(telldir): Call telldir64().
(seekdir64): New function.
(seekdir): Call seekdir64().
* fhandler.h: Redefine all methods using __off32_t to use __off64_t.
* fhandler.cc: Use __off64_t and struct __stat64 throughout.
* fhandler_clipboard.cc: Ditto.
* fhandler_disk_file.cc: Ditto.
* fhandler_dsp.cc: Ditto.
* fhandler_floppy.cc: Ditto.
* fhandler_mem.cc: Ditto.
* fhandler_random.cc: Ditto.
* fhandler_socket.cc: Ditto.
* fhandler_tape.cc: Ditto.
* fhandler_zero.cc: Ditto.
* pipe.cc: Ditto.
* glob.c: Ditto, call lstat64 and stat64 in Cygwin.
* mmap.cc: Use __off64_t throughout.
(mmap64): New function.
* sec_acl.cc (acl_worker): Use struct __stat64, call stat64 and lstat64.
* syscalls.cc (lseek64): New function.
(stat64_to_stat32): Ditto.
(fstat64): Ditto.
(stat64): Ditto.
(lstat64): Ditto.
(ftruncate64): Ditto.
(truncate64): Ditto.
(_fstat): Call fstat64.
(_stat): Call stat64.
(cygwin_lstat): Rename to avoid declaration problem. Call lstat64.
(stat_worker): Use struct __stat64.
(access): Ditto.
(ftruncate): Call ftruncate64.
(truncate): Call truncate64.
* wincap.cc: Set flag has_64bit_file_access appropriately.
* wincap.h: Add flag has_64bit_file_access.
* winsup.h (ILLEGAL_SEEK): Define as __off64_t.
(stat_dev): Declare using struct __stat64.
(stat_worker): Ditto.
* include/cygwin/stat.h (struct __stat32): Define if compiling Cygwin.
(struct __stat64): Ditto.
(struct stat): Revert definition with explicitly sized datatypes.
Eliminate sized field names.
* include/cygwin/types.h (blksize_t): New type.
(__blkcnt32_t): Ditto.
(__blkcnt64_t): Ditto.
(blkcnt_t): Ditto.
2002-02-22 Christopher Faylor <cgf@redhat.com> 2002-02-22 Christopher Faylor <cgf@redhat.com>
* sync.h (new_muto): Just accept an argument which denotes the name of * sync.h (new_muto): Just accept an argument which denotes the name of

View File

@ -304,6 +304,7 @@ fsetpos
_fsetpos = fsetpos _fsetpos = fsetpos
fstat fstat
_fstat = fstat _fstat = fstat
fstat64
fstatfs fstatfs
_fstatfs = fstatfs _fstatfs = fstatfs
fsync fsync
@ -318,6 +319,7 @@ ftime
_ftime = ftime _ftime = ftime
ftruncate ftruncate
_ftruncate = ftruncate _ftruncate = ftruncate
ftruncate64
fwrite fwrite
_fwrite = fwrite _fwrite = fwrite
gamma gamma
@ -510,8 +512,10 @@ longjmp
_longjmp = longjmp _longjmp = longjmp
lseek lseek
_lseek = lseek _lseek = lseek
lstat lseek64
_lstat = lstat lstat = cygwin_lstat
_lstat = cygwin_lstat
lstat64
malloc = export_malloc malloc = export_malloc
_malloc = export_malloc _malloc = export_malloc
matherr matherr
@ -544,6 +548,7 @@ _mktemp = mktemp
mktime mktime
_mktime = mktime _mktime = mktime
mmap mmap
mmap64
mprotect mprotect
msync msync
munmap munmap
@ -646,6 +651,7 @@ _scanf_r
scanf_r = _scanf_r scanf_r = _scanf_r
seekdir seekdir
_seekdir = seekdir _seekdir = seekdir
seekdir64
setbuf setbuf
_setbuf = setbuf _setbuf = setbuf
setdtablesize setdtablesize
@ -745,6 +751,7 @@ _sscanf_r
sscanf_r = _sscanf_r sscanf_r = _sscanf_r
stat stat
_stat = stat _stat = stat
stat64
statfs statfs
_statfs = statfs _statfs = statfs
strcasecmp strcasecmp
@ -841,6 +848,7 @@ tcsetpgrp
_tcsetpgrp = tcsetpgrp _tcsetpgrp = tcsetpgrp
telldir telldir
_telldir = telldir _telldir = telldir
telldir64
tempnam tempnam
_tempnam = tempnam _tempnam = tempnam
time time
@ -860,6 +868,7 @@ toupper
_toupper = toupper _toupper = toupper
truncate truncate
_truncate = truncate _truncate = truncate
truncate64
ttyname ttyname
_ttyname = ttyname _ttyname = ttyname
tzset tzset

View File

@ -118,9 +118,8 @@ readdir (DIR *dir)
return ((fhandler_base *) dir->__d_u.__d_data.__fh)->readdir (dir); return ((fhandler_base *) dir->__d_u.__d_data.__fh)->readdir (dir);
} }
/* telldir */ extern "C" __off64_t
extern "C" __off32_t telldir64 (DIR *dir)
telldir (DIR *dir)
{ {
if (check_null_invalid_struct_errno (dir)) if (check_null_invalid_struct_errno (dir))
return -1; return -1;
@ -130,9 +129,15 @@ telldir (DIR *dir)
return ((fhandler_base *) dir->__d_u.__d_data.__fh)->telldir (dir); return ((fhandler_base *) dir->__d_u.__d_data.__fh)->telldir (dir);
} }
/* seekdir */ /* telldir */
extern "C" __off32_t
telldir (DIR *dir)
{
return telldir64 (dir);
}
extern "C" void extern "C" void
seekdir (DIR *dir, __off32_t loc) seekdir64 (DIR *dir, __off64_t loc)
{ {
if (check_null_invalid_struct_errno (dir)) if (check_null_invalid_struct_errno (dir))
return; return;
@ -142,6 +147,13 @@ seekdir (DIR *dir, __off32_t loc)
return ((fhandler_base *) dir->__d_u.__d_data.__fh)->seekdir (dir, loc); return ((fhandler_base *) dir->__d_u.__d_data.__fh)->seekdir (dir, loc);
} }
/* seekdir */
extern "C" void
seekdir (DIR *dir, __off32_t loc)
{
seekdir64 (dir, (__off64_t)loc);
}
/* rewinddir: POSIX 5.1.2.1 */ /* rewinddir: POSIX 5.1.2.1 */
extern "C" void extern "C" void
rewinddir (DIR *dir) rewinddir (DIR *dir)

View File

@ -27,6 +27,7 @@ details. */
#include "sigproc.h" #include "sigproc.h"
#include "pinfo.h" #include "pinfo.h"
#include <assert.h> #include <assert.h>
#include <limits.h>
static NO_COPY const int CHUNK_SIZE = 1024; /* Used for crlf conversions */ static NO_COPY const int CHUNK_SIZE = 1024; /* Used for crlf conversions */
@ -693,10 +694,22 @@ fhandler_base::write (const void *ptr, size_t len)
return res; return res;
} }
__off32_t __off64_t
fhandler_base::lseek (__off32_t offset, int whence) fhandler_base::lseek (__off64_t offset, int whence)
{ {
__off32_t res; __off64_t res;
/* 9x/Me doesn't support 64bit offsets. We trap that here and return
EINVAL. It doesn't make sense to simulate bigger offsets by a
SetFilePointer sequence since FAT and FAT32 don't support file
size >= 4GB anyway. */
if (!wincap.has_64bit_file_access ()
&& (offset < LONG_MIN || offset > LONG_MAX))
{
debug_printf ("Win9x, offset not 32 bit.");
set_errno (EINVAL);
return (__off64_t)-1;
}
/* Seeks on text files is tough, we rewind and read till we get to the /* Seeks on text files is tough, we rewind and read till we get to the
right place. */ right place. */
@ -708,70 +721,16 @@ fhandler_base::lseek (__off32_t offset, int whence)
set_readahead_valid (0); set_readahead_valid (0);
} }
debug_printf ("lseek (%s, %d, %d)", unix_path_name, offset, whence); debug_printf ("lseek (%s, %D, %d)", unix_path_name, offset, whence);
#if 0 /* lseek has no business messing about with text-mode stuff */
if (!get_r_binary ())
{
int newplace;
if (whence == 0)
{
newplace = offset;
}
else if (whence ==1)
{
newplace = rpos + offset;
}
else
{
/* Seek from the end of a file.. */
if (rsize == -1)
{
/* Find the size of the file by reading till the end */
char b[CHUNK_SIZE];
while (read (b, sizeof (b)) > 0)
;
rsize = rpos;
}
newplace = rsize + offset;
}
if (rpos > newplace)
{
SetFilePointer (handle, 0, 0, 0);
rpos = 0;
}
/* You can never shrink something more than 50% by turning CRLF into LF,
so we binary chop looking for the right place */
while (rpos < newplace)
{
char b[CHUNK_SIZE];
size_t span = (newplace - rpos) / 2;
if (span == 0)
span = 1;
if (span > sizeof (b))
span = sizeof (b);
debug_printf ("lseek (%s, %d, %d) span %d, rpos %d newplace %d",
name, offset, whence,span,rpos, newplace);
read (b, span);
}
debug_printf ("Returning %d", newplace);
return newplace;
}
#endif /* end of deleted code dealing with text mode */
DWORD win32_whence = whence == SEEK_SET ? FILE_BEGIN DWORD win32_whence = whence == SEEK_SET ? FILE_BEGIN
: (whence == SEEK_CUR ? FILE_CURRENT : FILE_END); : (whence == SEEK_CUR ? FILE_CURRENT : FILE_END);
res = SetFilePointer (get_handle(), offset, 0, win32_whence); LONG off_low = offset & 0xffffffff;
if (res == -1) LONG off_high = wincap.has_64bit_file_access () ? offset >> 32 : 0;
res = SetFilePointer (get_handle(), off_low, &off_high, win32_whence);
if (res == INVALID_SET_FILE_POINTER && GetLastError ())
{ {
__seterrno (); __seterrno ();
} }
@ -862,7 +821,7 @@ rootdir(char *full_path)
} }
int __stdcall int __stdcall
fhandler_base::fstat (struct stat *buf, path_conv *) fhandler_base::fstat (struct __stat64 *buf, path_conv *)
{ {
switch (get_device ()) switch (get_device ())
{ {
@ -1181,7 +1140,7 @@ fhandler_base::readdir (DIR *)
return NULL; return NULL;
} }
__off32_t __off64_t
fhandler_base::telldir (DIR *) fhandler_base::telldir (DIR *)
{ {
set_errno (ENOTDIR); set_errno (ENOTDIR);
@ -1189,7 +1148,7 @@ fhandler_base::telldir (DIR *)
} }
void void
fhandler_base::seekdir (DIR *, __off32_t) fhandler_base::seekdir (DIR *, __off64_t)
{ {
set_errno (ENOTDIR); set_errno (ENOTDIR);
return; return;

View File

@ -282,19 +282,19 @@ class fhandler_base
virtual int open (path_conv * real_path, int flags, mode_t mode = 0); virtual int open (path_conv * real_path, int flags, mode_t mode = 0);
virtual int close (); virtual int close ();
virtual int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (3))); virtual int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
virtual int ioctl (unsigned int cmd, void *); virtual int ioctl (unsigned int cmd, void *);
virtual int fcntl (int cmd, void *); virtual int fcntl (int cmd, void *);
virtual char const * ttyname () { return get_name(); } virtual char const * ttyname () { return get_name(); }
virtual int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3))); virtual int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
virtual int write (const void *ptr, size_t len); virtual int write (const void *ptr, size_t len);
virtual __off32_t lseek (__off32_t offset, int whence); virtual __off64_t lseek (__off64_t offset, int whence);
virtual int lock (int, struct flock *); virtual int lock (int, struct flock *);
virtual void dump (); virtual void dump ();
virtual int dup (fhandler_base *child); virtual int dup (fhandler_base *child);
virtual HANDLE mmap (caddr_t *addr, size_t len, DWORD access, virtual HANDLE mmap (caddr_t *addr, size_t len, DWORD access,
int flags, __off32_t off); int flags, __off64_t off);
virtual int munmap (HANDLE h, caddr_t addr, size_t len); virtual int munmap (HANDLE h, caddr_t addr, size_t len);
virtual int msync (HANDLE h, caddr_t addr, size_t len, int flags); virtual int msync (HANDLE h, caddr_t addr, size_t len, int flags);
virtual BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset, virtual BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
@ -347,8 +347,8 @@ class fhandler_base
virtual void set_eof () {} virtual void set_eof () {}
virtual DIR *opendir (path_conv& pc); virtual DIR *opendir (path_conv& pc);
virtual dirent *readdir (DIR *); virtual dirent *readdir (DIR *);
virtual __off32_t telldir (DIR *); virtual __off64_t telldir (DIR *);
virtual void seekdir (DIR *, __off32_t); virtual void seekdir (DIR *, __off64_t);
virtual void rewinddir (DIR *); virtual void rewinddir (DIR *);
virtual int closedir (DIR *); virtual int closedir (DIR *);
}; };
@ -382,7 +382,7 @@ class fhandler_socket: public fhandler_base
int ioctl (unsigned int cmd, void *); int ioctl (unsigned int cmd, void *);
int fcntl (int cmd, void *); int fcntl (int cmd, void *);
__off32_t lseek (__off32_t, int) { return 0; } __off64_t lseek (__off64_t, int) { return 0; }
int close (); int close ();
void hclose (HANDLE) {close ();} void hclose (HANDLE) {close ();}
int dup (fhandler_base *child); int dup (fhandler_base *child);
@ -405,7 +405,7 @@ class fhandler_socket: public fhandler_base
int check_peer_secret_event (struct sockaddr_in *peer, int *secret = NULL); int check_peer_secret_event (struct sockaddr_in *peer, int *secret = NULL);
void signal_secret_event (); void signal_secret_event ();
void close_secret_event (); void close_secret_event ();
int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (3))); int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
}; };
class fhandler_pipe: public fhandler_base class fhandler_pipe: public fhandler_base
@ -417,7 +417,7 @@ class fhandler_pipe: public fhandler_base
unsigned id; unsigned id;
public: public:
fhandler_pipe (DWORD devtype); fhandler_pipe (DWORD devtype);
__off32_t lseek (__off32_t offset, int whence); __off64_t lseek (__off64_t offset, int whence);
select_record *select_read (select_record *s); select_record *select_read (select_record *s);
select_record *select_write (select_record *s); select_record *select_write (select_record *s);
select_record *select_except (select_record *s); select_record *select_except (select_record *s);
@ -489,7 +489,7 @@ class fhandler_dev_floppy: public fhandler_dev_raw
virtual int open (path_conv *, int flags, mode_t mode = 0); virtual int open (path_conv *, int flags, mode_t mode = 0);
virtual int close (void); virtual int close (void);
virtual __off32_t lseek (__off32_t offset, int whence); virtual __off64_t lseek (__off64_t offset, int whence);
virtual int ioctl (unsigned int cmd, void *buf); virtual int ioctl (unsigned int cmd, void *buf);
}; };
@ -512,9 +512,9 @@ class fhandler_dev_tape: public fhandler_dev_raw
int open (path_conv *, int flags, mode_t mode = 0); int open (path_conv *, int flags, mode_t mode = 0);
int close (void); int close (void);
__off32_t lseek (__off32_t offset, int whence); __off64_t lseek (__off64_t offset, int whence);
int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (3))); int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
int dup (fhandler_base *child); int dup (fhandler_base *child);
@ -545,18 +545,18 @@ class fhandler_disk_file: public fhandler_base
int close (); int close ();
int lock (int, struct flock *); int lock (int, struct flock *);
BOOL is_device () { return FALSE; } BOOL is_device () { return FALSE; }
int __stdcall fstat (struct stat *buf, path_conv *pc) __attribute__ ((regparm (3))); int __stdcall fstat (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3)));
int __stdcall fstat_helper (struct stat *buf) __attribute__ ((regparm (2))); int __stdcall fstat_helper (struct __stat64 *buf) __attribute__ ((regparm (2)));
HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, __off32_t off); HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, __off64_t off);
int munmap (HANDLE h, caddr_t addr, size_t len); int munmap (HANDLE h, caddr_t addr, size_t len);
int msync (HANDLE h, caddr_t addr, size_t len, int flags); int msync (HANDLE h, caddr_t addr, size_t len, int flags);
BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset, BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
DWORD size, void *address); DWORD size, void *address);
DIR *opendir (path_conv& pc); DIR *opendir (path_conv& pc);
struct dirent *readdir (DIR *); struct dirent *readdir (DIR *);
__off32_t telldir (DIR *); __off64_t telldir (DIR *);
void seekdir (DIR *, __off32_t); void seekdir (DIR *, __off64_t);
void rewinddir (DIR *); void rewinddir (DIR *);
int closedir (DIR *); int closedir (DIR *);
}; };
@ -572,11 +572,11 @@ class fhandler_cygdrive: public fhandler_disk_file
fhandler_cygdrive (int unit); fhandler_cygdrive (int unit);
DIR *opendir (path_conv& pc); DIR *opendir (path_conv& pc);
struct dirent *readdir (DIR *); struct dirent *readdir (DIR *);
__off32_t telldir (DIR *); __off64_t telldir (DIR *);
void seekdir (DIR *, __off32_t); void seekdir (DIR *, __off64_t);
void rewinddir (DIR *); void rewinddir (DIR *);
int closedir (DIR *); int closedir (DIR *);
int __stdcall fstat (struct stat *buf, path_conv *pc) __attribute__ ((regparm (3))); int __stdcall fstat (struct __stat64 *buf, path_conv *pc) __attribute__ ((regparm (3)));
}; };
class fhandler_serial: public fhandler_base class fhandler_serial: public fhandler_base
@ -606,7 +606,7 @@ class fhandler_serial: public fhandler_base
int tcflow (int); int tcflow (int);
int tcsetattr (int a, const struct termios *t); int tcsetattr (int a, const struct termios *t);
int tcgetattr (struct termios *t); int tcgetattr (struct termios *t);
__off32_t lseek (__off32_t, int) { return 0; } __off64_t lseek (__off64_t, int) { return 0; }
int tcflush (int); int tcflush (int);
void dump (); void dump ();
int is_tty () { return 1; } int is_tty () { return 1; }
@ -837,7 +837,7 @@ class fhandler_tty_slave: public fhandler_tty_common
int tcflush (int); int tcflush (int);
int ioctl (unsigned int cmd, void *); int ioctl (unsigned int cmd, void *);
__off32_t lseek (__off32_t, int) { return 0; } __off64_t lseek (__off64_t, int) { return 0; }
select_record *select_read (select_record *s); select_record *select_read (select_record *s);
int ready_for_read (int fd, DWORD howlong); int ready_for_read (int fd, DWORD howlong);
}; };
@ -864,7 +864,7 @@ class fhandler_pty_master: public fhandler_tty_common
int tcflush (int); int tcflush (int);
int ioctl (unsigned int cmd, void *); int ioctl (unsigned int cmd, void *);
__off32_t lseek (__off32_t, int) { return 0; } __off64_t lseek (__off64_t, int) { return 0; }
char *ptsname (); char *ptsname ();
void set_close_on_exec (int val); void set_close_on_exec (int val);
@ -903,7 +903,7 @@ class fhandler_dev_zero: public fhandler_base
int open (path_conv *, int flags, mode_t mode = 0); int open (path_conv *, int flags, mode_t mode = 0);
int write (const void *ptr, size_t len); int write (const void *ptr, size_t len);
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3))); int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
__off32_t lseek (__off32_t offset, int whence); __off64_t lseek (__off64_t offset, int whence);
int close (void); int close (void);
void dump (); void dump ();
@ -926,7 +926,7 @@ class fhandler_dev_random: public fhandler_base
int open (path_conv *, int flags, mode_t mode = 0); int open (path_conv *, int flags, mode_t mode = 0);
int write (const void *ptr, size_t len); int write (const void *ptr, size_t len);
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3))); int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
__off32_t lseek (__off32_t offset, int whence); __off64_t lseek (__off64_t offset, int whence);
int close (void); int close (void);
int dup (fhandler_base *child); int dup (fhandler_base *child);
@ -938,7 +938,7 @@ class fhandler_dev_mem: public fhandler_base
protected: protected:
int unit; int unit;
DWORD mem_size; DWORD mem_size;
DWORD pos; __off64_t pos;
public: public:
fhandler_dev_mem (int unit); fhandler_dev_mem (int unit);
@ -947,12 +947,12 @@ class fhandler_dev_mem: public fhandler_base
int open (path_conv *, int flags, mode_t mode = 0); int open (path_conv *, int flags, mode_t mode = 0);
int write (const void *ptr, size_t ulen); int write (const void *ptr, size_t ulen);
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3))); int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
__off32_t lseek (__off32_t offset, int whence); __off64_t lseek (__off64_t offset, int whence);
int close (void); int close (void);
int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ ((regparm (3))); int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
int dup (fhandler_base *child); int dup (fhandler_base *child);
HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, __off32_t off); HANDLE mmap (caddr_t *addr, size_t len, DWORD access, int flags, __off64_t off);
int munmap (HANDLE h, caddr_t addr, size_t len); int munmap (HANDLE h, caddr_t addr, size_t len);
int msync (HANDLE h, caddr_t addr, size_t len, int flags); int msync (HANDLE h, caddr_t addr, size_t len, int flags);
BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset, BOOL fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
@ -969,7 +969,7 @@ class fhandler_dev_clipboard: public fhandler_base
int open (path_conv *, int flags, mode_t mode = 0); int open (path_conv *, int flags, mode_t mode = 0);
int write (const void *ptr, size_t len); int write (const void *ptr, size_t len);
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3))); int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
__off32_t lseek (__off32_t offset, int whence); __off64_t lseek (__off64_t offset, int whence);
int close (void); int close (void);
int dup (fhandler_base *child); int dup (fhandler_base *child);
@ -977,7 +977,7 @@ class fhandler_dev_clipboard: public fhandler_base
void dump (); void dump ();
private: private:
__off32_t pos; __off64_t pos;
void *membuffer; void *membuffer;
size_t msize; size_t msize;
bool eof; bool eof;
@ -995,7 +995,7 @@ class fhandler_windows: public fhandler_base
int write (const void *ptr, size_t len); int write (const void *ptr, size_t len);
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3))); int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
int ioctl (unsigned int cmd, void *); int ioctl (unsigned int cmd, void *);
__off32_t lseek (__off32_t, int) { return 0; } __off64_t lseek (__off64_t, int) { return 0; }
int close (void) { return 0; } int close (void) { return 0; }
void set_close_on_exec (int val); void set_close_on_exec (int val);
@ -1021,7 +1021,7 @@ class fhandler_dev_dsp : public fhandler_base
int write (const void *ptr, size_t len); int write (const void *ptr, size_t len);
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3))); int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
int ioctl (unsigned int cmd, void *); int ioctl (unsigned int cmd, void *);
__off32_t lseek (__off32_t, int); __off64_t lseek (__off64_t, int);
int close (void); int close (void);
int dup (fhandler_base * child); int dup (fhandler_base * child);
void dump (void); void dump (void);

View File

@ -246,8 +246,8 @@ fhandler_dev_clipboard::read (void *ptr, size_t len)
} }
} }
__off32_t __off64_t
fhandler_dev_clipboard::lseek (__off32_t offset, int whence) fhandler_dev_clipboard::lseek (__off64_t offset, int whence)
{ {
/* On reads we check this at read time, not seek time. /* On reads we check this at read time, not seek time.
* On writes we use this to decide how to write - empty and write, or open, copy, empty * On writes we use this to decide how to write - empty and write, or open, copy, empty

View File

@ -61,7 +61,7 @@ num_entries (const char *win32_name)
} }
int int
fhandler_disk_file::fstat (struct stat *buf, path_conv *pc) fhandler_disk_file::fstat (struct __stat64 *buf, path_conv *pc)
{ {
int res = -1; int res = -1;
int oret; int oret;
@ -132,17 +132,17 @@ fhandler_disk_file::fstat (struct stat *buf, path_conv *pc)
buf->st_mode = S_IFREG; buf->st_mode = S_IFREG;
if (!pc->has_acls () if (!pc->has_acls ()
|| get_file_attribute (TRUE, pc->get_win32 (), || get_file_attribute (TRUE, pc->get_win32 (),
&buf->st_mode, &buf->st_mode, &uid, &gid))
&buf->st_uid, &buf->st_gid))
{ {
buf->st_mode |= STD_RBITS | STD_XBITS; buf->st_mode |= STD_RBITS | STD_XBITS;
if (!(pc->has_attribute (FILE_ATTRIBUTE_READONLY))) if (!(pc->has_attribute (FILE_ATTRIBUTE_READONLY)))
buf->st_mode |= STD_WBITS; buf->st_mode |= STD_WBITS;
if (pc->issymlink ()) if (pc->issymlink ())
buf->st_mode |= S_IRWXU | S_IRWXG | S_IRWXO; buf->st_mode |= S_IRWXU | S_IRWXG | S_IRWXO;
get_file_attribute (FALSE, pc->get_win32 (), get_file_attribute (FALSE, pc->get_win32 (), NULL, &uid, &gid);
NULL, &buf->st_uid, &buf->st_gid);
} }
buf->st_uid = uid;
buf->st_gid = gid;
if ((handle = FindFirstFile (pc->get_win32 (), &wfd)) if ((handle = FindFirstFile (pc->get_win32 (), &wfd))
!= INVALID_HANDLE_VALUE) != INVALID_HANDLE_VALUE)
{ {
@ -158,9 +158,10 @@ fhandler_disk_file::fstat (struct stat *buf, path_conv *pc)
buf->st_mtime = to_time_t (&wfd.ftLastWriteTime); buf->st_mtime = to_time_t (&wfd.ftLastWriteTime);
buf->st_ctime = to_time_t (&wfd.ftCreationTime); buf->st_ctime = to_time_t (&wfd.ftCreationTime);
buf->st_size = wfd.nFileSizeLow; buf->st_size = wfd.nFileSizeLow;
buf->st_size = ((__off64_t)wfd.nFileSizeHigh << 32)
+ wfd.nFileSizeLow;
buf->st_blksize = S_BLKSIZE; buf->st_blksize = S_BLKSIZE;
buf->st_blocks = ((unsigned long) buf->st_size + buf->st_blocks = (buf->st_size + S_BLKSIZE-1) / S_BLKSIZE;
S_BLKSIZE-1) / S_BLKSIZE;
FindClose (handle); FindClose (handle);
} }
res = 0; res = 0;
@ -170,7 +171,7 @@ fhandler_disk_file::fstat (struct stat *buf, path_conv *pc)
} }
int int
fhandler_disk_file::fstat_helper (struct stat *buf) fhandler_disk_file::fstat_helper (struct __stat64 *buf)
{ {
int res = 0; // avoid a compiler warning int res = 0; // avoid a compiler warning
BY_HANDLE_FILE_INFORMATION local; BY_HANDLE_FILE_INFORMATION local;
@ -200,7 +201,7 @@ fhandler_disk_file::fstat_helper (struct stat *buf)
if (lsize == 0xffffffff && GetLastError () != NO_ERROR) if (lsize == 0xffffffff && GetLastError () != NO_ERROR)
buf->st_mode = S_IFCHR; buf->st_mode = S_IFCHR;
else else
buf->st_size = lsize; buf->st_size = ((__off64_t)hsize << 32) + lsize;
/* We expect these to fail! */ /* We expect these to fail! */
buf->st_mode |= STD_RBITS | STD_WBITS; buf->st_mode |= STD_RBITS | STD_WBITS;
buf->st_blksize = S_BLKSIZE; buf->st_blksize = S_BLKSIZE;
@ -228,7 +229,8 @@ fhandler_disk_file::fstat_helper (struct stat *buf)
buf->st_ctime = to_time_t (&local.ftCreationTime); buf->st_ctime = to_time_t (&local.ftCreationTime);
buf->st_nlink = local.nNumberOfLinks; buf->st_nlink = local.nNumberOfLinks;
buf->st_dev = local.dwVolumeSerialNumber; buf->st_dev = local.dwVolumeSerialNumber;
buf->st_size = local.nFileSizeLow; buf->st_size = ((__off64_t)local.nFileSizeHigh << 32)
+ local.nFileSizeLow;
/* Allocate some place to determine the root directory. Need to allocate /* Allocate some place to determine the root directory. Need to allocate
enough so that rootdir can add a trailing slash if path starts with \\. */ enough so that rootdir can add a trailing slash if path starts with \\. */
@ -256,7 +258,7 @@ fhandler_disk_file::fstat_helper (struct stat *buf)
} }
buf->st_blksize = S_BLKSIZE; buf->st_blksize = S_BLKSIZE;
buf->st_blocks = ((unsigned long) buf->st_size + S_BLKSIZE-1) / S_BLKSIZE; buf->st_blocks = (buf->st_size + S_BLKSIZE-1) / S_BLKSIZE;
buf->st_mode = 0; buf->st_mode = 0;
/* Using a side effect: get_file_attibutes checks for /* Using a side effect: get_file_attibutes checks for
@ -267,8 +269,10 @@ fhandler_disk_file::fstat_helper (struct stat *buf)
buf->st_mode = S_IFLNK; buf->st_mode = S_IFLNK;
else if (get_socket_p ()) else if (get_socket_p ())
buf->st_mode = S_IFSOCK; buf->st_mode = S_IFSOCK;
__uid16_t uid;
__gid16_t gid;
if (get_file_attribute (has_acls (), get_win32_name (), &buf->st_mode, if (get_file_attribute (has_acls (), get_win32_name (), &buf->st_mode,
&buf->st_uid, &buf->st_gid) == 0) &uid, &gid) == 0)
{ {
/* If read-only attribute is set, modify ntsec return value */ /* If read-only attribute is set, modify ntsec return value */
if ((local.dwFileAttributes & FILE_ATTRIBUTE_READONLY) if ((local.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
@ -277,6 +281,9 @@ fhandler_disk_file::fstat_helper (struct stat *buf)
if (!(buf->st_mode & S_IFMT)) if (!(buf->st_mode & S_IFMT))
buf->st_mode |= S_IFREG; buf->st_mode |= S_IFREG;
buf->st_uid = uid;
buf->st_gid = gid;
} }
else else
{ {
@ -331,7 +338,7 @@ fhandler_disk_file::fstat_helper (struct stat *buf)
} }
} }
syscall_printf ("0 = fstat (, %p) st_atime=%x st_size=%d, st_mode=%p, st_ino=%d, sizeof=%d", syscall_printf ("0 = fstat (, %p) st_atime=%x st_size=%D, st_mode=%p, st_ino=%d, sizeof=%d",
buf, buf->st_atime, buf->st_size, buf->st_mode, buf, buf->st_atime, buf->st_size, buf->st_mode,
(int) buf->st_ino, sizeof (*buf)); (int) buf->st_ino, sizeof (*buf));
@ -429,10 +436,10 @@ fhandler_disk_file::close ()
int int
fhandler_disk_file::lock (int cmd, struct flock *fl) fhandler_disk_file::lock (int cmd, struct flock *fl)
{ {
int win32_start; __off64_t win32_start;
int win32_len; int win32_len;
DWORD win32_upper; DWORD win32_upper;
DWORD startpos; __off64_t startpos;
/* /*
* We don't do getlck calls yet. * We don't do getlck calls yet.
@ -455,7 +462,7 @@ fhandler_disk_file::lock (int cmd, struct flock *fl)
startpos = 0; startpos = 0;
break; break;
case SEEK_CUR: case SEEK_CUR:
if ((__off32_t) (startpos = lseek (0, SEEK_CUR)) == ILLEGAL_SEEK) if ((startpos = lseek (0, SEEK_CUR)) == ILLEGAL_SEEK)
return -1; return -1;
break; break;
case SEEK_END: case SEEK_END:
@ -466,7 +473,8 @@ fhandler_disk_file::lock (int cmd, struct flock *fl)
__seterrno (); __seterrno ();
return -1; return -1;
} }
startpos = finfo.nFileSizeLow; /* Nowhere to keep high word */ startpos = ((__off64_t)finfo.nFileSizeHigh << 32)
+ finfo.nFileSizeLow;
break; break;
} }
default: default:
@ -714,14 +722,14 @@ fhandler_disk_file::readdir (DIR *dir)
return res; return res;
} }
__off32_t __off64_t
fhandler_disk_file::telldir (DIR *dir) fhandler_disk_file::telldir (DIR *dir)
{ {
return dir->__d_position; return dir->__d_position;
} }
void void
fhandler_disk_file::seekdir (DIR *dir, __off32_t loc) fhandler_disk_file::seekdir (DIR *dir, __off64_t loc)
{ {
rewinddir (dir); rewinddir (dir);
while (loc > dir->__d_position) while (loc > dir->__d_position)
@ -771,7 +779,7 @@ fhandler_cygdrive::set_drives ()
} }
int int
fhandler_cygdrive::fstat (struct stat *buf, path_conv *pc) fhandler_cygdrive::fstat (struct __stat64 *buf, path_conv *pc)
{ {
if (!iscygdrive_root ()) if (!iscygdrive_root ())
return fhandler_disk_file::fstat (buf, pc); return fhandler_disk_file::fstat (buf, pc);
@ -818,14 +826,14 @@ fhandler_cygdrive::readdir (DIR *dir)
return dir->__d_dirent; return dir->__d_dirent;
} }
__off32_t __off64_t
fhandler_cygdrive::telldir (DIR *dir) fhandler_cygdrive::telldir (DIR *dir)
{ {
return fhandler_disk_file::telldir (dir); return fhandler_disk_file::telldir (dir);
} }
void void
fhandler_cygdrive::seekdir (DIR *dir, __off32_t loc) fhandler_cygdrive::seekdir (DIR *dir, __off64_t loc)
{ {
if (!iscygdrive_root ()) if (!iscygdrive_root ())
return fhandler_disk_file::seekdir (dir, loc); return fhandler_disk_file::seekdir (dir, loc);

View File

@ -482,8 +482,8 @@ fhandler_dev_dsp::read (void *ptr, size_t len)
return len; return len;
} }
__off32_t __off64_t
fhandler_dev_dsp::lseek (__off32_t offset, int whence) fhandler_dev_dsp::lseek (__off64_t offset, int whence)
{ {
return 0; return 0;
} }

View File

@ -77,16 +77,16 @@ fhandler_dev_floppy::close (void)
return fhandler_dev_raw::close (); return fhandler_dev_raw::close ();
} }
__off32_t __off64_t
fhandler_dev_floppy::lseek (__off32_t offset, int whence) fhandler_dev_floppy::lseek (__off64_t offset, int whence)
{ {
int ret; int ret;
char buf[512]; char buf[512];
long long drive_size = 0; __off64_t drive_size = 0;
long long lloffset = offset; __off64_t lloffset = offset;
long long current_position; __off64_t current_position;
__off32_t sector_aligned_offset; __off64_t sector_aligned_offset;
__off32_t bytes_left; __off64_t bytes_left;
DWORD low; DWORD low;
LONG high = 0; LONG high = 0;
@ -117,11 +117,11 @@ fhandler_dev_floppy::lseek (__off32_t offset, int whence)
debug_printf ("partition info: %ld (%ld)", debug_printf ("partition info: %ld (%ld)",
pi.StartingOffset.LowPart, pi.StartingOffset.LowPart,
pi.PartitionLength.LowPart); pi.PartitionLength.LowPart);
drive_size = (long long) pi.PartitionLength.QuadPart; drive_size = pi.PartitionLength.QuadPart;
} }
else else
{ {
drive_size = (long long) di.Cylinders.QuadPart * di.TracksPerCylinder * drive_size = di.Cylinders.QuadPart * di.TracksPerCylinder *
di.SectorsPerTrack * di.BytesPerSector; di.SectorsPerTrack * di.BytesPerSector;
} }
debug_printf ("drive size: %ld", drive_size); debug_printf ("drive size: %ld", drive_size);
@ -140,7 +140,7 @@ fhandler_dev_floppy::lseek (__off32_t offset, int whence)
__seterrno (); __seterrno ();
return -1; return -1;
} }
current_position = (long long) low + ((long long) high << 32); current_position = low + ((__off64_t) high << 32);
if (is_writing) if (is_writing)
current_position += devbufend - devbufstart; current_position += devbufend - devbufstart;
else else
@ -156,18 +156,10 @@ fhandler_dev_floppy::lseek (__off32_t offset, int whence)
set_errno (EINVAL); set_errno (EINVAL);
return -1; return -1;
} }
high = lloffset >> 32;
low = lloffset & 0xffffffff;
if (high || (__off32_t) low < 0)
{
set_errno (EFBIG);
return -1;
}
offset = (__off32_t) low;
/* FIXME: sector can possibly be not 512 bytes long */ /* FIXME: sector can possibly be not 512 bytes long */
sector_aligned_offset = (offset / 512) * 512; sector_aligned_offset = (lloffset / 512) * 512;
bytes_left = offset - sector_aligned_offset; bytes_left = lloffset - sector_aligned_offset;
if (whence == SEEK_SET) if (whence == SEEK_SET)
{ {
@ -177,8 +169,10 @@ fhandler_dev_floppy::lseek (__off32_t offset, int whence)
return ret; return ret;
devbufstart = devbufend = 0; devbufstart = devbufend = 0;
if (SetFilePointer (get_handle (), sector_aligned_offset, NULL, FILE_BEGIN) low = sector_aligned_offset & 0xffffffff;
== INVALID_SET_FILE_POINTER) high = sector_aligned_offset >> 32;
if (SetFilePointer (get_handle (), low, &high, FILE_BEGIN)
== INVALID_SET_FILE_POINTER && GetLastError ())
{ {
__seterrno (); __seterrno ();
return -1; return -1;

View File

@ -231,8 +231,8 @@ fhandler_dev_mem::close (void)
return fhandler_base::close (); return fhandler_base::close ();
} }
__off32_t __off64_t
fhandler_dev_mem::lseek (__off32_t offset, int whence) fhandler_dev_mem::lseek (__off64_t offset, int whence)
{ {
switch (whence) switch (whence)
{ {
@ -265,11 +265,11 @@ fhandler_dev_mem::lseek (__off32_t offset, int whence)
HANDLE HANDLE
fhandler_dev_mem::mmap (caddr_t *addr, size_t len, DWORD access, fhandler_dev_mem::mmap (caddr_t *addr, size_t len, DWORD access,
int flags, __off32_t off) int flags, __off64_t off)
{ {
if ((DWORD) off >= mem_size if (off >= mem_size
|| (DWORD) len >= mem_size || (DWORD) len >= mem_size
|| (DWORD) off + len >= mem_size) || off + len >= mem_size)
{ {
set_errno (EINVAL); set_errno (EINVAL);
syscall_printf ("-1 = mmap(): illegal parameter, set EINVAL"); syscall_printf ("-1 = mmap(): illegal parameter, set EINVAL");
@ -402,7 +402,7 @@ fhandler_dev_mem::fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
} }
int int
fhandler_dev_mem::fstat (struct stat *buf, path_conv *pc) fhandler_dev_mem::fstat (struct __stat64 *buf, path_conv *pc)
{ {
this->fhandler_base::fstat (buf, pc); this->fhandler_base::fstat (buf, pc);
buf->st_mode = S_IFCHR; buf->st_mode = S_IFCHR;

View File

@ -132,8 +132,8 @@ fhandler_dev_random::read (void *ptr, size_t len)
return -1; return -1;
} }
__off32_t __off64_t
fhandler_dev_random::lseek (__off32_t, int) fhandler_dev_random::lseek (__off64_t, int)
{ {
return 0; return 0;
} }

View File

@ -245,7 +245,7 @@ fhandler_socket::dup (fhandler_base *child)
} }
int __stdcall int __stdcall
fhandler_socket::fstat (struct stat *buf, path_conv *pc) fhandler_socket::fstat (struct __stat64 *buf, path_conv *pc)
{ {
fhandler_disk_file fh; fhandler_disk_file fh;
fh.set_name (get_name (), get_win32_name ()); fh.set_name (get_name (), get_win32_name ());

View File

@ -147,7 +147,7 @@ fhandler_dev_tape::close (void)
} }
int int
fhandler_dev_tape::fstat (struct stat *buf, path_conv *pc) fhandler_dev_tape::fstat (struct __stat64 *buf, path_conv *pc)
{ {
int ret; int ret;
@ -164,8 +164,8 @@ fhandler_dev_tape::fstat (struct stat *buf, path_conv *pc)
return ret; return ret;
} }
__off32_t __off64_t
fhandler_dev_tape::lseek (__off32_t offset, int whence) fhandler_dev_tape::lseek (__off64_t offset, int whence)
{ {
struct mtop op; struct mtop op;
struct mtpos pos; struct mtpos pos;

View File

@ -41,8 +41,8 @@ fhandler_dev_zero::read (void *ptr, size_t len)
return len; return len;
} }
__off32_t __off64_t
fhandler_dev_zero::lseek (__off32_t, int) fhandler_dev_zero::lseek (__off64_t, int)
{ {
return 0; return 0;
} }

View File

@ -94,8 +94,12 @@ __weak_alias(__globfree13,___globfree13);
#ifdef __LIBC12_SOURCE__ #ifdef __LIBC12_SOURCE__
#define STAT stat12 #define STAT stat12
#else #else
#if defined (__INSIDE_CYGWIN__)
#define STAT __stat64
#else
#define STAT stat #define STAT stat
#endif #endif
#endif
#define DOLLAR '$' #define DOLLAR '$'
#define DOT '.' #define DOT '.'
@ -814,7 +818,11 @@ g_lstat(fn, sb, pglob)
g_Ctoc(fn, buf); g_Ctoc(fn, buf);
if (pglob->gl_flags & GLOB_ALTDIRFUNC) if (pglob->gl_flags & GLOB_ALTDIRFUNC)
return((*pglob->gl_lstat)(buf, sb)); return((*pglob->gl_lstat)(buf, sb));
#ifdef __INSIDE_CYGWIN__
return(lstat64(buf, sb));
#else
return(lstat(buf, sb)); return(lstat(buf, sb));
#endif
} }
static int static int
@ -828,7 +836,11 @@ g_stat(fn, sb, pglob)
g_Ctoc(fn, buf); g_Ctoc(fn, buf);
if (pglob->gl_flags & GLOB_ALTDIRFUNC) if (pglob->gl_flags & GLOB_ALTDIRFUNC)
return((*pglob->gl_stat)(buf, sb)); return((*pglob->gl_stat)(buf, sb));
#ifdef __INSIDE_CYGWIN__
return(stat64(buf, sb));
#else
return(stat(buf, sb)); return(stat(buf, sb));
#endif
} }
static Char * static Char *

View File

@ -16,36 +16,75 @@ details. */
extern "C" { extern "C" {
#endif #endif
struct stat #ifdef __INSIDE_CYGWIN__
{ struct __stat32
dev_t st_dev; {
ino_t st_ino; dev_t st_dev;
mode_t st_mode; ino_t st_ino;
nlink_t st_nlink; mode_t st_mode;
__uid16_t __st_uid16; nlink_t st_nlink;
__gid16_t __st_gid16; __uid16_t st_uid;
dev_t st_rdev; __gid16_t st_gid;
__off32_t __st_size32; dev_t st_rdev;
time_t st_atime; __off32_t st_size;
__uid32_t __st_uid32; time_t st_atime;
time_t st_mtime; long st_spare1;
__uid32_t __st_gid32; time_t st_mtime;
time_t st_ctime; long st_spare2;
long st_spare3; time_t st_ctime;
long st_blksize; long st_spare3;
long st_blocks; blksize_t st_blksize;
__off64_t __st_size64; __blkcnt32_t st_blocks;
long st_spare4[2];
}; };
#ifdef __CYGWIN_USE_BIG_TYPES__ struct __stat64
#define st_uid __st_uid32 {
#define st_gid __st_gid32 dev_t st_dev;
#define st_size __st_size64 ino_t st_ino;
#else mode_t st_mode;
#define st_uid __st_uid16 nlink_t st_nlink;
#define st_gid __st_gid16 __uid32_t st_uid;
#define st_size __st_size32 __gid32_t st_gid;
#endif /* __CYGWIN_USE_BIG_TYPES__ */ dev_t st_rdev;
__off64_t st_size;
time_t st_atime;
long st_spare1;
time_t st_mtime;
long st_spare2;
time_t st_ctime;
long st_spare3;
blksize_t st_blksize;
__blkcnt64_t st_blocks;
long st_spare4[2];
};
extern int fstat64 (int fd, struct __stat64 *buf);
extern int stat64 (const char *file_name, struct __stat64 *buf);
extern int lstat64 (const char *file_name, struct __stat64 *buf);
#endif
struct stat
{
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
off_t st_size;
time_t st_atime;
long st_spare1;
time_t st_mtime;
long st_spare2;
time_t st_ctime;
long st_spare3;
blksize_t st_blksize;
blkcnt_t st_blocks;
long st_spare4[2];
};
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -25,6 +25,16 @@ typedef __off64_t off_t;
typedef __off32_t off_t; typedef __off32_t off_t;
#endif #endif
typedef long blksize_t;
typedef long __blkcnt32_t;
typedef long long __blkcnt64_t;
#ifdef __CYGWIN_USE_BIG_TYPES__
typedef __blkcnt64_t blkcnt_t;
#else
typedef __blkcnt32_t blkcnt_t;
#endif
typedef unsigned short __uid16_t; typedef unsigned short __uid16_t;
typedef unsigned short __gid16_t; typedef unsigned short __gid16_t;
typedef unsigned long __uid32_t; typedef unsigned long __uid32_t;

View File

@ -47,13 +47,13 @@ class mmap_record
HANDLE mapping_handle_; HANDLE mapping_handle_;
int devtype_; int devtype_;
DWORD access_mode_; DWORD access_mode_;
DWORD offset_; __off64_t offset_;
DWORD size_to_map_; DWORD size_to_map_;
caddr_t base_address_; caddr_t base_address_;
DWORD *map_map_; DWORD *map_map_;
public: public:
mmap_record (int fd, HANDLE h, DWORD ac, DWORD o, DWORD s, caddr_t b) : mmap_record (int fd, HANDLE h, DWORD ac, __off64_t o, DWORD s, caddr_t b) :
fdesc_ (fd), fdesc_ (fd),
mapping_handle_ (h), mapping_handle_ (h),
devtype_ (0), devtype_ (0),
@ -95,7 +95,7 @@ class mmap_record
void free_map () { if (map_map_) free (map_map_); } void free_map () { if (map_map_) free (map_map_); }
DWORD find_empty (DWORD pages); DWORD find_empty (DWORD pages);
DWORD map_map (DWORD off, DWORD len); __off64_t map_map (__off64_t off, DWORD len);
BOOL unmap_map (caddr_t addr, DWORD len); BOOL unmap_map (caddr_t addr, DWORD len);
void fixup_map (void); void fixup_map (void);
@ -124,8 +124,8 @@ mmap_record::find_empty (DWORD pages)
return (DWORD)-1; return (DWORD)-1;
} }
DWORD __off64_t
mmap_record::map_map (DWORD off, DWORD len) mmap_record::map_map (__off64_t off, DWORD len)
{ {
DWORD prot, old_prot; DWORD prot, old_prot;
switch (access_mode_) switch (access_mode_)
@ -255,8 +255,8 @@ public:
~list (); ~list ();
mmap_record *add_record (mmap_record r); mmap_record *add_record (mmap_record r);
void erase (int i); void erase (int i);
mmap_record *match (DWORD off, DWORD len); mmap_record *match (__off64_t off, DWORD len);
__off32_t match (caddr_t addr, DWORD len, __off32_t start); long match (caddr_t addr, DWORD len, long start);
}; };
list::list () list::list ()
@ -287,7 +287,7 @@ list::add_record (mmap_record r)
/* Used in mmap() */ /* Used in mmap() */
mmap_record * mmap_record *
list::match (DWORD off, DWORD len) list::match (__off64_t off, DWORD len)
{ {
if (fd == -1 && !off) if (fd == -1 && !off)
{ {
@ -307,14 +307,14 @@ list::match (DWORD off, DWORD len)
} }
/* Used in munmap() */ /* Used in munmap() */
__off32_t long
list::match (caddr_t addr, DWORD len, __off32_t start) list::match (caddr_t addr, DWORD len, __off32_t start)
{ {
for (int i = start + 1; i < nrecs; ++i) for (int i = start + 1; i < nrecs; ++i)
if (addr >= recs[i].get_address () if (addr >= recs[i].get_address ()
&& addr + len <= recs[i].get_address () + recs[i].get_size ()) && addr + len <= recs[i].get_address () + recs[i].get_size ())
return i; return i;
return ILLEGAL_SEEK; return -1;
} }
void void
@ -400,9 +400,9 @@ static map *mmapped_areas;
extern "C" extern "C"
caddr_t caddr_t
mmap (caddr_t addr, size_t len, int prot, int flags, int fd, __off32_t off) mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off)
{ {
syscall_printf ("addr %x, len %d, prot %x, flags %x, fd %d, off %d", syscall_printf ("addr %x, len %d, prot %x, flags %x, fd %d, off %D",
addr, len, prot, flags, fd, off); addr, len, prot, flags, fd, off);
static DWORD granularity; static DWORD granularity;
@ -444,7 +444,7 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, __off32_t off)
fd = -1; fd = -1;
/* Map always in multipliers of `granularity'-sized chunks. */ /* Map always in multipliers of `granularity'-sized chunks. */
DWORD gran_off = off & ~(granularity - 1); __off64_t gran_off = off & ~(granularity - 1);
DWORD gran_len = howmany (len, granularity) * granularity; DWORD gran_len = howmany (len, granularity) * granularity;
fhandler_base *fh; fhandler_base *fh;
@ -464,7 +464,9 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, __off32_t off)
fh = cfd; fh = cfd;
if (fh->get_device () == FH_DISK) if (fh->get_device () == FH_DISK)
{ {
DWORD fsiz = GetFileSize (fh->get_handle (), NULL); DWORD high;
DWORD low = GetFileSize (fh->get_handle (), &high);
__off64_t fsiz = ((__off64_t)high << 32) + low;
fsiz -= gran_off; fsiz -= gran_off;
if (gran_len > fsiz) if (gran_len > fsiz)
gran_len = fsiz; gran_len = fsiz;
@ -554,6 +556,13 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, __off32_t off)
return ret; return ret;
} }
extern "C"
caddr_t
mmap (caddr_t addr, size_t len, int prot, int flags, int fd, __off32_t off)
{
return mmap64 (addr, len, prot, flags, fd, (__off64_t)off);
}
/* munmap () removes an mmapped area. It insists that base area /* munmap () removes an mmapped area. It insists that base area
requested is the same as that mmapped, error if not. */ requested is the same as that mmapped, error if not. */
@ -589,7 +598,7 @@ munmap (caddr_t addr, size_t len)
list *l = mmapped_areas->lists[it]; list *l = mmapped_areas->lists[it];
if (l) if (l)
{ {
__off32_t li = ILLEGAL_SEEK; long li = -1;
if ((li = l->match(addr, len, li)) >= 0) if ((li = l->match(addr, len, li)) >= 0)
{ {
mmap_record *rec = l->recs + li; mmap_record *rec = l->recs + li;
@ -695,7 +704,7 @@ msync (caddr_t addr, size_t len, int flags)
*/ */
HANDLE HANDLE
fhandler_base::mmap (caddr_t *addr, size_t len, DWORD access, fhandler_base::mmap (caddr_t *addr, size_t len, DWORD access,
int flags, __off32_t off) int flags, __off64_t off)
{ {
set_errno (ENODEV); set_errno (ENODEV);
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
@ -726,7 +735,7 @@ fhandler_base::fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
/* Implementation for disk files. */ /* Implementation for disk files. */
HANDLE HANDLE
fhandler_disk_file::mmap (caddr_t *addr, size_t len, DWORD access, fhandler_disk_file::mmap (caddr_t *addr, size_t len, DWORD access,
int flags, __off32_t off) int flags, __off64_t off)
{ {
DWORD protect; DWORD protect;
@ -769,9 +778,10 @@ fhandler_disk_file::mmap (caddr_t *addr, size_t len, DWORD access,
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
void *base = MapViewOfFileEx (h, access, 0, off, len, DWORD high = off >> 32, low = off & 0xffffffff;
void *base = MapViewOfFileEx (h, access, high, low, len,
(flags & MAP_FIXED) ? *addr : NULL); (flags & MAP_FIXED) ? *addr : NULL);
debug_printf ("%x = MapViewOfFileEx (h:%x, access:%x, 0, off:%d, len:%d, addr:%x)", base, h, access, off, len, (flags & MAP_FIXED) ? *addr : NULL); debug_printf ("%x = MapViewOfFileEx (h:%x, access:%x, 0, off:%D, len:%d, addr:%x)", base, h, access, off, len, (flags & MAP_FIXED) ? *addr : NULL);
if (!base || ((flags & MAP_FIXED) && base != *addr)) if (!base || ((flags & MAP_FIXED) && base != *addr))
{ {
if (!base) if (!base)

View File

@ -31,8 +31,8 @@ fhandler_pipe::fhandler_pipe (DWORD devtype)
{ {
} }
__off32_t __off64_t
fhandler_pipe::lseek (__off32_t offset, int whence) fhandler_pipe::lseek (__off64_t offset, int whence)
{ {
debug_printf ("(%d, %d)", offset, whence); debug_printf ("(%d, %d)", offset, whence);
set_errno (ESPIPE); set_errno (ESPIPE);

View File

@ -476,7 +476,7 @@ acl_worker (const char *path, int cmd, int nentries, __aclent16_t *aclbufp,
} }
if (!real_path.has_acls ()) if (!real_path.has_acls ())
{ {
struct stat st; struct __stat64 st;
int ret = -1; int ret = -1;
switch (cmd) switch (cmd)
@ -487,8 +487,8 @@ acl_worker (const char *path, int cmd, int nentries, __aclent16_t *aclbufp,
case GETACL: case GETACL:
if (nentries < 1) if (nentries < 1)
set_errno (EINVAL); set_errno (EINVAL);
else if ((nofollow && !lstat (path, &st)) else if ((nofollow && !lstat64 (path, &st))
|| (!nofollow && !stat (path, &st))) || (!nofollow && !stat64 (path, &st)))
{ {
__aclent16_t lacl[4]; __aclent16_t lacl[4];
if (nentries > 0) if (nentries > 0)

View File

@ -527,10 +527,10 @@ _open (const char *unix_path, int flags, ...)
return res; return res;
} }
extern "C" __off32_t extern "C" __off64_t
_lseek (int fd, __off32_t pos, int dir) lseek64 (int fd, __off64_t pos, int dir)
{ {
__off32_t res; __off64_t res;
sigframe thisframe (mainthread); sigframe thisframe (mainthread);
if (dir != SEEK_SET && dir != SEEK_CUR && dir != SEEK_END) if (dir != SEEK_SET && dir != SEEK_CUR && dir != SEEK_END)
@ -546,11 +546,17 @@ _lseek (int fd, __off32_t pos, int dir)
else else
res = -1; res = -1;
} }
syscall_printf ("%d = lseek (%d, %d, %d)", res, fd, pos, dir); syscall_printf ("%d = lseek (%d, %D, %d)", res, fd, pos, dir);
return res; return res;
} }
extern "C" __off32_t
_lseek (int fd, __off32_t pos, int dir)
{
return lseek64 (fd, (__off64_t) pos, dir);
}
extern "C" int extern "C" int
_close (int fd) _close (int fd)
{ {
@ -956,8 +962,26 @@ fchmod (int fd, mode_t mode)
return chmod (path, mode); return chmod (path, mode);
} }
static void
stat64_to_stat32 (struct __stat64 *src, struct __stat32 *dst)
{
dst->st_dev = src->st_dev;
dst->st_ino = src->st_ino;
dst->st_mode = src->st_mode;
dst->st_nlink = src->st_nlink;
dst->st_uid = src->st_uid;
dst->st_gid = src->st_gid;
dst->st_rdev = src->st_rdev;
dst->st_size = src->st_size;
dst->st_atime = src->st_atime;
dst->st_mtime = src->st_mtime;
dst->st_ctime = src->st_ctime;
dst->st_blksize = src->st_blksize;
dst->st_blocks = src->st_blocks;
}
extern "C" int extern "C" int
_fstat (int fd, struct stat *buf) fstat64 (int fd, struct __stat64 *buf)
{ {
int res; int res;
sigframe thisframe (mainthread); sigframe thisframe (mainthread);
@ -967,7 +991,7 @@ _fstat (int fd, struct stat *buf)
res = -1; res = -1;
else else
{ {
memset (buf, 0, sizeof (struct stat)); memset (buf, 0, sizeof (struct __stat64));
res = cfd->fstat (buf, NULL); res = cfd->fstat (buf, NULL);
} }
@ -975,6 +999,16 @@ _fstat (int fd, struct stat *buf)
return res; return res;
} }
extern "C" int
_fstat (int fd, struct __stat32 *buf)
{
struct __stat64 buf64;
int ret = fstat64 (fd, &buf64);
if (!ret)
stat64_to_stat32 (&buf64, buf);
return ret;
}
/* fsync: P96 6.6.1.1 */ /* fsync: P96 6.6.1.1 */
extern "C" int extern "C" int
fsync (int fd) fsync (int fd)
@ -1011,7 +1045,8 @@ suffix_info stat_suffixes[] =
/* Cygwin internal */ /* Cygwin internal */
int __stdcall int __stdcall
stat_worker (const char *name, struct stat *buf, int nofollow, path_conv *pc) stat_worker (const char *name, struct __stat64 *buf, int nofollow,
path_conv *pc)
{ {
int res = -1; int res = -1;
path_conv real_path; path_conv real_path;
@ -1038,7 +1073,7 @@ stat_worker (const char *name, struct stat *buf, int nofollow, path_conv *pc)
{ {
debug_printf ("(%s, %p, %d, %p), file_attributes %d", name, buf, nofollow, debug_printf ("(%s, %p, %d, %p), file_attributes %d", name, buf, nofollow,
pc, (DWORD) real_path); pc, (DWORD) real_path);
memset (buf, 0, sizeof (struct stat)); memset (buf, 0, sizeof (struct __stat64));
res = fh->fstat (buf, pc); res = fh->fstat (buf, pc);
} }
@ -1051,22 +1086,43 @@ stat_worker (const char *name, struct stat *buf, int nofollow, path_conv *pc)
} }
extern "C" int extern "C" int
_stat (const char *name, struct stat *buf) stat64 (const char *name, struct __stat64 *buf)
{ {
sigframe thisframe (mainthread); sigframe thisframe (mainthread);
syscall_printf ("entering"); syscall_printf ("entering");
return stat_worker (name, buf, 0); return stat_worker (name, buf, 0);
} }
extern "C" int
_stat (const char *name, struct __stat32 *buf)
{
struct __stat64 buf64;
int ret = stat64 (name, &buf64);
if (!ret)
stat64_to_stat32 (&buf64, buf);
return ret;
}
/* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */ /* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */
extern "C" int extern "C" int
lstat (const char *name, struct stat *buf) lstat64 (const char *name, struct __stat64 *buf)
{ {
sigframe thisframe (mainthread); sigframe thisframe (mainthread);
syscall_printf ("entering"); syscall_printf ("entering");
return stat_worker (name, buf, 1); return stat_worker (name, buf, 1);
} }
/* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */
extern "C" int
cygwin_lstat (const char *name, struct __stat32 *buf)
{
struct __stat64 buf64;
int ret = lstat64 (name, &buf64);
if (!ret)
stat64_to_stat32 (&buf64, buf);
return ret;
}
extern int acl_access (const char *, int); extern int acl_access (const char *, int);
extern "C" int extern "C" int
@ -1083,7 +1139,7 @@ access (const char *fn, int flags)
if (allow_ntsec) if (allow_ntsec)
return acl_access (fn, flags); return acl_access (fn, flags);
struct stat st; struct __stat64 st;
int r = stat_worker (fn, &st, 0); int r = stat_worker (fn, &st, 0);
if (r) if (r)
return -1; return -1;
@ -1607,9 +1663,8 @@ setmode (int fd, int mode)
return res; return res;
} }
/* ftruncate: P96 5.6.7.1 */
extern "C" int extern "C" int
ftruncate (int fd, __off32_t length) ftruncate64 (int fd, __off64_t length)
{ {
sigframe thisframe (mainthread); sigframe thisframe (mainthread);
int res = -1; int res = -1;
@ -1626,7 +1681,7 @@ ftruncate (int fd, __off32_t length)
if (cfd->get_handle ()) if (cfd->get_handle ())
{ {
/* remember curr file pointer location */ /* remember curr file pointer location */
__off32_t prev_loc = cfd->lseek (0, SEEK_CUR); __off64_t prev_loc = cfd->lseek (0, SEEK_CUR);
cfd->lseek (length, SEEK_SET); cfd->lseek (length, SEEK_SET);
if (!SetEndOfFile (h)) if (!SetEndOfFile (h))
@ -1635,7 +1690,7 @@ ftruncate (int fd, __off32_t length)
res = 0; res = 0;
/* restore original file pointer location */ /* restore original file pointer location */
cfd->lseek (prev_loc, 0); cfd->lseek (prev_loc, SEEK_SET);
} }
} }
} }
@ -1644,9 +1699,16 @@ ftruncate (int fd, __off32_t length)
return res; return res;
} }
/* ftruncate: P96 5.6.7.1 */
extern "C" int
ftruncate (int fd, __off32_t length)
{
return ftruncate64 (fd, (__off64_t)length);
}
/* truncate: Provided by SVR4 and 4.3+BSD. Not part of POSIX.1 or XPG3 */ /* truncate: Provided by SVR4 and 4.3+BSD. Not part of POSIX.1 or XPG3 */
extern "C" int extern "C" int
truncate (const char *pathname, __off32_t length) truncate64 (const char *pathname, __off64_t length)
{ {
sigframe thisframe (mainthread); sigframe thisframe (mainthread);
int fd; int fd;
@ -1666,6 +1728,13 @@ truncate (const char *pathname, __off32_t length)
return res; return res;
} }
/* truncate: Provided by SVR4 and 4.3+BSD. Not part of POSIX.1 or XPG3 */
extern "C" int
truncate (const char *pathname, __off32_t length)
{
return truncate64 (pathname, (__off64_t)length);
}
extern "C" long extern "C" long
get_osfhandle (int fd) get_osfhandle (int fd)
{ {
@ -2377,6 +2446,7 @@ logout (char *line)
{ {
struct utmp *ut; struct utmp *ut;
struct utmp ut_buf[100]; struct utmp ut_buf[100];
/* FIXME: utmp file access is not 64 bit clean for now. */
__off32_t pos = 0; /* Position in file */ __off32_t pos = 0; /* Position in file */
DWORD rd; DWORD rd;

View File

@ -45,6 +45,7 @@ static NO_COPY wincaps wincap_unknown = {
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_raw_devices:false, has_raw_devices:false,
has_valid_processorlevel:false, has_valid_processorlevel:false,
has_64bit_file_access:false,
}; };
static NO_COPY wincaps wincap_95 = { static NO_COPY wincaps wincap_95 = {
@ -81,6 +82,7 @@ static NO_COPY wincaps wincap_95 = {
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_raw_devices:false, has_raw_devices:false,
has_valid_processorlevel:false, has_valid_processorlevel:false,
has_64bit_file_access:false,
}; };
static NO_COPY wincaps wincap_95osr2 = { static NO_COPY wincaps wincap_95osr2 = {
@ -117,6 +119,7 @@ static NO_COPY wincaps wincap_95osr2 = {
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_raw_devices:false, has_raw_devices:false,
has_valid_processorlevel:false, has_valid_processorlevel:false,
has_64bit_file_access:false,
}; };
static NO_COPY wincaps wincap_98 = { static NO_COPY wincaps wincap_98 = {
@ -153,6 +156,7 @@ static NO_COPY wincaps wincap_98 = {
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_raw_devices:false, has_raw_devices:false,
has_valid_processorlevel:true, has_valid_processorlevel:true,
has_64bit_file_access:false,
}; };
static NO_COPY wincaps wincap_98se = { static NO_COPY wincaps wincap_98se = {
@ -189,6 +193,7 @@ static NO_COPY wincaps wincap_98se = {
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_raw_devices:false, has_raw_devices:false,
has_valid_processorlevel:true, has_valid_processorlevel:true,
has_64bit_file_access:false,
}; };
static NO_COPY wincaps wincap_me = { static NO_COPY wincaps wincap_me = {
@ -225,6 +230,7 @@ static NO_COPY wincaps wincap_me = {
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_raw_devices:false, has_raw_devices:false,
has_valid_processorlevel:true, has_valid_processorlevel:true,
has_64bit_file_access:false,
}; };
static NO_COPY wincaps wincap_nt3 = { static NO_COPY wincaps wincap_nt3 = {
@ -261,6 +267,7 @@ static NO_COPY wincaps wincap_nt3 = {
has_try_enter_critical_section:false, has_try_enter_critical_section:false,
has_raw_devices:true, has_raw_devices:true,
has_valid_processorlevel:true, has_valid_processorlevel:true,
has_64bit_file_access:true,
}; };
static NO_COPY wincaps wincap_nt4 = { static NO_COPY wincaps wincap_nt4 = {
@ -297,6 +304,7 @@ static NO_COPY wincaps wincap_nt4 = {
has_try_enter_critical_section:true, has_try_enter_critical_section:true,
has_raw_devices:true, has_raw_devices:true,
has_valid_processorlevel:true, has_valid_processorlevel:true,
has_64bit_file_access:true,
}; };
static NO_COPY wincaps wincap_nt4sp4 = { static NO_COPY wincaps wincap_nt4sp4 = {
@ -333,6 +341,7 @@ static NO_COPY wincaps wincap_nt4sp4 = {
has_try_enter_critical_section:true, has_try_enter_critical_section:true,
has_raw_devices:true, has_raw_devices:true,
has_valid_processorlevel:true, has_valid_processorlevel:true,
has_64bit_file_access:true,
}; };
static NO_COPY wincaps wincap_2000 = { static NO_COPY wincaps wincap_2000 = {
@ -369,6 +378,7 @@ static NO_COPY wincaps wincap_2000 = {
has_try_enter_critical_section:true, has_try_enter_critical_section:true,
has_raw_devices:true, has_raw_devices:true,
has_valid_processorlevel:true, has_valid_processorlevel:true,
has_64bit_file_access:true,
}; };
static NO_COPY wincaps wincap_xp = { static NO_COPY wincaps wincap_xp = {
@ -405,6 +415,7 @@ static NO_COPY wincaps wincap_xp = {
has_try_enter_critical_section:true, has_try_enter_critical_section:true,
has_raw_devices:true, has_raw_devices:true,
has_valid_processorlevel:true, has_valid_processorlevel:true,
has_64bit_file_access:true,
}; };
wincapc NO_COPY wincap; wincapc NO_COPY wincap;

View File

@ -46,6 +46,7 @@ struct wincaps
unsigned has_try_enter_critical_section : 1; unsigned has_try_enter_critical_section : 1;
unsigned has_raw_devices : 1; unsigned has_raw_devices : 1;
unsigned has_valid_processorlevel : 1; unsigned has_valid_processorlevel : 1;
unsigned has_64bit_file_access : 1;
}; };
class wincapc class wincapc
@ -97,6 +98,7 @@ public:
bool IMPLEMENT (has_try_enter_critical_section) bool IMPLEMENT (has_try_enter_critical_section)
bool IMPLEMENT (has_raw_devices) bool IMPLEMENT (has_raw_devices)
bool IMPLEMENT (has_valid_processorlevel) bool IMPLEMENT (has_valid_processorlevel)
bool IMPLEMENT (has_64bit_file_access)
#undef IMPLEMENT #undef IMPLEMENT
}; };

View File

@ -147,7 +147,7 @@ void uinfo_init (void);
#define ILLEGAL_UID ((__uid16_t)-1) #define ILLEGAL_UID ((__uid16_t)-1)
#define ILLEGAL_GID ((__gid16_t)-1) #define ILLEGAL_GID ((__gid16_t)-1)
#define ILLEGAL_SEEK ((__off32_t)-1) #define ILLEGAL_SEEK ((__off64_t)-1)
/* various events */ /* various events */
void events_init (void); void events_init (void);
@ -179,7 +179,7 @@ extern int cygwin_finished_initializing;
void __stdcall set_std_handle (int); void __stdcall set_std_handle (int);
int __stdcall writable_directory (const char *file); int __stdcall writable_directory (const char *file);
int __stdcall stat_dev (DWORD, int, unsigned long, struct stat *); int __stdcall stat_dev (DWORD, int, unsigned long, struct __stat64 *);
extern BOOL allow_ntsec; extern BOOL allow_ntsec;
unsigned long __stdcall hash_path_name (unsigned long hash, const char *name) __attribute__ ((regparm(2))); unsigned long __stdcall hash_path_name (unsigned long hash, const char *name) __attribute__ ((regparm(2)));
@ -230,7 +230,7 @@ extern "C" void __malloc_lock (struct _reent *);
extern "C" void __malloc_unlock (struct _reent *); extern "C" void __malloc_unlock (struct _reent *);
class path_conv; class path_conv;
int __stdcall stat_worker (const char *name, struct stat *buf, int nofollow, int __stdcall stat_worker (const char *name, struct __stat64 *buf, int nofollow,
path_conv *pc = NULL) __attribute__ ((regparm (3))); path_conv *pc = NULL) __attribute__ ((regparm (3)));
/**************************** Exports ******************************/ /**************************** Exports ******************************/