Use O_NOATIME while scanning (if available) to avoid updating file access times.
This commit is contained in:
parent
778c397d48
commit
0082db13fa
|
@ -129,22 +129,22 @@ void cFile::Open( const TSTRING& sFileNameC, uint32 flags )
|
||||||
TSTRING sFileName = cArosPath::AsNative(sFileNameC);
|
TSTRING sFileName = cArosPath::AsNative(sFileNameC);
|
||||||
#endif
|
#endif
|
||||||
mode_t openmode = 0664;
|
mode_t openmode = 0664;
|
||||||
if ( mpData->mpCurrStream != NULL )
|
if (mpData->mpCurrStream != NULL)
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
//
|
//
|
||||||
// set up the sopen permissions
|
// set up the open permissions
|
||||||
//
|
//
|
||||||
int perm = 0;
|
int perm = 0;
|
||||||
|
|
||||||
TSTRING mode;
|
TSTRING mode;
|
||||||
|
|
||||||
if( flags & OPEN_WRITE )
|
if (flags & OPEN_WRITE)
|
||||||
{
|
{
|
||||||
perm |= O_RDWR;
|
perm |= O_RDWR;
|
||||||
isWritable = true;
|
isWritable = true;
|
||||||
mode = _T("rb");
|
mode = _T("rb");
|
||||||
if( flags & OPEN_TRUNCATE )
|
if (flags & OPEN_TRUNCATE)
|
||||||
{
|
{
|
||||||
perm |= O_TRUNC;
|
perm |= O_TRUNC;
|
||||||
perm |= O_CREAT;
|
perm |= O_CREAT;
|
||||||
|
@ -160,24 +160,29 @@ void cFile::Open( const TSTRING& sFileNameC, uint32 flags )
|
||||||
mode = _T("rb");
|
mode = _T("rb");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( flags & OPEN_EXCLUSIVE ) {
|
if (flags & OPEN_EXCLUSIVE) {
|
||||||
perm |= O_CREAT | O_EXCL;
|
perm |= O_CREAT | O_EXCL;
|
||||||
openmode = (mode_t) 0600; // Make sure only root can read the file
|
openmode = (mode_t) 0600; // Make sure only root can read the file
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( flags & OPEN_CREATE )
|
if (flags & OPEN_CREATE)
|
||||||
perm |= O_CREAT;
|
perm |= O_CREAT;
|
||||||
|
|
||||||
#ifdef O_NONBLOCK
|
#ifdef O_NONBLOCK
|
||||||
if( flags & OPEN_SCANNING )
|
if (flags & OPEN_SCANNING)
|
||||||
perm |= O_NONBLOCK;
|
perm |= O_NONBLOCK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef O_NOATIME
|
||||||
|
if (flags & OPEN_SCANNING)
|
||||||
|
perm |= O_NOATIME;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef O_DIRECT
|
#ifdef O_DIRECT
|
||||||
//Only use O_DIRECT for scanning, since cfg/policy/report reads
|
//Only use O_DIRECT for scanning, since cfg/policy/report reads
|
||||||
// don't happen w/ a nice round block size.
|
// don't happen w/ a nice round block size.
|
||||||
if ((flags & OPEN_DIRECT) && (flags & OPEN_SCANNING))
|
if ((flags & OPEN_DIRECT) && (flags & OPEN_SCANNING))
|
||||||
perm |= O_DIRECT;
|
perm |= O_DIRECT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue