VirtualBox

Changeset 2850 in kBuild for trunk/src/lib/nt/ntstat.c


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

kmk: optimizations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 */
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