From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76283 invoked by alias); 6 Jun 2017 17:27:24 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 75585 invoked by uid 89); 6 Jun 2017 17:27:23 -0000 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 Received: from mxd1.seznam.cz (HELO mxd1.seznam.cz) (77.75.78.95) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Jun 2017 17:27:21 +0000 Received: from email.seznam.cz by email-smtpc6a.ko.seznam.cz (email-smtpc6a.ko.seznam.cz [10.53.10.165]) id 198f06a32482ed8a19262594; Tue, 06 Jun 2017 19:27:23 +0200 (CEST) Received: from unknown ([::ffff:194.228.96.38]) by email.seznam.cz (szn-ebox-4.5.237) with HTTP; Tue, 06 Jun 2017 19:27:13 +0200 (CEST) From: To: Subject: question about pread() while reading /dev/sdb Date: Tue, 06 Jun 2017 17:27:00 -0000 Message-Id: <1d1.g7EO.42ZlNnJjks{.1PDkNn@seznam.cz> Mime-Version: 1.0 (szn-mime-2.0.14) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2017-06/txt/msg00026.txt.bz2 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=3Dopen(argv[1], O_RDWR); pread(f1, sbuff, 512, 0); for(int i=3D0; i 512; i++) printf("%x ",sbuff[i]); close(f1); } If the argument is regular file it works. But if the argument is /dev/sdb i= t does not provide correct data. The shell is run under Administrator permi= ssion. 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