lseek() fails to seek on /dev/fd0 ('\\.\A:')

Corinna Vinschen cygwin-patches@cygwin.com
Tue Feb 27 03:02:00 GMT 2001


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?

I have just checked on Linux kernel 2.2.x. For some reason it returns
the following on partitions and physical drives:

lseek (fd, 0, SEEK_END) = 0 and the file pointer is set to the
beginning(!) of the raw device.

lseek (fd, pos != 0, SEEK_END) = -1 (EINVAL)

So if we want to be Linux compatible we could make our life very easy.

Has somebody a 2.4 kernel to test the behaviour there?

> BTW,   does   anybody  have  MO drives around to test this ioctls with
> partitioned removable media?

I have a ZIP-100 drive which is what you're looking for. I have
used it for testing the raw stuff earlier.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.



More information about the Cygwin-patches mailing list