delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/07/10/07:55:40

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
Date: Thu, 10 Jul 2003 13:54:55 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cygwin-1.5.0-1: Problem stat-ing big file
Message-ID: <20030710115455.GW12368@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <3F0D4D6A DOT 30601 AT t-online DOT de> <20030710113537 DOT GV12368 AT cygbert DOT vinschen DOT de>
Mime-Version: 1.0
In-Reply-To: <20030710113537.GV12368@cygbert.vinschen.de>
User-Agent: Mutt/1.4.1i

On Thu, Jul 10, 2003 at 01:35:37PM +0200, Corinna Vinschen wrote:
> On Thu, Jul 10, 2003 at 01:26:34PM +0200, Markus Sch?nhaber wrote:
> > While trying if the new support for files larger than 2GB works, I 
> > created a file with a size of 4.53 GB (4,869,120,000 Bytes) using a 
> > simple write in python. No problems here. But when stat-ing the file 
> > with python's os.stat or by calling stat from C as done in the little 
> > program below, the size of the file gets reported as 574,152,704 Bytes.
> 
> The changes to 64 bit file access are not propagated automatically to
> existing applications.  E.g. the current `ls' from the fileutils
> package is compiled with the old (small) stat structure which only
> has 32 bit off_t for the file size.  If you want to actually use the
> new struct stat and off_t with 64 bit, you have to recompile the
> application.
> 
> Sorry, but there's no way around that.

...and two more hints, just to clarify that a bit:

- You must compile using the header files and libcygwin.a which has been
  released together with the DLL to get the correct results.  Mixing
  old Cygwin headers with the new import lib or vice versa are sure
  candidates for segmentation fauls.

- Since off_t is now 64 bit and the st_size member of struct stat is a
  off_t, your printf isn't correct:

  printf("Size of file <%s>: %lld", argv[1], s.st_size);
                             ^^^^

  %lld is necessary.  %ld matches 32 bit types on Cygwin.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
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