This is the mail archive of the
cygwin-patches@sources.redhat.com
mailing list for the Cygwin project.
Re: lseek() fails to seek on /dev/fd0 ('\\.\A:')
Hi!
Tuesday, 27 February, 2001 Corinna Vinschen cygwin-patches@cygwin.com wrote:
CV> On Tue, Feb 27, 2001 at 12:45:39PM +0300, Egor Duda wrote:
>> CV> Did you try that even on raw partitions (\\.\X:)? From the MSDN:
>>
>> CV> "The IOCTL_DISK_GET_DRIVE_GEOMETRY control code retrieves information
>> CV> about the physical disk's geometry"
>>
>> CV> so I assume it will only work for raw harddisks (\\.\physicaldriveN).
>>
>> Yep, you're right. I can work around this with
>> IOCTL_DISK_GET_PARTITION_INFO ioctl, but here comes the problem with
>> off_t and size_t being long int :( So we won't be able to work with
>> drives and partitions longer then 2G (which are very frequent
>> nowadays). Should we return EINVAL in such cases?
CV> I have just checked on Linux kernel 2.2.x. For some reason it returns
CV> the following on partitions and physical drives:
CV> lseek (fd, 0, SEEK_END) = 0 and the file pointer is set to the
CV> beginning(!) of the raw device.
CV> lseek (fd, pos != 0, SEEK_END) = -1 (EINVAL)
CV> So if we want to be Linux compatible we could make our life very easy.
CV> Has somebody a 2.4 kernel to test the behaviour there?
i've just tested it under 2.4.0. it seeks correctly from the end of device
and returns device_size + offset.
if return value > 2G, it returns -1 with EOVERFLOW. I feel EFBIG is
more appropriate here, but it's arguable.
Egor. mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19
floppy-lseek.diff
floppy-lseek.ChangeLog