Changeset 2948 in kBuild
- Timestamp:
- Sep 20, 2016 3:36:07 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kWorker/Makefile.kmk
r2938 r2948 31 31 PROGRAMS += kWorker 32 32 kWorker_TEMPLATE = BIN-STATIC-THREADED 33 kWorker_DEFS := KWORKER 33 34 kWorker_DEFS.debug = K_STRICT 34 35 kWorker_DEFS.release = NASSERT … … 60 61 kWorkerLib_DEFPATH = ../lib # Need fix from r2837. 61 62 kWorkerLib_DEFPATH := $(PATH_SUB_CURRENT)/../lib 63 kWorkerLib_DEFS := KWORKER 62 64 kWorkerLib_SOURCES = \ 63 65 crc32.c \ -
trunk/src/kWorker/kWorker.c
r2946 r2948 47 47 #include "nt/ntstat.h" 48 48 #include "kbuild_version.h" 49 /* lib/nt_fullpath.c */50 extern void nt_fullpath(const char *pszPath, char *pszFull, size_t cchFull);51 49 52 50 #include "nt/ntstuff.h" … … 54 52 55 53 #include "nt/kFsCache.h" 54 #include "nt_fullpath.h" 56 55 #include "quote_argv.h" 57 56 #include "md5.h" … … 2800 2799 */ 2801 2800 2801 2802 /** 2803 * This is for kDep. 2804 */ 2805 int kwFsPathExists(const char *pszPath) 2806 { 2807 BirdTimeSpec_T TsIgnored; 2808 KFSLOOKUPERROR enmError; 2809 PKFSOBJ pFsObj = kFsCacheLookupNoMissingA(g_pFsCache, pszPath, &enmError); 2810 if (pFsObj) 2811 { 2812 kFsCacheObjRelease(g_pFsCache, pFsObj); 2813 return 1; 2814 } 2815 return birdStatModTimeOnly(pszPath, &TsIgnored, 1) == 0; 2816 } 2817 2818 2819 /* duplicated in dir-nt-bird.c */ 2820 void nt_fullpath_cached(const char *pszPath, char *pszFull, size_t cbFull) 2821 { 2822 KFSLOOKUPERROR enmError; 2823 PKFSOBJ pPathObj = kFsCacheLookupA(g_pFsCache, pszPath, &enmError); 2824 if (pPathObj) 2825 { 2826 KSIZE off = pPathObj->cchParent; 2827 if (off > 0) 2828 { 2829 KSIZE offEnd = off + pPathObj->cchName; 2830 if (offEnd < cbFull) 2831 { 2832 PKFSDIR pAncestor; 2833 2834 pszFull[off + pPathObj->cchName] = '\0'; 2835 memcpy(&pszFull[off], pPathObj->pszName, pPathObj->cchName); 2836 2837 for (pAncestor = pPathObj->pParent; off > 0; pAncestor = pAncestor->Obj.pParent) 2838 { 2839 kHlpAssert(off > 1); 2840 kHlpAssert(pAncestor != NULL); 2841 kHlpAssert(pAncestor->Obj.cchName > 0); 2842 pszFull[--off] = '/'; 2843 off -= pAncestor->Obj.cchName; 2844 kHlpAssert(pAncestor->Obj.cchParent == off); 2845 memcpy(&pszFull[off], pAncestor->Obj.pszName, pAncestor->Obj.cchName); 2846 } 2847 kFsCacheObjRelease(g_pFsCache, pPathObj); 2848 return; 2849 } 2850 } 2851 else 2852 { 2853 if ((size_t)pPathObj->cchName + 1 < cbFull) 2854 { 2855 memcpy(pszFull, pPathObj->pszName, pPathObj->cchName); 2856 pszFull[pPathObj->cchName] = '/'; 2857 pszFull[pPathObj->cchName + 1] = '\0'; 2858 2859 kFsCacheObjRelease(g_pFsCache, pPathObj); 2860 return; 2861 } 2862 } 2863 2864 /* do fallback. */ 2865 kHlpAssertFailed(); 2866 kFsCacheObjRelease(g_pFsCache, pPathObj); 2867 } 2868 2869 nt_fullpath(pszPath, pszFull, cbFull); 2870 } 2802 2871 2803 2872 -
trunk/src/kmk/dir-nt-bird.c
r2931 r2948 456 456 457 457 458 458 /* duplicated in kWorker.c */ 459 459 void nt_fullpath_cached(const char *pszPath, char *pszFull, size_t cbFull) 460 460 { … … 478 478 kHlpAssert(off > 1); 479 479 kHlpAssert(pAncestor != NULL); 480 kHlpAssert(pAncestor->Obj cchName > 0);480 kHlpAssert(pAncestor->Obj.cchName > 0); 481 481 pszFull[--off] = '/'; 482 482 off -= pAncestor->Obj.cchName; -
trunk/src/lib/kDep.c
r2886 r2948 59 59 #include "kDep.h" 60 60 61 #ifdef KWORKER 62 extern int kwFsPathExists(const char *pszPath); 63 #endif 64 61 65 62 66 /******************************************************************************* … … 239 243 * Check that the file exists before we start depending on it. 240 244 */ 241 #ifdef KMK 245 #ifdef KWORKER 246 if (kwFsPathExists(pszFilename)) 247 #elif defined(KMK) 242 248 if (!file_exists_p(pszFilename)) 243 249 #elif K_OS == K_OS_WINDOWS -
trunk/src/lib/nt/kFsCache.c
r2944 r2948 89 89 90 90 91 92 /********************************************************************************************************************************* 93 * Internal Functions * 94 *********************************************************************************************************************************/ 95 static KBOOL kFsCacheRefreshObj(PKFSCACHE pCache, PKFSOBJ pObj, KFSLOOKUPERROR *penmError); 91 96 92 97 … … 1257 1262 else if (pDir->fPopulated) 1258 1263 { 1259 KU32 cAllocated = K_ALIGN_Z(pDir->cChildren, 16); 1260 void *pvNew = kHlpAlloc(sizeof(pDir->papChildren[0]) * cAllocated); 1264 KU32 cAllocated; 1265 void *pvNew; 1266 1267 /* Make sure we really need to do this first. */ 1268 if (!pDir->fNeedRePopulating) 1269 { 1270 if ( pDir->Obj.uCacheGen == KFSOBJ_CACHE_GEN_IGNORE 1271 || pDir->Obj.uCacheGen == pCache->auGenerations[pDir->Obj.fFlags & KFSOBJ_F_USE_CUSTOM_GEN]) 1272 return K_TRUE; 1273 if ( kFsCacheRefreshObj(pCache, &pDir->Obj, penmError) 1274 && !pDir->fNeedRePopulating) 1275 return K_TRUE; 1276 } 1277 1278 /* Yes we do need to. */ 1279 cAllocated = K_ALIGN_Z(pDir->cChildren, 16); 1280 pvNew = kHlpAlloc(sizeof(pDir->papChildren[0]) * cAllocated); 1261 1281 if (pvNew) 1262 1282 { … … 1608 1628 && (pDir->Obj.fFlags & KFSOBJ_F_WORKING_DIR_MTIME) ) 1609 1629 { 1610 MY_IO_STATUS_BLOCK Ios; 1611 MY_FILE_BASIC_INFORMATION BasicInfo; 1612 MY_NTSTATUS rcNt; 1613 1614 Ios.Information = -1; 1615 Ios.u.Status = -1; 1616 1617 rcNt = g_pfnNtQueryInformationFile(pDir->hDir, &Ios, &BasicInfo, sizeof(BasicInfo), MyFileBasicInformation); 1618 if (MY_NT_SUCCESS(rcNt)) 1619 return BasicInfo.LastWriteTime.QuadPart != pDir->iLastWrite; 1630 if (!pDir->fNeedRePopulating) 1631 { 1632 MY_IO_STATUS_BLOCK Ios; 1633 MY_FILE_BASIC_INFORMATION BasicInfo; 1634 MY_NTSTATUS rcNt; 1635 1636 Ios.Information = -1; 1637 Ios.u.Status = -1; 1638 1639 rcNt = g_pfnNtQueryInformationFile(pDir->hDir, &Ios, &BasicInfo, sizeof(BasicInfo), MyFileBasicInformation); 1640 if (MY_NT_SUCCESS(rcNt)) 1641 { 1642 if (BasicInfo.LastWriteTime.QuadPart != pDir->iLastWrite) 1643 { 1644 pDir->fNeedRePopulating = K_TRUE; 1645 return K_TRUE; 1646 } 1647 return K_FALSE; 1648 } 1649 } 1620 1650 } 1621 1651 /* The cache root never changes. */
Note:
See TracChangeset
for help on using the changeset viewer.