Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: 15 Feb 2001 17:19:41 -0500 Message-ID: <20010215221941.21036.qmail@lizard.curl.com> From: Jonathan Kamens To: cygwin AT cygwin DOT com In-reply-to: <4.3.1.2.20010215160534.04a66d40@pop.ma.ultranet.com> (lhall AT rfk DOT com) Subject: Re: Optimizing away "ReadFile" calls when Make calls stat() References: <4 DOT 3 DOT 1 DOT 2 DOT 20010213134821 DOT 019a7130 AT pop DOT ma DOT ultranet DOT com> <20010213190131 DOT 14369 DOT qmail AT lizard DOT curl DOT com> <200102131935 DOT OAA09136 AT envy DOT delorie DOT com> <20010213194612 DOT 17311 DOT qmail AT lizard DOT curl DOT com> <200102131954 DOT OAA09284 AT envy DOT delorie DOT com> <20010213152313 DOT A12830 AT redhat DOT com> <39319402546 DOT 20010214110838 AT logos-m DOT ru> <4 DOT 3 DOT 1 DOT 2 DOT 20010215160534 DOT 04a66d40 AT pop DOT ma DOT ultranet DOT com> > Date: Thu, 15 Feb 2001 16:09:46 -0500 > From: "Larry Hall (RFK Partners, Inc)" > > >Example code: > > > > struct stat st; > > stat_select("foo", &st, ST_MODE | ST_MTIME); > > > >Cygwin.DLL: > > int stat(const char* file, struct stat* pst) > > { > > return stat_select(file, pst, 0xFFFFFFFF); > > } > > > Sure, this is an idea for new, Cygwin specific code. I'm not quite > sure why someone who was writing new code (or changing old) wouldn't just > use Win32 APIs to accomplish the required task though. Because all you would have to do to modify your code to work with Cygwin is to use stat_select with the correct bitmask. You wouldn't have to convert any of the information returned by the Win32 APIs into the format the rest of your code expects, and in fact you could just keep using the same "struct stat" as you were using before. In other words, something like this is a lot simpler than writing a lot of Win32 API calls in your code: struct stat st; #ifdef __CYGWIN__ stat_select("foo", &st, ); #else stat("foo", &st); #endif jik -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple