VirtualBox

Changeset 3203 in kBuild


Ignore:
Timestamp:
Mar 28, 2018 10:23:23 PM (7 years ago)
Author:
bird
Message:

winchildren: Workaround for out of sync dir cache (temporary, right).

Location:
trunk/src/kmk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/dir-nt-bird.c

    r3192 r3203  
    7777PKFSCACHE   g_pFsCache = NULL;
    7878/** Number of times dir_cache_invalid_missing was called. */
    79 static KU32 g_cInvalidates = 0;
     79static KU32 volatile g_cInvalidates = 0;
    8080/** Set by dir_cache_volatile_dir to indicate that the user has marked the
    8181 * volatile parts of the file system with custom revisioning and we only need to
     
    651651 *
    652652 * Used by $(dircache-ctl invalidate)
     653 * @note    Multi-thread safe.
    653654 */
    654655void dir_cache_invalid_all(void)
    655656{
    656     assert(GetCurrentThreadId() == g_idMainThread);
    657657    g_cInvalidates++;
    658658    kFsCacheInvalidateAll(g_pFsCache);
     
    663663 *
    664664 * Used by $(dircache-ctl invalidate-missing)
     665 * @note    Multi-thread safe.
    665666 */
    666667void dir_cache_invalid_missing(void)
    667668{
    668     assert(GetCurrentThreadId() == g_idMainThread);
    669669    g_cInvalidates++;
    670670    kFsCacheInvalidateAll(g_pFsCache);
     
    675675 *
    676676 * Used by $(dircache-ctl invalidate-missing)
     677 * @note    Multi-thread safe.
    677678 */
    678679void dir_cache_invalid_volatile(void)
    679680{
    680     assert(GetCurrentThreadId() == g_idMainThread);
    681681    g_cInvalidates++;
    682682    if (g_fFsCacheIsUsingCustomRevision)
  • trunk/src/kmk/w32/winchildren.c

    r3202 r3203  
    16411641
    16421642/**
     1643 * Temporary workaround for seemingly buggy kFsCache.c / dir-nt-bird.c.
     1644 *
     1645 * Something is not invalidated / updated correctly!
     1646 */
     1647static BOOL mkWinChildcareWorkerIsRegularFileW(PWINCHILDCAREWORKER pWorker, wchar_t const *pwszPath)
     1648{
     1649    BOOL fRet = FALSE;
     1650#ifdef KMK
     1651    if (utf16_regular_file_p(pwszPath))
     1652        fRet = TRUE;
     1653    else
     1654#endif
     1655    {
     1656        /* Don't believe the cache. */
     1657        DWORD dwAttr = GetFileAttributesW(pwszPath);
     1658        if (dwAttr != INVALID_FILE_ATTRIBUTES)
     1659        {
     1660            if (!(dwAttr & FILE_ATTRIBUTE_DIRECTORY))
     1661            {
     1662#ifdef KMK
     1663                extern void dir_cache_invalid_volatile(void);
     1664                dir_cache_invalid_volatile();
     1665                if (utf16_regular_file_p(pwszPath))
     1666                    MkWinChildError(pWorker, 1, "kFsCache was out of sync! pwszPath=%S\n", pwszPath);
     1667                else
     1668                {
     1669                    dir_cache_invalid_all();
     1670                    if (utf16_regular_file_p(pwszPath))
     1671                        MkWinChildError(pWorker, 1, "kFsCache was really out of sync! pwszPath=%S\n", pwszPath);
     1672                    else
     1673                        MkWinChildError(pWorker, 1, "kFsCache is really out of sync!! pwszPath=%S\n", pwszPath);
     1674                }
     1675#endif
     1676                fRet = TRUE;
     1677            }
     1678        }
     1679    }
     1680    return fRet;
     1681}
     1682
     1683
     1684/**
    16431685 * Tries to locate the image file, searching the path and maybe falling back on
    16441686 * the shell in case it knows more (think cygwin with its own view of the file
     
    17461788            }
    17471789
    1748 #ifdef KMK
    1749             if (utf16_regular_file_p(pwszPath))
    1750 #else
    1751             if (GetFileAttributesW(pwszPath) != INVALID_FILE_ATTRIBUTES)
    1752 #endif
     1790            if (mkWinChildcareWorkerIsRegularFileW(pWorker, pwszPath))
    17531791            {
    17541792                *pfProbableClExe = mkWinChildIsProbableClExe(pwszPath, cwcPath + 4 - 1);
     
    17641802                pwszPath[cwcPath - 1] = L'\0';
    17651803#ifdef KMK
    1766                 if (utf16_regular_file_p(pwszPath))
     1804                if (mkWinChildcareWorkerIsRegularFileW(pWorker, pwszPath))
    17671805#endif
    17681806                {
     
    18371875                if (cwcComponent > 0 && cwcCombined <= MKWINCHILD_MAX_PATH)
    18381876                {
    1839 #ifndef KMK
    1840                     DWORD dwAttribs;
    1841 #endif
    1842 
    18431877                    /* Copy the component into wszPathBuf, maybe abspath'ing it. */
    18441878                    DWORD  cwcAbsPath = 0;
     
    18921926                        wszPathBuf[cwcCombined + 3] = L'\0';
    18931927                    }
    1894 #ifdef KMK
    1895                     if (utf16_regular_file_p(wszPathBuf))
    1896 #else
    1897                     dwAttribs = GetFileAttributesW(wszPathBuf);
    1898                     if (   dwAttribs != INVALID_FILE_ATTRIBUTES
    1899                         && !(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
    1900 #endif
     1928                    if (mkWinChildcareWorkerIsRegularFileW(pWorker, wszPathBuf))
    19011929                    {
    19021930                        *pfProbableClExe = mkWinChildIsProbableClExe(wszPathBuf, cwcCombined + (fHasExeSuffix ? 0 : 4) - 1);
     
    19071935                        wszPathBuf[cwcCombined - 1] = L'\0';
    19081936#ifdef KMK
    1909                         if (utf16_regular_file_p(wszPathBuf))
     1937                        if (mkWinChildcareWorkerIsRegularFileW(pWorker, wszPathBuf))
    19101938#endif
    19111939                        {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette