This is the mail archive of the
cygwin-developers@sources.redhat.com
mailing list for the Cygwin project.
Re: st_blocks incorrect for files larger than 2Gbytes
- To: Egor Duda <deo at logos-m dot ru>
- Subject: Re: st_blocks incorrect for files larger than 2Gbytes
- From: Corinna Vinschen <vinschen at cygnus dot com>
- Date: Wed, 26 Jul 2000 14:49:29 +0200
- CC: cygwin-dev <cygwin-developers at sourceware dot cygnus dot com>
- References: <10678.000726@logos-m.ru>
- Reply-To: cygdev <cygwin-developers at sources dot redhat dot com>
Egor Duda wrote:
>
> Hi!
>
> newlib declares off_t as signed long and cygwin's stat calculates
> st_blocks as
>
> buf->st_blocks = (buf->st_size + S_BLKSIZE-1) / S_BLKSIZE;
>
> i.e. for file with size 2.164.854.784 bytes stat returns st_blocks=-2080187
> or big positive value, when assigned to (unsigned long). this may be
> fixed in a)newlib or b)cygwin or c)application
>
> which way is preferable?
SUSv2 defines an own type blkcnt_t for that purpose. This
might be the best way.
Corinna
--
Corinna Vinschen
Cygwin Developer
Cygnus Solutions, a Red Hat company