fopen64

Werner Koch wk at gnupg.org
Wed Sep 6 20:18:50 CEST 2000


Hi,

has anyone experience with large files on i32 using glibc 2.1.3 ?
I tried to use this piece to create a large file but is stopped at
2gigs:


#define _GNU_SOURCE 1

#include <stdio.h>
#include <stdlib.h>

int
main ( int argc, char **argv )
{
  int c, i, j;
  char buffer[4096];
  
  FILE *fp = fopen64 (argv[1], "w");

  if( !fp ) {
    perror ("open failed");
    return 1;
  }

  for( i=0; i < 23; i++ ) {
  	for ( j=0; j < 1024*1024*100; j++ ) {
  	    c = j %26 + 'A';
            if ( putc( c, fp ) == EOF ) {
                    perror ( "write error" );
                    return 1;
             }
          }
   }	
   if ( fclose ( fp ) ) 
       perror ("close failed");

    return 0;
}
  

What makes me wonder is that strace says:

open("test", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 4
fstat64(0x4, 0xbfffea4c)  = -1 ENOSYS (Function not implemented)

and then continues using standard fstat.  Is this at all implemented in
ext2 of Linux 2.2.16?

tia,

  Werner

-- 
Werner Koch				GnuPG key:  621CC013
OpenIT GmbH                             http://www.OpenIT.de



More information about the Gnupg-devel mailing list