delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/06/26/05:55:26

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
X-Authentication-Warning: localhost.localdomain: ronald owned process doing -bs
Date: Thu, 26 Jun 2003 12:03:17 +0200 (CEST)
From: Ronald Landheer-Cieslak <ronald AT landheer DOT com>
X-X-Sender: ronald AT localhost DOT localdomain
To: Vikram Mehta <vm6580 AT hotmail DOT com>
cc: "Cygwin AT Cygwin DOT Com" <cygwin AT cygwin DOT com>
Subject: Re: _pread() _pwrite
In-Reply-To: <Law14-OE48xJ6Zy1k4g00052fb6@hotmail.com>
Message-ID: <Pine.LNX.4.44.0306261146310.2545-100000@localhost.localdomain>
MIME-Version: 1.0

pread and pwrite are not in Cygwin (or at least are not exported by 
cygwin1.dll). They are hardly the most portable functions in the world. I 
suggest you write a wrapper. Something like:

<UNTESTED CODE>
ssize_t pread(int fd, void *buf, size_t count, off_t offset)
{
	if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
	{
		return(-1);
	}
	return(read(fd, buf, count));
}

and
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset)
{
	if (lseek(fd, offset, SEEK_SET) == (off_t)-1)
	{
		return(-1);
	}
	return(write(fd, buf, count));
}
</UNTESTED CODE>

HTH

rlc

NB: you should of course have configure test for the presence of these 
functions and act accordlingly.. 

On Wed, 25 Jun 2003, Vikram Mehta wrote:

> Hi folks,
> I am compiling some files which need functions like -pread(), pwrite() which
> shud be in libc.a.
> But they are not.
> 
> This file was actually mean to be complied on linux.
> 
> 
> Any ideas how can I overcome this problem
> 
> Vikram
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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