diff --git a/src/internfile/mh_mail.cpp b/src/internfile/mh_mail.cpp index c2396c0e..23870e07 100644 --- a/src/internfile/mh_mail.cpp +++ b/src/internfile/mh_mail.cpp @@ -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); diff --git a/src/internfile/mh_mbox.cpp b/src/internfile/mh_mbox.cpp index 83cf3a2a..418004d4 100644 --- a/src/internfile/mh_mbox.cpp +++ b/src/internfile/mh_mbox.cpp @@ -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); diff --git a/src/utils/readfile.cpp b/src/utils/readfile.cpp index dca729c5..858a5155 100644 --- a/src/utils/readfile.cpp +++ b/src/utils/readfile.cpp @@ -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) {