Take the 2-minute tour ×

mmap() is used to create memory region that is backed by file system. However, I want the reverse: a file that is backed by memory. Is that possible? I have a legacy static library (meaning it's not possible to change it) can only open a local file. I can't change it to use a redirected fd, or a stdin (because pipe does not support seek) I want the file content to be streamed from a Windows share (CIFS/SMB). Is it possible to create a virtual file on local file system with fake size and when the legacy static library access any part of the file(seek or read, no write), we handle it by doing a fetch from CIFS/SMB and return to the legacy library (just like handling a page fault)? Then legacy library would not notice any difference...

Mounting the CIFS/SMB share is not possible due to permission issue. Assume the environment is POSIX, however, OS specific advice is welcomed as well.

share|improve this question
WTF, you want to write your own virtual filesystem to read from CIFS without mounting because you have permission issues??? –  user405725 Jul 1 '12 at 4:15
In linux you could use FUSE, but of course you may find similar permission issues, depending on the OS configuration. –  rodrigo Jul 1 '12 at 9:06
add comment

1 Answer

Probably you are looking for shm_open. shm_overview(7) man page is good place to start searching.

share|improve this answer
add comment

Your Answer


