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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=l8YAvL6p3vrgzFxY6RYXQ7GFEg/9U2xYYOlJ8gdzkkCYQ/KFD/BNV Xn/6KNeQcCf2c04uP9sjlUnKED0hug1Hao4Q+WzeZEFJX79KgpKmN9e3zO3Xq1ln LedoyYYxnTCrYohGUHd8v89dagVfg4lvIpDjuoFihGLO6/FvBAvqqY= 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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=D5uVthxSiejZrM5+6PsNl7uq3Ww=; b=bvquCsGFTKuHPNOOdLoPFWDVU5h7 VVYq7hVwGl8wyTtyWDj3fdYyORPUHuIwBdlKBUE4sX7sl2SEaW2pdPPh3vHt+75U MbA9bLB6+U8hB+KGiO4lT8pDP7gjY5W4BeEkDPKsgdXOd+Tr9FwJaqrECixCMBGY tBxjKPB6FfUfvbA= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=-101.9 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=josopostcz, H*c:application, administrator, Administrator X-HELO: drew.franken.de Date: Wed, 7 Jun 2017 11:34:29 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: question about pread() while reading /dev/sdb Message-ID: <20170607093429.GC5971@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <1d1.g7EO.42ZlNnJjks{.1PDkNn AT seznam DOT cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uXxzq0nDebZQVNAZ" Content-Disposition: inline In-Reply-To: <1d1.g7EO.42ZlNnJjks{.1PDkNn@seznam.cz> User-Agent: Mutt/1.8.0 (2017-02-23) --uXxzq0nDebZQVNAZ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Jun 6 19:27, joso AT post DOT 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. >=20 > I have isolated the problem with the following program: >=20 > #include stdio.h > #include sys/types.h > #include sys/stat.h > #include fcntl.h > #include unistd.h >=20 > 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); > } >=20 > 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 per= mission. > 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 --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --uXxzq0nDebZQVNAZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZN8ilAAoJEPU2Bp2uRE+gItEP/35e61FnEXYiZ51J1Wo/4j1l MuFh2I+gczJPIhS6Y0W+IiJ/iuvnraR5kAAsAd98WunMWy4qhx51k89O65KYcb0C WndgA8Gys599FMhjtTP1br54sipwvHg9cAOICV15OdD/BkDqtlTHXaN8R4A4xV5y 5IhvS6Xj+fwswwsGCI8kjtX+9RqeYqG1sbWppI8gOGjQadAvjiRLh3xFjri7ILY5 DRwXDAIOU8AoX6pLJqyq79WiBhA6JgTyd67pVt5TlRRNFbWOItPKwb6qp+UraHKE 04jiwUFA1yZL5no++R04Y+G0nwTFfud9C7KJFfycKVZurV31gAKqXfU0RdAfihzJ KU0PMbrwUvJh8QwpIqNrl5uTjeqbom2L+mOF4kkFMsdNwceh+3lkqmbtQQUCUex4 xzFkTvdQrwgdYi9Nqv4AGYuauMcoxuQqBbbxuFrV02zBmrTiC1k6DFQ/aHfrgFAv EbGBCv96aUk70TZiFA3x1QRZc70Erw1PcCya14QjzTn3WVcL0MYU3k+e6SURbZAJ 6VzVW03I53W+vajdBD7aPNajTfwAk/oV2CEo0DrzCuQQW7vk3hW22lkXXFca/LR7 vvoICpe+EEkN2S5eqUAMJUQystNFjHkeQ24nn6TSqXplrTH973+75RGLVOw8PCiK k7wLfzJiEyebk98wAxVP =fWuZ -----END PGP SIGNATURE----- --uXxzq0nDebZQVNAZ--