Subject: Re: Files larger than 1.5GB cannot be created on NetBSD/I386 1.4.x
To: Brian Buhrow <buhrow@lothlorien.nfbcal.org>
From: David Brownlee <abs@netbsd.org>
List: port-i386
Date: 08/10/2000 10:22:10
Works for me on 1.5_ALPHA - I don't have a 1.4 system with >1GB
of free space right now :/
(wopr ~)113% gcc -Wall -o bob bob.c
(wopr ~)114% ./bob testink
(wopr ~)115% ls -l testink
-rw-rw-r-- 1 abs wheel 4095997952 Aug 10 09:56 testink
(wopr ~)116% uname -a
NetBSD wopr.int.purplei.com 1.5_ALPHA NetBSD 1.5_ALPHA (_WOPR_) #0: Wed
Jul 26 22:44:14 BST 2000
abs@wopr.int.purplei.com:/files/transient/netbsd/src/sys/arch/i386/compile/_WOPR_
i386
David/absolute
-- www.netbsd.org: A pmap for every occasion --
On Wed, 9 Aug 2000, Brian Buhrow wrote:
> Hello. As part of some work I'm doing during my day job, I have a
> reason to try to create files larger than 2GB on a NetBSD 1.4.x system.
> The following program failes with a ENOSPC error when trying to create
> such a file when the file in question is still 1.5GB in size and the
> filesystem is only 70% full. Any idea why this would be happening?
> If it's something silly I'm doing, let me know.
> -thanks
> -Brian
>
> /* #####################################################################
> #
> FILE SIZE > 2 GB.
> # */
>
>
> /* ################### INCLUDES & INITIALISATIONS ##################### */
>
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
> #include <errno.h>
>
>
> /* ################### MAIN PROGRAM ######################## */
>
> int main (argc, argv)
>
> int argc;
> char *argv[];
>
> {
> unsigned long cpos = 0;
> char buf [2048];
> FILE *fd1;
>
> if (argc != 2) {
> fprintf (stdout,\
> " ERROR: need input file name..exit!\n");
> exit (1);
> }
>
> if ((fd1 = fopen ( argv[1], "w")) == NULL) {
> fprintf (stdout,\
> " ERROR: can't open file %s for input\n", argv[1]);
> exit (1);
> }
>
> memset (buf, '3', sizeof buf);
> while ( ++cpos < 2000000 )
> {
> if ( fwrite (buf, 2048, 1, fd1) <= 0)
> {
> fprintf (stdout, " error (%d) - ferror (%d)\n",\
> errno, ferror (fd1) );
> exit (1);
> }
> }
>
> return (0);
> }
>
>