Please support syscall mmap2.
mmap2 is similar to mmap except that the offset argument is multiplied by 4096 to compute the effective offset.
This supports very large offsets for very large files.
The mmap2 system call is used by the musl C library to implement mmap, so mmap2 is needed for musl even if large offsets are not needed.
mmap2 takes 6 arguments which requires CONFIG_SYSCALL_6TH_ARG to be set.
For this reason, mmap2 is defined behind CONFIG_MMAP2.
For testing, both CONFIG_SYSCALL_6TH_ARG and CONFIG_MMAP2 should be set.
A custom_config.h can be used for this purpose like so:
echo '#define CONFIG_SYSCALL_6TH_ARG' > include/fiwix/custom_config.h
echo '#define CONFIG_MMAP2' >> include/fiwix/custom_config.h
make clean
make CONFFLAGS="-DCUSTOM_CONFIG_H"
A test program for mmap2 and a test script to build and run the test program is attached.
The test script produces an input file with random data and the runs the test program.
The test program mmap's the input file and output file with an offset of 4096.
The test program then copies data from the input file to the output file using memory.
The test script then extracts the contents of the input and output file starting with offset 4096 and verifies that they are the same.
mmap2-test.c.gzmmap2.sh.gz
Please support syscall mmap2. mmap2 is similar to mmap except that the offset argument is multiplied by 4096 to compute the effective offset. This supports very large offsets for very large files. The mmap2 system call is used by the musl C library to implement mmap, so mmap2 is needed for musl even if large offsets are not needed.
mmap2 takes 6 arguments which requires CONFIG_SYSCALL_6TH_ARG to be set. For this reason, mmap2 is defined behind CONFIG_MMAP2.
For testing, both CONFIG_SYSCALL_6TH_ARG and CONFIG_MMAP2 should be set. A custom_config.h can be used for this purpose like so:
A test program for mmap2 and a test script to build and run the test program is attached. The test script produces an input file with random data and the runs the test program. The test program mmap's the input file and output file with an offset of 4096. The test program then copies data from the input file to the output file using memory.
The test script then extracts the contents of the input and output file starting with offset 4096 and verifies that they are the same. mmap2-test.c.gz mmap2.sh.gz