* fhandler.cc (fhandler_base::lseek): Drop 9x considerations.

* fhandler_disk_file.cc (fhandler_disk_file::lock): Ditto.
	* wincap.cc: Remove lock_file_highword and has_64bit_file_access
	throughout.
	* wincap.h: Ditto.
This commit is contained in:
Corinna Vinschen 2007-02-23 09:49:49 +00:00
parent 8e17bd8685
commit 0ed760d75e
5 changed files with 13 additions and 47 deletions

View File

@ -1,3 +1,11 @@
2007-02-23 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::lseek): Drop 9x considerations.
* fhandler_disk_file.cc (fhandler_disk_file::lock): Ditto.
* wincap.cc: Remove lock_file_highword and has_64bit_file_access
throughout.
* wincap.h: Ditto.
2007-02-22 Corinna Vinschen <corinna@vinschen.de>
* cygheap.h (struct cwdstuff): Remove sync member and keep_in_sync

View File

@ -1031,18 +1031,6 @@ fhandler_base::lseek (_off64_t offset, int whence)
{
_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
right place. */
@ -1059,17 +1047,10 @@ fhandler_base::lseek (_off64_t offset, int whence)
: (whence == SEEK_CUR ? FILE_CURRENT : FILE_END);
LONG off_low = ((__uint64_t) offset) & UINT32_MAX;
LONG *poff_high, off_high;
if (!wincap.has_64bit_file_access ())
poff_high = NULL;
else
{
off_high = ((__uint64_t) offset) >> 32LL;
poff_high = &off_high;
}
LONG off_high = ((__uint64_t) offset) >> 32LL;
debug_printf ("setting file pointer to %u (high), %u (low)", off_high, off_low);
res = SetFilePointer (get_handle (), off_low, poff_high, win32_whence);
res = SetFilePointer (get_handle (), off_low, &off_high, win32_whence);
if (res == INVALID_SET_FILE_POINTER && GetLastError ())
{
__seterrno ();
@ -1077,11 +1058,10 @@ fhandler_base::lseek (_off64_t offset, int whence)
}
else
{
if (poff_high)
res += (_off64_t) *poff_high << 32;
res += (_off64_t) off_high << 32;
/* When next we write(), we will check to see if *this* seek went beyond
the end of the file, and back-seek and fill with zeros if so - DJ */
the end of the file and if so, potentially sparsify the file. */
did_lseek (true);
/* If this was a SEEK_CUR with offset 0, we still might have

View File

@ -1264,11 +1264,7 @@ fhandler_disk_file::lock (int cmd, struct __flock64 *fl)
{
/* Special case if len == 0 for POSIX means lock to the end of
the entire file (and all future extensions). */
/* CV, 2003-12-03: And yet another Win 9x bugginess. For some reason
offset + length must be <= 0x100000000. I'm using 0xffffffff as
upper border here, this should be sufficient. */
len_low = UINT32_MAX - (wincap.lock_file_highword () ? 0 : off_low);
len_high = wincap.lock_file_highword ();
len_low = len_high = UINT32_MAX;
}
else
{

View File

@ -13,7 +13,6 @@ details. */
/* Minimal set of capabilities which is equivalent to NT4. */
static NO_COPY wincaps wincap_unknown = {
lock_file_highword:UINT32_MAX,
chunksize:0,
heapslop:0x0,
is_server:false,
@ -25,7 +24,6 @@ static NO_COPY wincaps wincap_unknown = {
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_64bit_file_access:true,
has_process_io_counters:false,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
@ -52,7 +50,6 @@ static NO_COPY wincaps wincap_unknown = {
};
static NO_COPY wincaps wincap_nt4 = {
lock_file_highword:UINT32_MAX,
chunksize:0,
heapslop:0x0,
is_server:false,
@ -64,7 +61,6 @@ static NO_COPY wincaps wincap_nt4 = {
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_64bit_file_access:true,
has_process_io_counters:false,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
@ -91,7 +87,6 @@ static NO_COPY wincaps wincap_nt4 = {
};
static NO_COPY wincaps wincap_nt4sp4 = {
lock_file_highword:UINT32_MAX,
chunksize:0,
heapslop:0x0,
is_server:false,
@ -103,7 +98,6 @@ static NO_COPY wincaps wincap_nt4sp4 = {
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_64bit_file_access:true,
has_process_io_counters:false,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
@ -130,7 +124,6 @@ static NO_COPY wincaps wincap_nt4sp4 = {
};
static NO_COPY wincaps wincap_2000 = {
lock_file_highword:UINT32_MAX,
chunksize:0,
heapslop:0x0,
is_server:false,
@ -142,7 +135,6 @@ static NO_COPY wincaps wincap_2000 = {
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_64bit_file_access:true,
has_process_io_counters:true,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
@ -169,7 +161,6 @@ static NO_COPY wincaps wincap_2000 = {
};
static NO_COPY wincaps wincap_xp = {
lock_file_highword:UINT32_MAX,
chunksize:0,
heapslop:0x0,
is_server:false,
@ -181,7 +172,6 @@ static NO_COPY wincaps wincap_xp = {
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_64bit_file_access:true,
has_process_io_counters:true,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
@ -208,7 +198,6 @@ static NO_COPY wincaps wincap_xp = {
};
static NO_COPY wincaps wincap_2003 = {
lock_file_highword:UINT32_MAX,
chunksize:0,
heapslop:0x4,
is_server:true,
@ -220,7 +209,6 @@ static NO_COPY wincaps wincap_2003 = {
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_64bit_file_access:true,
has_process_io_counters:true,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
@ -247,7 +235,6 @@ static NO_COPY wincaps wincap_2003 = {
};
static NO_COPY wincaps wincap_vista = {
lock_file_highword:UINT32_MAX,
chunksize:0,
heapslop:0x4,
is_server:false,
@ -259,7 +246,6 @@ static NO_COPY wincaps wincap_vista = {
has_unreliable_pipes:false,
has_raw_devices:true,
has_valid_processorlevel:true,
has_64bit_file_access:true,
has_process_io_counters:true,
supports_reading_modem_output_lines:true,
needs_memory_protection:true,

View File

@ -13,7 +13,6 @@ details. */
struct wincaps
{
DWORD lock_file_highword;
DWORD chunksize;
DWORD heapslop;
unsigned is_server : 1;
@ -25,7 +24,6 @@ struct wincaps
unsigned has_unreliable_pipes : 1;
unsigned has_raw_devices : 1;
unsigned has_valid_processorlevel : 1;
unsigned has_64bit_file_access : 1;
unsigned has_process_io_counters : 1;
unsigned supports_reading_modem_output_lines : 1;
unsigned needs_memory_protection : 1;
@ -68,7 +66,6 @@ public:
#define IMPLEMENT(cap) cap() const { return ((wincaps *) this->caps)->cap; }
DWORD IMPLEMENT (lock_file_highword)
DWORD IMPLEMENT (chunksize)
DWORD IMPLEMENT (heapslop)
bool IMPLEMENT (is_server)
@ -80,7 +77,6 @@ public:
bool IMPLEMENT (has_unreliable_pipes)
bool IMPLEMENT (has_raw_devices)
bool IMPLEMENT (has_valid_processorlevel)
bool IMPLEMENT (has_64bit_file_access)
bool IMPLEMENT (has_process_io_counters)
bool IMPLEMENT (supports_reading_modem_output_lines)
bool IMPLEMENT (needs_memory_protection)