X-Spam-Check-By: sourceware.org Date: Fri, 22 Jun 2007 14:50:51 -0500 From: Brian Ford To: newlib AT sources DOT redhat DOT com cc: cygwin AT cygwin DOT com Subject: fseek064 calling fflush on Cygwin Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes 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 I have an application that is having a 64-bit file I/O problem with Cygwin 1.7.0 CVS that it did not have with Cygwin 1.5.18. I have tracked it down to the following series of calls in newlib: #0 fflush (fp=0x7b5a764) at ../../../../../cygwin/newlib/libc/stdio/fflush.c:124 #1 0x611049ff in _fseeko64_r (ptr=0x16cbd008, fp=0x7b5a764, offset=27368291304, whence=0) at ../../../../../cygwin/newlib/libc/stdio64/fseeko64.c:326 #2 0x61104edf in fseeko64 (fp=0x7b5a764, offset=27368291304, whence=0) at ../../../../../cygwin/newlib/libc/stdio64/fseeko64.c:350 (gdb) l 110 105 to make the change simpler, more contained, and less likely 106 to miss a code scenario. */ 107 if ((fp->_r > 0 || fp->_ur > 0) && (seekfn = fp->_seek) != NULL) 108 { 109 _fpos_t curoff; 110 111 /* Get the physical position we are at in the file. */ 112 if (fp->_flags & __SOFF) 113 curoff = fp->_offset; 114 else 115 { 116 /* We don't know current physical offset, so ask for it. */ 117 curoff = (*seekfn) (fp->_cookie, (_fpos_t) 0, SEEK_CUR); 118 if (curoff == -1L) 119 { 120 _funlockfile (fp); 121 return 0; 122 } 123 } 124 if (fp->_flags & __SRD) (gdb) p/x fp->_offset $12 = 0x65f468000 (gdb) ptype fp->_offset type = long long int (gdb) p/x curoff $13 = 0x5f468000 (gdb) ptype curoff type = long int So, it would seem that fflush is not 64 bit safe and fseeko64 should not be calling it, but I'm not sure how to fix it. Any suggestions? -- Brian Ford Lead Realtime Software Engineer VITAL - Visual Simulation Systems FlightSafety International the best safety device in any aircraft is a well-trained crew... -- 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/