diff --git a/configure b/configure index 676edfb..625c4a7 100755 --- a/configure +++ b/configure @@ -3251,8 +3251,8 @@ ac_config_headers="$ac_config_headers config.h" rm -f src/tripwire/syslog.h 2> /dev/null chmod 755 install-sh 2> /dev/null -CFLAGS=${CFLAGS:-"-O -pipe -Wall -Wno-non-virtual-dtor"} -CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -Wno-non-virtual-dtor"} +CFLAGS=${CFLAGS:-"-O -pipe -Wall -Wno-non-virtual-dtor -D_LARGEFILE_SOURCE"} +CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -Wno-non-virtual-dtor -D_LARGEFILE_SOURCE"} # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : diff --git a/configure.in b/configure.in index da57683..e3cb322 100644 --- a/configure.in +++ b/configure.in @@ -17,8 +17,8 @@ chmod 755 install-sh 2> /dev/null dnl ############### dnl Setup defaults dnl ############### -CFLAGS=${CFLAGS:-"-O -pipe -Wall -Wno-non-virtual-dtor"} -CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -Wno-non-virtual-dtor"} +CFLAGS=${CFLAGS:-"-O -pipe -Wall -Wno-non-virtual-dtor -D_LARGEFILE_SOURCE"} +CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -Wno-non-virtual-dtor -D_LARGEFILE_SOURCE"} dnl ##################### dnl Configuration options diff --git a/src/core/archive.cpp b/src/core/archive.cpp old mode 100644 new mode 100755 index fdcbc3e..08c7813 --- a/src/core/archive.cpp +++ b/src/core/archive.cpp @@ -678,6 +678,7 @@ void cFileArchive::OpenRead(const TCHAR* filename, uint32 openFlags) uint32 flags = cFile::OPEN_READ; flags |= ( ( openFlags & FA_OPEN_TRUNCATE ) ? cFile::OPEN_TRUNCATE : 0 ); flags |= ( ( openFlags & FA_OPEN_TEXT ) ? cFile::OPEN_TEXT : 0 ); + flags |= ( ( openFlags & FA_NONBLOCKING ) ? cFile::OPEN_NONBLOCKING :0 ); mCurrentFilename = filename; mCurrentFile.Open( filename, flags ); @@ -703,6 +704,7 @@ void cFileArchive::OpenReadWrite(const TCHAR* filename, uint32 openFlags) uint32 flags = cFile::OPEN_WRITE; flags |= ( ( openFlags & FA_OPEN_TRUNCATE ) ? cFile::OPEN_TRUNCATE : 0 ); flags |= ( ( openFlags & FA_OPEN_TEXT ) ? cFile::OPEN_TEXT : 0 ); + flags |= ( ( openFlags & FA_NONBLOCKING ) ? cFile::OPEN_NONBLOCKING :0 ); mCurrentFilename = filename; mCurrentFile.Open( filename, flags ); diff --git a/src/core/archive.h b/src/core/archive.h old mode 100644 new mode 100755 index 810f7ed..4819bc5 --- a/src/core/archive.h +++ b/src/core/archive.h @@ -259,7 +259,8 @@ public: enum OpenFlags { FA_OPEN_TEXT = 0x1, - FA_OPEN_TRUNCATE = 0x2 + FA_OPEN_TRUNCATE = 0x2, + FA_NONBLOCKING = 0x4 }; // TODO: Open should throw diff --git a/src/core/file.h b/src/core/file.h old mode 100644 new mode 100755 index 3289660..77c53b2 --- a/src/core/file.h +++ b/src/core/file.h @@ -81,22 +81,22 @@ public: enum SeekFrom { - SEEK_BEGIN = 0, - SEEK_CURRENT, - SEEK_EOF + SEEK_BEGIN = 0, + SEEK_CURRENT, + SEEK_EOF }; enum OpenFlags { - // note that reading from the file is implicit - // - OPEN_READ = 0x00000001, // not needed, but makes calls nice... - OPEN_WRITE = 0x00000002, // we will be writing to the file - OPEN_LOCKED_TEMP = 0x00000004, // the file should not be readable by other processes and should be removed when closed - OPEN_TRUNCATE = 0x00000008, // opens an empty file. creates it if it doesn't exist. Doesn't make much sense without OF_WRITE - OPEN_CREATE = 0x00000010, // create the file if it doesn't exist; this is implicit if OF_TRUNCATE is set - OPEN_TEXT = 0x00000020, - OPEN_EXCLUSIVE = 0x00000040 // Use O_CREAT | O_EXCL + // note that reading from the file is implicit + OPEN_READ = 0x00000001, // not needed, but makes calls nice... + OPEN_WRITE = 0x00000002, // we will be writing to the file + OPEN_LOCKED_TEMP = 0x00000004, // the file should not be readable by other processes and should be removed when closed + OPEN_TRUNCATE = 0x00000008, // opens an empty file. creates it if it doesn't exist. Doesn't make much sense without OF_WRITE + OPEN_CREATE = 0x00000010, // create the file if it doesn't exist; this is implicit if OF_TRUNCATE is set + OPEN_TEXT = 0x00000020, + OPEN_EXCLUSIVE = 0x00000040, // Use O_CREAT | O_EXCL + OPEN_NONBLOCKING = 0x00000080, // Use non-blocking i/o [Unix] }; //Ctor, Dtor, CpyCtor, Operator=: diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp old mode 100644 new mode 100755 index 94b92db..ab031f3 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -165,10 +165,13 @@ void cFile::Open( const TSTRING& sFileNameC, uint32 flags ) openmode = (mode_t) 0600; // Make sure only root can read the file } - if ( flags & OPEN_CREATE ) - perm |= O_CREAT; - + if ( flags & OPEN_CREATE ) + perm |= O_CREAT; +#ifdef O_NONBLOCK + if( flags & OPEN_NONBLOCKING ) + perm |= O_NONBLOCK; +#endif // // actually open the file // diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp old mode 100644 new mode 100755 index 72dac00..8400a6c --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -295,7 +295,7 @@ void cFSPropCalc::VisitFSObject(cFSObject& obj) pTheArch = &arch; try { - arch.OpenRead(strName.c_str()); + arch.OpenRead(strName.c_str(), cFileArchive::FA_NONBLOCKING); } catch (eArchive&) {