Use O_NOATIME to avoid disturbing st_atime when possible. Closes issue #230
This commit is contained in:
parent
e0517a7d13
commit
3cceffdb9c
@ -111,6 +111,11 @@ bool MimeHandlerMail::set_document_file(const string& mt, const string &fn)
|
||||
fn.c_str(), errno));
|
||||
return false;
|
||||
}
|
||||
#if defined O_NOATIME && O_NOATIME != 0
|
||||
if (fcntl(m_fd, F_SETFL, O_NOATIME) < 0) {
|
||||
// perror("fcntl");
|
||||
}
|
||||
#endif
|
||||
delete m_bincdoc;
|
||||
m_bincdoc = new Binc::MimeDocument;
|
||||
m_bincdoc->parseFull(m_fd);
|
||||
|
||||
@ -267,6 +267,11 @@ bool MimeHandlerMbox::set_document_file(const string& mt, const string &fn)
|
||||
fn.c_str()));
|
||||
return false;
|
||||
}
|
||||
#if defined O_NOATIME && O_NOATIME != 0
|
||||
if (fcntl(fileno((FILE *)m_vfp), F_SETFL, O_NOATIME) < 0) {
|
||||
// perror("fcntl");
|
||||
}
|
||||
#endif
|
||||
fseek((FILE *)m_vfp, 0, SEEK_END);
|
||||
m_fsize = ftell((FILE*)m_vfp);
|
||||
fseek((FILE*)m_vfp, 0, SEEK_SET);
|
||||
|
||||
@ -103,6 +103,12 @@ bool file_scan(const string &fn, FileScanDo* doer, off_t startoffs,
|
||||
noclosing = false;
|
||||
}
|
||||
|
||||
#if defined O_NOATIME && O_NOATIME != 0
|
||||
if (fcntl(fd, F_SETFL, O_NOATIME) < 0) {
|
||||
// perror("fcntl");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (cnttoread != (size_t)-1 && cnttoread) {
|
||||
doer->init(cnttoread+1, reason);
|
||||
} else if (st.st_size > 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user