how do I enable LFS for OpenSuse 10?

consider this test program:


#include <stdio.h>

int main( int argc, char* argv )
{
	FILE * file;
	if( ( file = fopen( "/home/cucuioan/bigfiledump", "w" ) ) == NULL ){
		printf("Unable to open file
" );
		return 1;
	}

	char bigbuff[1024*1024];
	for( int i = 0; i < 3000; ++i ){
		fwrite( bigbuff, 1024*1024, 1, file );
		printf("Dumped so far: %d
", i * 1024*1024 );
	}
	printf("Finished dumping
");
	fclose(file);
*/
}

Of course, when it reaches the 2^32 - 1 upper limit I end up with an “File size limit exceeded”

I did a bit of searching and found out that I have to enable large file support to be able to use larger files in my program.

Now, another wierd thing is that if I write this:


int main( int argc, char* argv )
{

	FILE*f;
	printf( "sizeof off_t : %d

", sizeof(off_t) );
	fseeko(f, 0, 0 );
}

i get an undefined type off_t, altough looking at fseeko’s man page the off_t type is specified and the only header that need s to be included is stdio.h. Grepping through /usr/include I found the __off_t type, but this has only 4 bytes size and that is not enough… I belive that if I switch to LFS this type will become 8 bytes wide… Even thow, why is off_t undefined?

So… how do I enable LFS in OpenSuse 10? I tried the -D_FILE_OFFSET_BITS=64 but it doesn’t work…

any advice or explanation would be welcomed…

thx in advance

ok, I had to include unistd.h to gain access to off_t
But it’s size is still 4 bytes. So LFS problem still exists.

ok, managed to solve the problem… the define does work, only that I have to explicitly use fseeko instead of fseek

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Interesting… thanks for posting back your findings.

Good luck.

kux wrote:
> ok, managed to solve the problem… the define does work, only that I
> have to explicitly use fseeko instead of fseek
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJkat53s42bA80+9kRArVHAJ9L3ujFG0p51xBtGCzXgvjRXQ2XMwCePaXK
jK5+ZfkdW65laRNtheMQtdc=
=K+YW
-----END PGP SIGNATURE-----