mmap() works fine on a Red Hat 4.2 system, which ships a perfectly standard Linux kernel. A great deal of the source code included in the distribution uses mmap() explicitly, and every dynamically loaded program uses mmap() implicitly in the dynamic loader.
I suggest "man mmap" as a start. Notice the reference at the bottom of the page to getpagesize(), and consider the modulus operator (%). That should help you out... :-) You'll also find sample code that uses mmap() at http://www.redhat.com/~johnsonm/lad/src/map-cat.c.html Other sample source you might find useful is at http://www.redhat.com/~johnsonm/lad/src/ |