This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

pread() from /dev/sda fails with: Illegal seek


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

Attachment: cygcheck-s
Description: Binary data

--
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]