VirtualBox

Changeset 2850 in kBuild


Ignore:
Timestamp:
Aug 30, 2016 4:06:31 PM (9 years ago)
Author:
bird
Message:

kmk: optimizations.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/dir.c

    r2773 r2850  
    594594          if (HASH_VACANT (dc))
    595595            {
     596#if defined(WINDOWS32) && defined(KMK)
     597              static char s_last_volume[4];
     598              static int  s_last_flags;
     599#endif
    596600              /* Nope; this really is a directory we haven't seen before.  */
    597601
     
    625629               */
    626630              w32_path[3] = '\0';
     631# ifdef KMK /* Need for speed: Cache the GetVolumeInformation result. */
     632              if (   s_last_volume[0] == w32_path[0]
     633                  && s_last_volume[1] == w32_path[1]
     634                  && s_last_volume[2] == w32_path[2]
     635                  && s_last_volume[3] == w32_path[3])
     636                dc->fs_flags = s_last_flags;
     637              else
     638                {
     639# endif
    627640              if (GetVolumeInformation(w32_path,
    628641                     fs_label, sizeof (fs_label),
     
    636649              else
    637650                dc->fs_flags = FS_UNKNOWN;
     651# ifdef KMK
     652                  s_last_volume[0] = w32_path[0];
     653                  s_last_volume[1] = w32_path[1];
     654                  s_last_volume[2] = w32_path[2];
     655                  s_last_volume[3] = w32_path[3];
     656                  s_last_flags     = dc->fs_flags;
     657                }
     658# endif
    638659#else
    639660# ifdef VMS
  • trunk/src/kmk/incdep.c

    r2745 r2850  
    502502      return -1;
    503503    }
     504#ifdef KBUILD_OS_WINDOWS /* fewer kernel calls */
     505  if (!birdStatOnFdJustSize (fd, &st.st_size))
     506#else
    504507  if (!fstat (fd, &st))
     508#endif
    505509    {
    506510      cur->file_base = incdep_xmalloc (cur, st.st_size + 1);
  • trunk/src/lib/nt/ntstat.c

    r2710 r2850  
    534534
    535535/**
     536 * Special case that only gets the file size and nothing else.
     537 */
     538int birdStatOnFdJustSize(int fd, __int64 *pcbFile)
     539{
     540    int     rc;
     541    HANDLE  hFile = (HANDLE)_get_osfhandle(fd);
     542    if (hFile != INVALID_HANDLE_VALUE)
     543    {
     544        LARGE_INTEGER cbLocal;
     545        if (GetFileSizeEx(hFile, &cbLocal))
     546        {
     547            *pcbFile = cbLocal.QuadPart;
     548            rc = 0;
     549        }
     550        else
     551        {
     552            BirdStat_T Stat;
     553            rc = birdStatOnFd(fd, &Stat);
     554            if (rc == 0)
     555                *pcbFile = Stat.st_size;
     556        }
     557    }
     558    else
     559        rc = -1;
     560    return rc;
     561}
     562
     563
     564/**
    536565 * Implements UNIX stat().
    537566 */
  • trunk/src/lib/nt/ntstat.h

    r2708 r2850  
    7878int birdStatOnLink(const char *pszPath, BirdStat_T *pStat);
    7979int birdStatOnFd(int fd, BirdStat_T *pStat);
     80int birdStatOnFdJustSize(int fd, __int64 *pcbFile);
    8081int birdStatModTimeOnly(const char *pszPath, BirdTimeSpec_T *pTimeSpec, int fFollowLink);
    8182#ifdef ___nt_ntstuff_h
Note: See TracChangeset for help on using the changeset viewer.

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