Re: Sharing a file through mmap
From: Måns Rullgård (mru_at_inprovide.com)
Date: 05/14/05
- Next message: lothar.behrens_at_lollisoft.de: "Sometimes strange error messages ?"
- Previous message: Zheng Da: "Re: When I debug a multithread program with gdb, and the program often receive signal SIGTRAP"
- In reply to: Peter Nolan: "Sharing a file through mmap"
- Next in thread: Michael B Allen: "Re: Sharing a file through mmap"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 14 May 2005 19:54:21 +0200
"Peter Nolan" <peter@peternolan.com> writes:
> Hi,
> I am new to mmap on unix....I have written some ETL software and
> introduced memory mapped IO for my win2000+ version..I am now trying to
> introduce memory mapped IO for my unix version.....
>
> I have written code that will (I hope) load the data I want into memory
> mapped IO...however, when writing the code to gain access to the map I
> have a question....I have the statement below...
>
> IF ((ptr_MemMapBuffer = (char *) mmap((caddr_t) 0, 0 ,
> (PROT_READ|PROT_WRITE), MAP_SHARED, fp_MemMapBuffer, 0)) == MAP_FAILED)
> THEN
> BEGIN_
> // some error and return
> CALL_RETURNED_OK = False ;
> return CALL_RETURNED_OK ;
> END_
What language is that?
> At this point in this program I do not know the size of the file
> pointed to by fp_MemMapBuffer. In the win2000 equivalent call when you
> ask for the mapping to be made if you specify 0 as a length it will
> allow the program access to the entire file in memory. I've searched
> in the documentation but I cannot see if mmap defaults to allowing
> access to the entire file or if I need to run some function to find the
> size of the entire file before I call mmap.....And if I do, does anyone
> know the function to call against a file pointer opened with the 'open'
> statement to get the size in bytes of the file?
fstat
-- Måns Rullgård mru@inprovide.com
- Next message: lothar.behrens_at_lollisoft.de: "Sometimes strange error messages ?"
- Previous message: Zheng Da: "Re: When I debug a multithread program with gdb, and the program often receive signal SIGTRAP"
- In reply to: Peter Nolan: "Sharing a file through mmap"
- Next in thread: Michael B Allen: "Re: Sharing a file through mmap"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|