LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   File Mapping in Linux (https://www.linuxquestions.org/questions/linux-newbie-8/file-mapping-in-linux-703753/)

koumodaki 02-10-2009 10:01 PM

File Mapping in Linux
 
Hi,

I have an application that uses the following Windows APIs.

HANDLE CreateFileMapping(
HANDLE hFile,
LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
DWORD flProtect,
DWORD dwMaximumSizeHigh,
DWORD dwMaximumSizeLow,
LPCTSTR lpName
);

LPVOID WINAPI MapViewOfFile(
__in HANDLE hFileMappingObject,
__in DWORD dwDesiredAccess,
__in DWORD dwFileOffsetHigh,
__in DWORD dwFileOffsetLow,
__in SIZE_T dwNumberOfBytesToMap
);


I need to reprogram this application to run on Linux. Is mmap function a good replacement for the above two API calls. If not please suggest an alternative method.

Thanks and Regards

mapryan 02-12-2009 09:29 AM

You might be better off asking this in the programming forum
http://www.linuxquestions.org/questions/programming-9/

archtoad6 02-18-2009 08:18 AM

You can ask the Mods to move it by reporting your own post.

servat78 02-18-2009 01:53 PM

When using mmap you should be aware that some hosting server service providers (Hostmonster for example) have mmap disabled on their systems. So if your application has to run as some CGI tool on such a server, then you first need to check if mmap is there. A possible workaround is to compile a static application on a similar system. It will be difficult if you have (for example) no 64 bit system locally and you need to compile on the remote server, which is 64-bit and where mmap is not supported.

Debian


All times are GMT -5. The time now is 04:36 PM.