Caching & direct i/o stuff for HP-UX, via VX_xxx ioctls.

This commit is contained in:
Brian Cox 2016-06-09 18:35:40 -07:00
parent 3ce7d71749
commit e42921d04a
1 changed files with 20 additions and 2 deletions

View File

@ -53,6 +53,10 @@
#include <fcntl.h>
#include <errno.h>
#ifdef __hpux__
# include <sys/fs/vx_ioctl.h>
#endif
#include "core/debug.h"
#include "core/corestrings.h"
#include "core/fsservices.h"
@ -223,7 +227,7 @@ void cFile::Open( const TSTRING& sFileNameC, uint32 flags )
cFile::Rewind();
#ifdef F_NOCACHE
#ifdef F_NOCACHE //OSX
if ((flags & OPEN_DIRECT) && (flags & OPEN_SCANNING))
fcntl(fh, F_NOCACHE, 1);
#endif
@ -233,8 +237,22 @@ void cFile::Open( const TSTRING& sFileNameC, uint32 flags )
directio(fh, DIRECTIO_ON);
#endif
#ifdef __hpux__
if (flags & OPEN_SCANNING)
{
if (flags & OPEN_DIRECT)
ioctl(fh, VX_SETCACHE, VX_DIRECT);
else
ioctl(fh, VX_SETCACHE, VX_SEQ | VX_NOREUSE);
}
#endif
#ifdef HAVE_POSIX_FADVISE
if (flags & OPEN_SCANNING) {
if (flags & OPEN_SCANNING)
{
posix_fadvise(fh,0,0, POSIX_FADV_SEQUENTIAL);
posix_fadvise(fh,0,0, POSIX_FADV_NOREUSE);
}