HP-UX problems:
--------------------------------------------
1. By default HP-UX does not allow multiple mmap()s of the same region in one
process.
Test it (trace system calls):
tusc ./db_test
...
open("/tmp/leveldbtest-40185/db_test/000024.sst", O_RDONLY|0x800, 06610)
........................ = 8
open("/tmp/leveldbtest-40185/db_test/000024.sst", O_RDONLY|0x800, 0155130)
...................... = 9
stat("/tmp/leveldbtest-40185/db_test/000024.sst", 0x9fffffffff680cb8)
........................... = 0
stat("/tmp/leveldbtest-40185/db_test/000024.sst", 0x9fffffffffffd988)
........................... = 0
mmap(NULL, 3369, PROT_READ, MAP_SHARED, 8, 0)
................................................... = 0xc00000000125b000
mmap(NULL, 3369, PROT_READ, MAP_SHARED, 9, 0)
................................................... ERR#12 ENOMEM
...
Second call to mmap() returns “ENOMEM” error.
Fix is to use linker flags:
http://h21007.www2.hp.com/portal/download/files/unprot/Itanium/aas_white_paper.p
df
In version 11.v2 HP-UX introduced new feature “Adaptive Address Space
(AAS)”,
new linker flag allow multiple mmap()s of the same region: “ld +as mpas”
--------------------------------------------
2. For unknown reason truncate() before close() does not “truncate” file.
Unit test: util\env_test.cc TEST(EnvPosixTest, MmapTruncateFileTest)
Error under HP-UX 11.31 ia64:
open();
ftruncate(PAGESIZE);
mmap(0, PAGESIZE);
...
munmap();
ftruncate(PAGESIZE-n); // does NOT work, size is NOT changed!
close();
Fix is to “truncate after close”:
open();
ftruncate(PAGESIZE);
mmap(0, PAGESIZE);
...
munmap();
close();
truncate(PAGESIZE-n);
Patched function: util/env_posix.cc PosixMmapFile::Close()
Hope this is a temporary solution, probably next HP-UX release/patch will fix
this behavior.
I will ask HP about this error (problem when mixing mmap/stdio).
--------------------------------------------
Patch tested on HP-UX ia64 11.31 (test MmapTruncateFileTest can be excluded
from patch, test provided as an example how to reproduce "truncate" error).
All tests successfully passed.
Original issue reported on code.google.com by Alexande...@gmail.com on 19 Oct 2012 at 3:22
Original issue reported on code.google.com by
Alexande...@gmail.com
on 19 Oct 2012 at 3:22Attachments: