Mail Archives: djgpp-workers/1998/09/30/14:12:05
This is a suggested patch to mntent.c.
The problem: On a Compaq Presario with one floppy drive, if there was no
diskette in drive a:, the next call would search for drive b:. It would
take
from 30 to 40 seconds for the biosdisk call to return, during which time
the
system would appear to be hung. I presume this problem is unique to the
Compaq
bios.
The solution: Eli suggested reordering the call sequence so that the
A:/B:
drive mapping function was called before the biosdisk. This solves the
problem
on the Compaq, and still corectly recognizes the A: and B: drives on a
ZDS box
that does actually have two floppies. It does not appear that
'assigned_to'
call ever tries to access a physical drive, so I don't think there will
be any
side effects to the code swap, but further testing on other systems
would be
desirable.
Documentation: There are no changes in the usage of the defined
function,
getmntent.
*** src/libc/compat/mntent/mntent.old Mon Aug 12 23:14:46 1996
--- src/libc/compat/mntent/mntent.c Wed Sep 23 20:02:10 1998
***************
*** 452,458 ****
int cds_address_offset;
/* Need TRUE DOS version. */
unsigned short true_dos_version = _get_dos_version(1);
!
dos_mem_base = _go32_info_block.selector_for_linear_memory;
our_mem_base = _my_ds();
--- 452,458 ----
int cds_address_offset;
/* Need TRUE DOS version. */
unsigned short true_dos_version = _get_dos_version(1);
!
dos_mem_base = _go32_info_block.selector_for_linear_memory;
our_mem_base = _my_ds();
***************
*** 546,551 ****
--- 546,561 ----
if (drive_number == 2 && skip_drive_b)
continue;
+
+ /* See whether drive A: is mapped to B: and if it is, change
+ DRIVE_NUMBER on the fly and raise the flag to skip drive
+ number 2 next time we are called (meaning there is only
+ one floppy drive). */
+ if (drive_number == 1 && (drive_a_mapping = assigned_to(1)) > 0)
+ {
+ skip_drive_b = 1;
+ drive_number = drive_a_mapping;
+ }
/* Work around a possible bug in QDPMI: _truename() would
sometimes
crash the calling program when there is no disk in a (floppy)
drive. To avoid this, we have to check if the drive is empty
***************
*** 560,582 ****
operation after disk change, each time resetting the
drive, until something other than 6 is returned or we
run out of our patience. */
! while (++count < 10 && (bios_status =
biosdisk(2, drive_number - 1, 0, 0, 1, 1, buf)) == 6)
biosdisk(0, drive_number - 1, 0, 0, 0, 0, NULL);
/* If the loop ends with nonzero status, fail. */
if (bios_status != 0)
continue;
- }
-
- /* See whether drive A: is mapped to B: and if it is, change
- DRIVE_NUMBER on the fly and raise the flag to skip drive
- number 2 next time we are called (meaning there is only
- one floppy drive). */
- if (drive_number == 1 && (drive_a_mapping = assigned_to(1)) > 0)
- {
- skip_drive_b = 1;
- drive_number = drive_a_mapping;
}
drvstr_len = sprintf(drive_string, "%c:\\", '@' + drive_number);
--- 570,582 ----
operation after disk change, each time resetting the
drive, until something other than 6 is returned or we
run out of our patience. */
! while (++count < 2 && (bios_status =
biosdisk(2, drive_number - 1, 0, 0, 1, 1, buf)) == 6)
biosdisk(0, drive_number - 1, 0, 0, 0, 0, NULL);
/* If the loop ends with nonzero status, fail. */
if (bios_status != 0)
continue;
}
X-Mozilla-Status: 0009rintf(drive_string, "%c:\\", '@' + drive_number);
- Raw text -