question about pread() while reading /dev/sdb
Corinna Vinschen
corinna-cygwin@cygwin.com
Wed Jun 7 09:34:00 GMT 2017
On Jun 6 19:27, joso@post.cz wrote:
> Hello, I'm porting tool from Linux envirmnment to Windows Cygwin.
> I'm unable to get correct data from pread() while reading /dev/sdx
> On Linux it works as expected, under Cygwin I receive uncorrect data.
>
> I have isolated the problem with the following program:
>
> #include stdio.h
> #include sys/types.h
> #include sys/stat.h
> #include fcntl.h
> #include unistd.h
>
> int main(int argc, char *argv[])
> {
> unsigned char sbuff[512];
> int f1;
> f1=open(argv[1], O_RDWR);
> pread(f1, sbuff, 512, 0);
> for(int i=0; i 512; i++) printf("%x ",sbuff[i]);
> close(f1);
> }
>
> If the argument is regular file it works. But if the argument is /dev/sdb it does not provide correct data. The shell is run under Administrator permission.
> Thank you for your opinion.
Cygwin's pread is only implemented for regular files at the moment,
for all other objects it returns -1 with errno set to ESPIPE.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20170607/2ad591e4/attachment.sig>
More information about the Cygwin
mailing list