Changeset 2959 for trunk/src/kWorker
- Timestamp:
- Sep 21, 2016, 10:53:32 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kWorker/kWorker.c
r2957 r2959 96 96 * Keep history of the last jobs. For debugging. */ 97 97 #define WITH_HISTORY 98 99 /** @def WITH_PCH_CACHING 100 * Enables read caching of precompiled header files. */ 101 #if K_ARCH_BITS >= 64 102 # define WITH_PCH_CACHING 103 #endif 98 104 99 105 … … 684 690 /** Set if we're running. */ 685 691 KBOOL fRunning; 692 /** Whether to disable caching of ".pch" files. */ 693 KBOOL fNoPchCaching; 686 694 687 695 /** The command line. */ … … 4965 4973 } 4966 4974 } 4967 #if 0 /* compiler does write+copy mapping, so forget it. */4975 #ifdef WITH_PCH_CACHING 4968 4976 /* Precompiled header: .pch */ 4969 4977 else if (wcFirst == 'p' || wcFirst == 'P') … … 4972 4980 { 4973 4981 if (wcThird == 'h' || wcThird == 'H') 4974 return K_TRUE;4982 return !g_Sandbox.fNoPchCaching; 4975 4983 } 4976 4984 } … … 5107 5115 { 5108 5116 if ( cbFile.QuadPart >= 0 5117 #ifdef WITH_PCH_CACHING 5109 5118 && ( cbFile.QuadPart < 16*1024*1024 5110 || ( cbFile.QuadPart < 64*1024*10245119 || ( cbFile.QuadPart < 96*1024*1024 5111 5120 && pFsObj->cchName > 4 5112 && kHlpStrICompAscii(&pFsObj->pszName[pFsObj->cchName - 4], ".pch") == 0) )) 5121 && !g_Sandbox.fNoPchCaching 5122 && kHlpStrICompAscii(&pFsObj->pszName[pFsObj->cchName - 4], ".pch") == 0) ) 5123 #endif 5124 ) 5113 5125 { 5114 5126 KU32 cbCache = (KU32)cbFile.QuadPart; … … 5715 5727 } 5716 5728 5717 KWFS_LOG(("ReadFile(%p )\n", hFile));5729 KWFS_LOG(("ReadFile(%p,%p,%#x,,)\n", hFile, pvBuffer, cbToRead)); 5718 5730 return ReadFile(hFile, pvBuffer, cbToRead, pcbActuallyRead, pOverlapped); 5719 5731 } … … 6300 6312 else 6301 6313 hMapping = NULL; 6302 KWFS_LOG(("CreateFileMappingW(%p, %u) -> %p [ temp]\n", hFile, fProtect, hMapping));6314 KWFS_LOG(("CreateFileMappingW(%p, %u) -> %p [cached]\n", hFile, fProtect, hMapping)); 6303 6315 return hMapping; 6304 6316 } 6305 kHlpAssertMsgFailed(("fProtect=%#x cb=%#x'%08x name=%p\n", 6306 fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName)); 6307 SetLastError(ERROR_ACCESS_DENIED); 6308 return INVALID_HANDLE_VALUE; 6309 6310 6317 6318 /* Do fallback (for .pch). */ 6319 kHlpAssertMsg(fProtect == PAGE_WRITECOPY, 6320 ("fProtect=%#x cb=%#x'%08x name=%p\n", 6321 fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName)); 6322 6323 hMapping = CreateFileMappingW(hFile, pSecAttrs, fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName); 6324 KWFS_LOG(("CreateFileMappingW(%p, %p, %#x, %#x, %#x, %p) -> %p [cached-fallback]\n", 6325 hFile, pSecAttrs, fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName, hMapping)); 6326 return hMapping; 6311 6327 } 6312 6328 … … 8760 8776 static int kwSandboxInit(PKWSANDBOX pSandbox, PKWTOOL pTool, 8761 8777 KU32 cArgs, const char **papszArgs, KBOOL fWatcomBrainDamange, 8762 KU32 cEnvVars, const char **papszEnvVars )8778 KU32 cEnvVars, const char **papszEnvVars, KBOOL fNoPchCaching) 8763 8779 { 8764 8780 PPEB pPeb = kwSandboxGetProcessEnvironmentBlock(); … … 8788 8804 pSandbox->Combined.cFlushes = 0; 8789 8805 #endif 8806 pSandbox->fNoPchCaching = fNoPchCaching; 8790 8807 pSandbox->cArgs = cArgs; 8791 8808 pSandbox->papszArgs = (char **)papszArgs; … … 9200 9217 9201 9218 static int kwSandboxExec(PKWSANDBOX pSandbox, PKWTOOL pTool, KU32 cArgs, const char **papszArgs, KBOOL fWatcomBrainDamange, 9202 KU32 cEnvVars, const char **papszEnvVars )9219 KU32 cEnvVars, const char **papszEnvVars, KBOOL fNoPchCaching) 9203 9220 { 9204 9221 int rcExit = 42; … … 9208 9225 * Initialize the sandbox environment. 9209 9226 */ 9210 rc = kwSandboxInit(&g_Sandbox, pTool, cArgs, papszArgs, fWatcomBrainDamange, cEnvVars, papszEnvVars );9227 rc = kwSandboxInit(&g_Sandbox, pTool, cArgs, papszArgs, fWatcomBrainDamange, cEnvVars, papszEnvVars, fNoPchCaching); 9211 9228 if (rc == 0) 9212 9229 { … … 9342 9359 * @param cEnvVars The number of environment variables. 9343 9360 * @param papszEnvVars The environment vector. 9361 * @param fNoPchCaching Whether to disable precompiled header file 9362 * caching. Avoid trouble when creating them. 9344 9363 * @param cPostCmdArgs Number of post command arguments (includes cmd). 9345 9364 * @param papszPostCmdArgs The post command and its argument. … … 9347 9366 static int kSubmitHandleJobUnpacked(const char *pszExecutable, const char *pszCwd, 9348 9367 KU32 cArgs, const char **papszArgs, KBOOL fWatcomBrainDamange, 9349 KU32 cEnvVars, const char **papszEnvVars, 9368 KU32 cEnvVars, const char **papszEnvVars, KBOOL fNoPchCaching, 9350 9369 KU32 cPostCmdArgs, const char **papszPostCmdArgs) 9351 9370 { … … 9403 9422 { 9404 9423 KW_LOG(("Sandboxing tool %s\n", pTool->pszPath)); 9405 rcExit = kwSandboxExec(&g_Sandbox, pTool, cArgs, papszArgs, fWatcomBrainDamange, cEnvVars, papszEnvVars); 9424 rcExit = kwSandboxExec(&g_Sandbox, pTool, cArgs, papszArgs, fWatcomBrainDamange, 9425 cEnvVars, papszEnvVars, fNoPchCaching); 9406 9426 } 9407 9427 else … … 9537 9557 papszEnvVars[cEnvVars] = 0; 9538 9558 9539 /* Flags (currently just watcom argument brain dama nage). */9540 if (cbMsg >= sizeof(KU8) )9559 /* Flags (currently just watcom argument brain damage and no precompiled header caching). */ 9560 if (cbMsg >= sizeof(KU8) * 2) 9541 9561 { 9542 9562 KBOOL fWatcomBrainDamange = *pszMsg++; 9543 cbMsg--; 9563 KBOOL fNoPchCaching = *pszMsg++; 9564 cbMsg -= 2; 9544 9565 9545 9566 /* Post command argument count (can be zero). */ … … 9577 9598 rcExit = kSubmitHandleJobUnpacked(pszExecutable, pszCwd, 9578 9599 cArgs, papszArgs, fWatcomBrainDamange, 9579 cEnvVars, papszEnvVars, 9600 cEnvVars, papszEnvVars, fNoPchCaching, 9580 9601 cPostCmdArgs, apszPostCmdArgs); 9581 9602 } … … 9718 9739 KU32 cEnvVars; 9719 9740 KBOOL fWatcomBrainDamange = K_FALSE; 9741 KBOOL fNoPchCaching = K_FALSE; 9720 9742 9721 9743 /* … … 9753 9775 } 9754 9776 9777 /* Optional watcom flag directory change. */ 9778 if ( i < argc 9779 && strcmp(argv[i], "--no-pch-caching") == 0) 9780 { 9781 fNoPchCaching = K_TRUE; 9782 i++; 9783 } 9784 9755 9785 /* Trigger breakpoint */ 9756 9786 if ( i < argc … … 9787 9817 rcExit = kSubmitHandleJobUnpacked(argv[i], pszCwd, 9788 9818 argc - i, &argv[i], fWatcomBrainDamange, 9789 cEnvVars, environ, 9819 cEnvVars, environ, fNoPchCaching, 9790 9820 0, NULL); 9791 9821 KW_LOG(("rcExit=%d\n", rcExit));
Note:
See TracChangeset
for help on using the changeset viewer.