pread() from /dev/sda fails with: Illegal seek
David Balažic
xerces9@gmail.com
Sat Jan 11 14:10:00 GMT 2020
Hi!
I'm porting an app from Linux to Cygwin and stumbled on this problem:
pread on /dev/sda fails with Illegal seek.
The simplified code is:
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
unsigned int sector_size = 512;
void *buf = calloc(sector_size,1);
int fd = open("/dev/sda", O_DIRECT | O_RDONLY);
if (-1 == pread(fd, buf, sector_size, 0)) {
perror("pread failed");
}
}
# g++ test.cc
# ./a # run as adnministrator
pread failed: Illegal seek
Why is that?
cygcheck -s output attached.
Summary: cygwin 3.1.2-1 , Windows 8.1 , all 64 bit
Regards,
David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck-s
Type: application/octet-stream
Size: 12161 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20200111/c3935b77/attachment.obj>
-------------- next part --------------
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list