-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Bernd Petrovitsch wrote: > On Wed, 2005-07-20 at 14:16 +0200, Bastiaan Naber wrote: > [...] > >>I have a 15 GB file which I want to place in memory via tmpfs. I want to do >>this because I need to have this data accessible with a very low seek time. > > > Apart fromn the 32-vs-64bit thing: Isn't it enough (and simpler and more > flexible) to mmap(2) that file and mlock(2) it afterwards? > > Bernd
On 32bit arches, a pointer is 32bit large. On 64bit arches, a pointer is 64bit large. You can't mmap() the whole file if it's larger than 32bit on a 32bit arch. void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset); test.c: #include <sys/mman.h> int main(void) { printf("sizeof(void *): %d\n", sizeof(void *)); printf("sizeof(size_t): %d\n", sizeof(size_t)); } On a 64bit machine: $ gcc test.c -o test64 ; ./test64; file ./test64 sizeof(void *): 8 sizeof(size_t): 8 test64: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), not stripped On a 32bit machine (or in this case, 32bit userland on a 64bit machine): $ gcc -m32 test.c -o test32 ; ./test32; file ./test32 sizeof(void *): 4 sizeof(size_t): 4 test32: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped Meaning both the pointer and the size argument are only 32bit (4byte) on 32-bit arches and 64bit (8 byte) on 64bit arches. // Stefan -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (MingW32) iD4DBQFC32caBrn2kJu9P78RAujmAJ9J3xYdbAwYdpGXuu8kiTwdcloaSQCY1TD1 SuJJ3Ylpsa+Cdo2uIQ/Prw== =IFvd -----END PGP SIGNATURE----- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/