LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-04-2006, 06:35 PM   #1
blakemadden
LQ Newbie
 
Registered: Nov 2006
Posts: 7

Rep: Reputation: 0
Can my map an entire (HUGE) file with mmap64


Let's say I have a 4GB file. I open it and call "lseek64" to get its long long size. Now I want to memory map the entire file with mmap64. The problem is that the length parameter with mmap64 is a size_t (just like mmap), and the offset value is what is long long.

To map the whole file, you would need to set the offset to zero, so offset being long long isn't all that meaningful. With the length parameter being a mere size_t, is there no way to map the entire file? It seems like all that mmap64 offers over mmap is the ability to map sections of the file far into it.

In Win32 I believe you can map an entire (huge) file using CreateFileMapping (if you pass in 0 as the max map size then it uses the size of the file). Is there no way to do this in *nix?

Thanks,
Blake
 
Old 12-04-2006, 07:06 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
See if you have a gawk-doc package you can install. It has an excellent book: "Gawk: Effective AWK Programming" as well as an AWK reference card.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
> File Mapping And Pthreads, How to map file in memory? level3 Programming 1 01-16-2006 09:13 PM
SYSERR(root): hash map "generics": missing map file /etc/mail/genericstable.db? singying304 Linux - Networking 4 02-28-2005 06:49 AM
mmap64 wrong physical mapping mark02k Programming 0 10-20-2004 09:45 AM
Large tar file taking huge disk space in ext3 file system pcwulf Linux - General 2 10-20-2003 07:45 AM
Can't read entire file from CD under RH7.1 t0dd Linux - General 2 01-28-2002 12:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration