Porting to OS/2: Case #16 mmap()
mmap() is used to map a file into memory. It is known that using mmap() is more efficiency than using file-related functions such as read()/write(). So many projects are using it. Unfortunately, however, OS/2 kLIBC does not support mmap(). And OS/2 itself does not have features corresponding to mmap() directly. Because of this, there is need to implement mmap() by ourselves. When I was porting binary codec support of MPlayer to OS/2, mmap() was needed. Although it does not have all the features which mmap() has, it is useful generally. // ----- 2014/11/04 It support MAP_PRIVATE, partially MAP_FIXED but not MAP_SHARED. It supports MAP_PRIVATE, MAP_SHARED and partially MAP_FIXED. // ----- mmap.c mmap.h mmap-1.c mmap-1.c is a test program for mmap(). To build, gcc -o mmap-1.exe mmap-1.c mmap.c Finally, you should be careful for translation mode. If opening in text mode, translation of CR/LF to LF may cause unexpected behaviors. And even if opening in binary mode, you sho...