use mmap()+munmap() for output during decompression; and squeeze hard!

p_unix.cpp stub/l_lx_exec.c

committer: jreiser <jreiser> 959142814 +0000
This commit is contained in:
John Reiser
2000-05-24 04:33:34 +00:00
parent 82a16bd4f2
commit f9c33255c5
2 changed files with 42 additions and 89 deletions
-6
View File
@@ -412,18 +412,12 @@ void PackLinuxI386::patchLoader()
{
lsize = getLoaderSize();
// mmapsize is (blocksize + OVERHEAD) rounded up to next PAGE_SIZE
const unsigned pagesize = 4096;
const unsigned mmapsize = ALIGN_UP(blocksize + OVERHEAD, pagesize);
// patch loader
// note: we only can use /proc/<pid>/fd when exetype > 0.
// also, we sleep much longer when compressing a script.
patch_le32(loader,lsize,"UPX5",mmapsize);
patch_le32(loader,lsize,"UPX4",exetype > 0 ? 3 : 15); // sleep time
patch_le32(loader,lsize,"UPX3",exetype > 0 ? 0 : 0x7fffffff);
patch_le32(loader,lsize,"UPX2",progid);
//patch_le32(loader,lsize,"UPX1",lsize); no longer used
patchVersion(loader,lsize);
Elf_LE32_Ehdr *const ehdr = (Elf_LE32_Ehdr *)(void *)loader;