X-Spam-Check-By: sourceware.org Date: Fri, 1 Sep 2006 19:15:30 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: cygwin fork() Message-ID: <20060901231530.GA16453@trixie.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20060901180041 DOT GA11672 AT trixie DOT casa DOT cgf DOT cx> <002c01c6ce13$1094de50$020aa8c0 AT DFW5RB41> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002c01c6ce13$1094de50$020aa8c0@DFW5RB41> User-Agent: Mutt/1.5.11 Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: 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 On Fri, Sep 01, 2006 at 05:07:49PM -0500, Gary R. Van Sickle wrote: >> From: Christopher Faylor >> Sent: Friday, September 01, 2006 1:01 PM >> Subject: Re: cygwin fork() >> >> On Fri, Sep 01, 2006 at 06:57:10PM +0100, Dave Korn wrote: >> >On 01 September 2006 18:47, clayne wrote: >> >>I found the real culprit, which I had also ifdef'd out because it >> >>looked bogus and crufty: >> >> >> >>/* Return 1 if a seek on FD will succeed. */ #ifndef __CYGWIN__ # >> >>define fd_is_seekable(fd) (lseek ((fd), 0L, SEEK_CUR) >= 0) >> #else # >> >>define fd_is_seekable(fd) 0 #endif /* __CYGWIN__ */ >> > >> >Yeeesh. This is a terrible way of dealing with the fact >> that you can't >> >seek a stream accurately if you open it in text mode, because of the >> >ambiguity about whether you've advanced one or two chars through the >> >underlying file when you see an LF that could perhaps have actually >> >been a CR/LF. What we really want is >> >> AFAIK, Cygwin's lseek should handle seeking on text streams. >> DJ implemented that years ago. > >Last I looked, which was admittedly also years ago, it was "#if 0"'ed out, >with a comment to the effect of "Nobody has any business seeking around in >text files." AFAIK, lseek is supposed to work. There was some old pre-DJ code which I believe was ifdef'ed out up until around 2002 when Corinna introduced 64-bit support. However, I'm sure there are probably corner cases where it breaks down. However, determining the position in a file using lseek and then seeking to that position later should work ok. cgf -- 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/