delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/06/06/13:27:42

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:subject:date:message-id:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=fAN
nm2j3M+nNZ2yVtERZvETHnK+KJCzrNbZIElElLYPiMPwsHNO6W22XcwJD7DSgi4f
iPRayy31w/B2/uQfHU5xTeAP36f+Fdj9O4VtGfQpVxjUmbm19vUPZw8MpQqdpAla
Pnygm+9vci1HLRjav61Im5gnLAFL8qQRf6B8AhD8=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:to:subject:date:message-id:mime-version
:content-type:content-transfer-encoding; s=default; bh=RT4xkek7g
wNkLEfOJsof3pL3y3E=; b=vhdWVz0IckX1pWaz1malgQGvYE3L91OwarZ8bwbyo
uU+FwfPDD4DkoKYzC2uy/JKj3r48ym1Dr4agQsI+esVu7VUZatE8dNAZnRmmKZNt
/Erf6a7vCT6OiJSUB1TkMPSv5Wh/BqQ6YATSN8FT7838N9xKupOdQt1c5BodQNw/
40=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=isolated, Administrator, administrator
X-HELO: mxd1.seznam.cz
From: <joso AT post DOT cz>
To: <cygwin AT cygwin DOT com>
Subject: question about pread() while reading /dev/sdb
Date: Tue, 06 Jun 2017 19:27:13 +0200 (CEST)
Message-Id: <1d1.g7EO.42ZlNnJjks{.1PDkNn@seznam.cz>
Mime-Version: 1.0 (szn-mime-2.0.14)
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id v56HReRl002218

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

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019