This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Cygwin 1.7: O_DIRECT read from raw devices returns EOF
- From: "Christian Franke" <Christian dot Franke at t-online dot de>
- To: cygwin at cygwin dot com
- Date: Fri, 21 Nov 2008 13:58:30 +0100
- Subject: Cygwin 1.7: O_DIRECT read from raw devices returns EOF
- Reply-to: "Christian Franke" <Christian dot Franke at t-online dot de>
On cygwin 1.7.0-32, read() from raw devices returns 0 always if device
was opened with O_DIRECT.
Testcase:
$ dd if=/dev/sdb of=/dev/null count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.027 s, 19.0 kB/s
$ dd if=/dev/sdb of=/dev/null count=1 iflag=direct
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0 s, Infinity B/s
Same for /dev/scd0, /dev/fd0.
Bug was probably introduced in fhandler_dev_floppy.cc 1.51:
void
fhandler_dev_floppy::raw_read (void *ptr, size_t& ulen)
{
...
DWORD bytes_to_read = 0;
...
if (devbuf)
{ /* !O_DIRECT ... */ }
else
{
_off64_t current_position = get_current_position ();
if (current_position + bytes_to_read >= drive_size)
bytes_to_read = drive_size - current_position;
if (bytes_to_read && !read_file (p, len, &bytes_read, &ret))
...
In the O_DIRECT case, bytes_to_read is always 0.
Christian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/