Subject: Files larger than 1.5GB cannot be created on NetBSD/I386 1.4.x system?
To: None <port-i386@netbsd.org>
From: Brian Buhrow <buhrow@lothlorien.nfbcal.org>
List: port-i386
Date: 08/09/2000 14:58:32
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);
}