Use O_NOATIME on directories too, where available, to avoid bumping dir access times during scans.

This commit is contained in:
Brian Cox 2016-06-12 18:57:23 -07:00
parent 669e4c02ea
commit 33f695c435
1 changed files with 9 additions and 1 deletions

View File

@ -190,8 +190,16 @@ void cUnixFSServices::ReadDir(const TSTRING& strFilenameC, std::vector<TSTRING>&
#endif
//Get all the filenames
DIR* dp;
DIR* dp=0;
#if defined(O_DIRECTORY) && defined(O_NOATIME)
//dfd will be autoclosed by closedir(), should not be explicitly closed.
int dfd=open(strFilename.c_str(), O_RDONLY|O_DIRECTORY|O_NOATIME);
if (dfd>0)
dp = fdopendir(dfd);
#else
dp = opendir( strFilename.c_str() );
#endif
if (dp == NULL)
{