Changeset 2460
- Timestamp:
- 21/03/2009 18:48:19 (3 years ago)
- Location:
- box/trunk
- Files:
-
- 18 edited
-
bin/bbackupd/BackupClientDirectoryRecord.cpp (modified) (8 diffs)
-
bin/bbackupd/Win32ServiceFunctions.cpp (modified) (1 diff)
-
bin/bbackupquery/BackupQueries.cpp (modified) (10 diffs)
-
lib/backupclient/BackupClientFileAttributes.cpp (modified) (3 diffs)
-
lib/backupclient/BackupClientFileAttributes.h (modified) (2 diffs)
-
lib/backupclient/BackupStoreFile.cpp (modified) (2 diffs)
-
lib/backupclient/BackupStoreFileDiff.cpp (modified) (1 diff)
-
lib/backupstore/BackupStoreAccountDatabase.cpp (modified) (1 diff)
-
lib/common/BoxPlatform.h (modified) (1 diff)
-
lib/common/FileModificationTime.h (modified) (3 diffs)
-
lib/common/FileStream.cpp (modified) (1 diff)
-
lib/common/Test.cpp (modified) (3 diffs)
-
lib/common/Utils.cpp (modified) (2 diffs)
-
lib/raidfile/RaidFileUtil.cpp (modified) (2 diffs)
-
lib/server/Daemon.cpp (modified) (1 diff)
-
lib/win32/emu.cpp (modified) (4 diffs)
-
lib/win32/emu.h (modified) (8 diffs)
-
test/bbackupd/testbbackupd.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp
r2401 r2460 150 150 MD5Digest currentStateChecksum; 151 151 152 struct statdest_st;152 EMU_STRUCT_STAT dest_st; 153 153 // Stat the directory, to get attribute info 154 154 // If it's a symbolic link, we want the link target here 155 155 // (as we're about to back up the contents of the directory) 156 156 { 157 if( ::stat(rLocalPath.c_str(), &dest_st) != 0)157 if(EMU_STAT(rLocalPath.c_str(), &dest_st) != 0) 158 158 { 159 159 // The directory has probably been deleted, so … … 200 200 bool downloadDirectoryRecordBecauseOfFutureFiles = false; 201 201 202 struct statlink_st;203 if( ::lstat(rLocalPath.c_str(), &link_st) != 0)202 EMU_STRUCT_STAT link_st; 203 if(EMU_LSTAT(rLocalPath.c_str(), &link_st) != 0) 204 204 { 205 205 // Report the error (logs and … … 259 259 260 260 struct dirent *en = 0; 261 struct statfile_st;261 EMU_STRUCT_STAT file_st; 262 262 std::string filename; 263 263 while((en = ::readdir(dirHandle)) != 0) … … 293 293 int type = en->d_type; 294 294 #else 295 if( ::lstat(filename.c_str(), &file_st) != 0)295 if(EMU_LSTAT(filename.c_str(), &file_st) != 0) 296 296 { 297 297 // Report the error (logs and … … 388 388 // We didn't stat the file before, 389 389 // but now we need the information. 390 if( ::lstat(filename.c_str(), &file_st) != 0)390 if(emu_stat(filename.c_str(), &file_st) != 0) 391 391 { 392 392 rNotifier.NotifyFileStatFailed(this, … … 688 688 { 689 689 // Stat the file 690 struct statst;691 if( ::lstat(filename.c_str(), &st) != 0)690 EMU_STRUCT_STAT st; 691 if(EMU_LSTAT(filename.c_str(), &st) != 0) 692 692 { 693 693 rNotifier.NotifyFileStatFailed(this, … … 758 758 { 759 759 // Check that the object we found in the ID map doesn't exist on disc 760 struct statst;761 if( ::stat(localPotentialOldName.c_str(), &st) != 0 && errno == ENOENT)760 EMU_STRUCT_STAT st; 761 if(EMU_STAT(localPotentialOldName.c_str(), &st) != 0 && errno == ENOENT) 762 762 { 763 763 // Doesn't exist locally, but does exist on the server. … … 1279 1279 { 1280 1280 // Check that the object doesn't exist already 1281 struct statst;1282 if( ::stat(localPotentialOldName.c_str(), &st) != 0 && errno == ENOENT)1281 EMU_STRUCT_STAT st; 1282 if(EMU_STAT(localPotentialOldName.c_str(), &st) != 0 && errno == ENOENT) 1283 1283 { 1284 1284 // Doesn't exist locally, but does exist on the server. -
box/trunk/bin/bbackupd/Win32ServiceFunctions.cpp
r2127 r2460 204 204 if (pConfigFileName != NULL) 205 205 { 206 struct statst;206 EMU_STRUCT_STAT st; 207 207 208 208 if (emu_stat(pConfigFileName, &st) != 0) -
box/trunk/bin/bbackupquery/BackupQueries.cpp
r2448 r2460 915 915 916 916 // Does file exist? 917 struct statst;918 if( ::stat(args[1].c_str(), &st) == 0 || errno != ENOENT)917 EMU_STRUCT_STAT st; 918 if(EMU_STAT(args[1].c_str(), &st) == 0 || errno != ENOENT) 919 919 { 920 920 BOX_ERROR("The local file '" << args[1] << " already exists."); … … 1147 1147 1148 1148 // Does local file already exist? (don't want to overwrite) 1149 struct statst;1150 if( ::stat(localName.c_str(), &st) == 0 || errno != ENOENT)1149 EMU_STRUCT_STAT st; 1150 if(EMU_STAT(localName.c_str(), &st) == 0 || errno != ENOENT) 1151 1151 { 1152 1152 BOX_ERROR("The local file " << localName << " already exists, " … … 1228 1228 syncTimeFilename += "last_sync_start"; 1229 1229 // Stat it to get file time 1230 struct statst;1231 if( ::stat(syncTimeFilename.c_str(), &st) == 0)1230 EMU_STRUCT_STAT st; 1231 if(EMU_STAT(syncTimeFilename.c_str(), &st) == 0) 1232 1232 { 1233 1233 // Files modified after this time shouldn't be on the server, so report errors slightly differently … … 1405 1405 bool modifiedAfterLastSync = false; 1406 1406 1407 struct statst;1408 if( ::stat(rLocalDir.c_str(), &st) == 0)1407 EMU_STRUCT_STAT st; 1408 if(EMU_STAT(rLocalDir.c_str(), &st) == 0) 1409 1409 { 1410 1410 if(FileAttrModificationTime(st) > … … 1440 1440 1441 1441 // Get info on the local directory 1442 struct statst;1443 if( ::lstat(rLocalDir.c_str(), &st) != 0)1442 EMU_STRUCT_STAT st; 1443 if(EMU_LSTAT(rLocalDir.c_str(), &st) != 0) 1444 1444 { 1445 1445 // What kind of error? … … 1495 1495 bool modifiedAfterLastSync = false; 1496 1496 1497 struct statst;1498 if( ::stat(rLocalDir.c_str(), &st) == 0)1497 EMU_STRUCT_STAT st; 1498 if(EMU_STAT(rLocalDir.c_str(), &st) == 0) 1499 1499 { 1500 1500 if(FileAttrModificationTime(st) > … … 1548 1548 std::string fn(MakeFullPath 1549 1549 (rLocalDir, localDirEn->d_name)); 1550 struct statst;1551 if( ::lstat(fn.c_str(), &st) != 0)1550 EMU_STRUCT_STAT st; 1551 if(EMU_LSTAT(fn.c_str(), &st) != 0) 1552 1552 { 1553 1553 THROW_EXCEPTION(CommonException, OSFileError) … … 1639 1639 int64_t fileSize = 0; 1640 1640 1641 struct statst;1642 if( ::stat(localPath.c_str(), &st) == 0)1641 EMU_STRUCT_STAT st; 1642 if(EMU_STAT(localPath.c_str(), &st) == 0) 1643 1643 { 1644 1644 fileSize = st.st_size; … … 1772 1772 bool modifiedAfterLastSync = false; 1773 1773 1774 struct statst;1775 if( ::stat(localPath.c_str(), &st) == 0)1774 EMU_STRUCT_STAT st; 1775 if(EMU_STAT(localPath.c_str(), &st) == 0) 1776 1776 { 1777 1777 if(FileModificationTime(st) > … … 1846 1846 1847 1847 // Check the dir modification time 1848 struct statst;1849 if( ::stat(localPath.c_str(), &st) == 0 &&1848 EMU_STRUCT_STAT st; 1849 if(EMU_STAT(localPath.c_str(), &st) == 0 && 1850 1850 FileModificationTime(st) > 1851 1851 rParams.LatestFileUploadTime()) -
box/trunk/lib/backupclient/BackupClientFileAttributes.cpp
r2360 r2460 303 303 try 304 304 { 305 struct statst;306 if( ::lstat(Filename, &st) != 0)305 EMU_STRUCT_STAT st; 306 if(EMU_LSTAT(Filename, &st) != 0) 307 307 { 308 308 BOX_LOG_SYS_ERROR("Failed to stat file: '" << … … 396 396 // 397 397 // -------------------------------------------------------------------------- 398 void BackupClientFileAttributes::FillAttributes(StreamableMemBlock &outputBlock, const char *Filename, struct stat&st, bool ZeroModificationTimes)398 void BackupClientFileAttributes::FillAttributes(StreamableMemBlock &outputBlock, const char *Filename, EMU_STRUCT_STAT &st, bool ZeroModificationTimes) 399 399 { 400 400 outputBlock.ResizeBlock(sizeof(attr_StreamFormat)); … … 1038 1038 // 1039 1039 // -------------------------------------------------------------------------- 1040 uint64_t BackupClientFileAttributes::GenerateAttributeHash( struct stat&st, const std::string &filename, const std::string &leafname)1040 uint64_t BackupClientFileAttributes::GenerateAttributeHash(EMU_STRUCT_STAT &st, const std::string &filename, const std::string &leafname) 1041 1041 { 1042 1042 if(sAttributeHashSecretLength == 0) -
box/trunk/lib/backupclient/BackupClientFileAttributes.h
r1618 r2460 16 16 #include "BoxTime.h" 17 17 18 struct stat; 18 EMU_STRUCT_STAT; // declaration 19 19 20 20 // -------------------------------------------------------------------------- … … 54 54 static void SetAttributeHashSecret(const void *pSecret, int SecretLength); 55 55 56 static uint64_t GenerateAttributeHash( struct stat&st, const std::string &filename, const std::string &leafname);56 static uint64_t GenerateAttributeHash(EMU_STRUCT_STAT &st, const std::string &filename, const std::string &leafname); 57 57 static void FillExtendedAttr(StreamableMemBlock &outputBlock, const char *Filename); 58 58 59 59 private: 60 static void FillAttributes(StreamableMemBlock &outputBlock, const char *Filename, struct stat &st, bool ZeroModificationTimes); 60 static void FillAttributes(StreamableMemBlock &outputBlock, 61 const char *Filename, EMU_STRUCT_STAT &st, 62 bool ZeroModificationTimes); 61 63 static void FillAttributesLink(StreamableMemBlock &outputBlock, const char *Filename, struct stat &st); 62 64 void WriteExtendedAttr(const char *Filename, int xattrOffset) const; -
box/trunk/lib/backupclient/BackupStoreFile.cpp
r2245 r2460 273 273 { 274 274 // Does file exist? 275 struct statst;276 if( ::stat(DecodedFilename, &st) == 0)275 EMU_STRUCT_STAT st; 276 if(EMU_STAT(DecodedFilename, &st) == 0) 277 277 { 278 278 THROW_EXCEPTION(BackupStoreException, OutputFileAlreadyExists) … … 1261 1261 bool sourceIsSymlink = false; 1262 1262 { 1263 struct statst;1264 if( ::lstat(Filename, &st) == -1)1263 EMU_STRUCT_STAT st; 1264 if(EMU_LSTAT(Filename, &st) == -1) 1265 1265 { 1266 1266 THROW_EXCEPTION(CommonException, OSFileError) -
box/trunk/lib/backupclient/BackupStoreFileDiff.cpp
r2415 r2460 131 131 // Is it a symlink? 132 132 { 133 struct statst;134 if( ::lstat(Filename, &st) != 0)133 EMU_STRUCT_STAT st; 134 if(EMU_LSTAT(Filename, &st) != 0) 135 135 { 136 136 THROW_EXCEPTION(CommonException, OSFileError) -
box/trunk/lib/backupstore/BackupStoreAccountDatabase.cpp
r217 r2460 209 209 box_time_t BackupStoreAccountDatabase::GetDBFileModificationTime() const 210 210 { 211 struct statst;212 if( ::stat(pImpl->mFilename.c_str(), &st) == -1)211 EMU_STRUCT_STAT st; 212 if(EMU_STAT(pImpl->mFilename.c_str(), &st) == -1) 213 213 { 214 214 THROW_EXCEPTION(CommonException, OSFileError) -
box/trunk/lib/common/BoxPlatform.h
r2395 r2460 39 39 #define __MSVCRT_VERSION__ 0x0601 40 40 #endif 41 42 // stop sys/types.h from defining its own ino_t as short,43 // because we want a bigger one :)44 #define _INO_T_45 41 #endif 46 42 -
box/trunk/lib/common/FileModificationTime.h
r2080 r2460 15 15 #include "BoxTime.h" 16 16 17 inline box_time_t FileModificationTime( struct stat&st)17 inline box_time_t FileModificationTime(EMU_STRUCT_STAT &st) 18 18 { 19 19 #ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC … … 27 27 } 28 28 29 inline box_time_t FileAttrModificationTime( struct stat&st)29 inline box_time_t FileAttrModificationTime(EMU_STRUCT_STAT &st) 30 30 { 31 31 box_time_t statusmodified = … … 46 46 } 47 47 48 inline box_time_t FileModificationTimeMaxModAndAttr( struct stat&st)48 inline box_time_t FileModificationTimeMaxModAndAttr(EMU_STRUCT_STAT &st) 49 49 { 50 50 #ifndef HAVE_STRUCT_STAT_ST_MTIMESPEC -
box/trunk/lib/common/FileStream.cpp
r2432 r2460 225 225 IOStream::pos_type FileStream::BytesLeftToRead() 226 226 { 227 struct statst;228 if( ::fstat(mOSFileHandle, &st) != 0)227 EMU_STRUCT_STAT st; 228 if(EMU_FSTAT(mOSFileHandle, &st) != 0) 229 229 { 230 230 THROW_EXCEPTION(CommonException, OSFileError) -
box/trunk/lib/common/Test.cpp
r2229 r2460 26 26 bool TestFileExists(const char *Filename) 27 27 { 28 struct statst;29 return ::stat(Filename, &st) == 0 && (st.st_mode & S_IFDIR) == 0;28 EMU_STRUCT_STAT st; 29 return EMU_STAT(Filename, &st) == 0 && (st.st_mode & S_IFDIR) == 0; 30 30 } 31 31 32 32 bool TestFileNotEmpty(const char *Filename) 33 33 { 34 struct statst;35 return ::stat(Filename, &st) == 0 && (st.st_mode & S_IFDIR) == 0 &&34 EMU_STRUCT_STAT st; 35 return EMU_STAT(Filename, &st) == 0 && (st.st_mode & S_IFDIR) == 0 && 36 36 st.st_size > 0; 37 37 } … … 39 39 bool TestDirExists(const char *Filename) 40 40 { 41 struct statst;42 return ::stat(Filename, &st) == 0 && (st.st_mode & S_IFDIR) == S_IFDIR;41 EMU_STRUCT_STAT st; 42 return EMU_STAT(Filename, &st) == 0 && (st.st_mode & S_IFDIR) == S_IFDIR; 43 43 } 44 44 … … 46 46 int TestGetFileSize(const char *Filename) 47 47 { 48 struct statst;49 if( ::stat(Filename, &st) == 0)48 EMU_STRUCT_STAT st; 49 if(EMU_STAT(Filename, &st) == 0) 50 50 { 51 51 return st.st_size; -
box/trunk/lib/common/Utils.cpp
r2415 r2460 164 164 bool FileExists(const char *Filename, int64_t *pFileSize, bool TreatLinksAsNotExisting) 165 165 { 166 struct statst;167 if( ::lstat(Filename, &st) != 0)166 EMU_STRUCT_STAT st; 167 if(EMU_LSTAT(Filename, &st) != 0) 168 168 { 169 169 if(errno == ENOENT) … … 209 209 int ObjectExists(const std::string& rFilename) 210 210 { 211 struct statst;212 if( ::stat(rFilename.c_str(), &st) != 0)211 EMU_STRUCT_STAT st; 212 if(EMU_STAT(rFilename.c_str(), &st) != 0) 213 213 { 214 214 if(errno == ENOENT) -
box/trunk/lib/raidfile/RaidFileUtil.cpp
r2415 r2460 58 58 if(pRevisionID != 0) 59 59 { 60 (*pRevisionID) = FileModificationTime(st); 60 #ifdef WIN32 61 *pRevisionID = st.st_mtime; 62 #else 63 *pRevisionID = FileModificationTime(st); 64 #endif 65 61 66 #ifdef BOX_RELEASE_BUILD 62 67 // The resolution of timestamps may be very … … 99 104 if(pRevisionID != 0) 100 105 { 101 int64_t rid = FileModificationTime(st); 106 #ifdef WIN32 107 int64_t rid = st.st_mtime; 108 #else 109 int64_t rid = FileModificationTime(st); 110 #endif 111 102 112 if(rid > revisionID) revisionID = rid; 103 113 revisionIDplus += st.st_size; -
box/trunk/lib/server/Daemon.cpp
r2415 r2460 963 963 box_time_t Daemon::GetConfigFileModifiedTime() const 964 964 { 965 struct statst;966 967 if( ::stat(GetConfigFileName().c_str(), &st) != 0)965 EMU_STRUCT_STAT st; 966 967 if(EMU_STAT(GetConfigFileName().c_str(), &st) != 0) 968 968 { 969 969 if (errno == ENOENT) -
box/trunk/lib/win32/emu.cpp
r2416 r2460 22 22 23 23 // message resource definitions for syslog() 24 25 24 #include "messages.h" 26 25 27 // our implementation for a timer, based on a28 // simple thread which sleeps for a period of time29 30 static bool gTimerInitialised = false;31 static bool gFinishTimer;32 static CRITICAL_SECTION gLock;33 34 26 DWORD winerrno; 35 36 typedef struct37 {38 int countDown;39 int interval;40 }41 Timer_t;42 43 std::list<Timer_t> gTimerList;44 static void (__cdecl *gTimerFunc) (int) = NULL;45 46 int setitimer(int type, struct itimerval *timeout, void *arg)47 {48 assert(gTimerInitialised);49 50 if (ITIMER_REAL != type)51 {52 errno = ENOSYS;53 return -1;54 }55 56 EnterCriticalSection(&gLock);57 58 // we only need seconds for the mo!59 if (timeout->it_value.tv_sec == 0 &&60 timeout->it_value.tv_usec == 0)61 {62 gTimerList.clear();63 }64 else65 {66 Timer_t ourTimer;67 ourTimer.countDown = timeout->it_value.tv_sec;68 ourTimer.interval = timeout->it_interval.tv_sec;69 gTimerList.push_back(ourTimer);70 }71 72 LeaveCriticalSection(&gLock);73 74 // indicate success75 return 0;76 }77 78 static unsigned int WINAPI RunTimer(LPVOID lpParameter)79 {80 gFinishTimer = false;81 82 while (!gFinishTimer)83 {84 std::list<Timer_t>::iterator it;85 EnterCriticalSection(&gLock);86 87 for (it = gTimerList.begin(); it != gTimerList.end(); it++)88 {89 Timer_t& rTimer(*it);90 91 rTimer.countDown --;92 if (rTimer.countDown == 0)93 {94 if (gTimerFunc != NULL)95 {96 gTimerFunc(0);97 }98 if (rTimer.interval)99 {100 rTimer.countDown = rTimer.interval;101 }102 else103 {104 // mark for deletion105 rTimer.countDown = -1;106 }107 }108 }109 110 for (it = gTimerList.begin(); it != gTimerList.end(); it++)111 {112 Timer_t& rTimer(*it);113 114 if (rTimer.countDown == -1)115 {116 gTimerList.erase(it);117 118 // the iterator is now invalid, so restart search119 it = gTimerList.begin();120 121 // if the list is now empty, don't try to increment122 // the iterator again123 if (it == gTimerList.end()) break;124 }125 }126 127 LeaveCriticalSection(&gLock);128 // we only need to have a 1 second resolution129 Sleep(1000);130 }131 132 return 0;133 }134 135 int SetTimerHandler(void (__cdecl *func ) (int))136 {137 gTimerFunc = func;138 return 0;139 }140 141 void InitTimer(void)142 {143 assert(!gTimerInitialised);144 145 InitializeCriticalSection(&gLock);146 147 // create our thread148 HANDLE ourThread = (HANDLE)_beginthreadex(NULL, 0, RunTimer, 0,149 CREATE_SUSPENDED, NULL);150 SetThreadPriority(ourThread, THREAD_PRIORITY_LOWEST);151 ResumeThread(ourThread);152 153 gTimerInitialised = true;154 }155 156 void FiniTimer(void)157 {158 assert(gTimerInitialised);159 gFinishTimer = true;160 EnterCriticalSection(&gLock);161 DeleteCriticalSection(&gLock);162 gTimerInitialised = false;163 }164 165 //Our constants we need to keep track of166 //globals167 27 struct passwd gTempPasswd; 168 28 … … 716 576 // Function 717 577 // Name: emu_fstat 718 // Purpose: replacement for fstat supply a windows handle 578 // Purpose: replacement for fstat. Supply a windows handle. 579 // Returns a struct emu_stat to have room for 64-bit 580 // file identifier in st_ino (mingw allows only 16!) 719 581 // Created: 25th October 2004 720 582 // 721 583 // -------------------------------------------------------------------------- 722 int emu_fstat(HANDLE hdir, struct stat * st)584 int emu_fstat(HANDLE hdir, struct emu_stat * st) 723 585 { 724 586 if (hdir == INVALID_HANDLE_VALUE) … … 752 614 conv.HighPart = fi.nFileIndexHigh; 753 615 conv.LowPart = fi.nFileIndexLow; 754 st->st_ino = (_ino_t)conv.QuadPart;616 st->st_ino = conv.QuadPart; 755 617 756 618 // get the time information … … 899 761 // Function 900 762 // Name: emu_stat 901 // Purpose: replacement for the lstat and stat functions, 902 // works with unicode filenames supplied in utf8 format 763 // Purpose: replacement for the lstat and stat functions. 764 // Works with unicode filenames supplied in utf8. 765 // Returns a struct emu_stat to have room for 64-bit 766 // file identifier in st_ino (mingw allows only 16!) 903 767 // Created: 25th October 2004 904 768 // 905 769 // -------------------------------------------------------------------------- 906 int emu_stat(const char * pName, struct stat * st)770 int emu_stat(const char * pName, struct emu_stat * st) 907 771 { 908 772 HANDLE handle = OpenFileByNameUtf8(pName, -
box/trunk/lib/win32/emu.h
r2416 r2460 1 1 // emulates unix syscalls to win32 functions 2 3 #ifdef WIN32 4 #define EMU_STRUCT_STAT struct emu_stat 5 #define EMU_STAT emu_stat 6 #define EMU_FSTAT emu_fstat 7 #define EMU_LSTAT emu_stat 8 #else 9 #define EMU_STRUCT_STAT struct stat 10 #define EMU_STAT ::stat 11 #define EMU_FSTAT ::fstat 12 #define EMU_LSTAT ::lstat 13 #endif 2 14 3 15 #if ! defined EMU_INCLUDE && defined WIN32 … … 26 38 #ifdef __MINGW32__ 27 39 typedef uint32_t u_int32_t; 28 typedef uint64_t _ino_t;29 typedef _ino_t ino_t;30 #define _INO_T_31 40 #else 32 41 typedef unsigned int mode_t; 33 42 typedef unsigned int pid_t; 34 35 // must define _INO_T_DEFINED before including <sys/types.h>36 // to replace it with our own.37 typedef u_int64_t _ino_t;38 #define _INO_T_DEFINED39 43 #endif 40 44 … … 82 86 #endif 83 87 84 int SetTimerHandler(void (__cdecl *func ) (int));85 int setitimer(int type, struct itimerval *timeout, void *arg);86 void InitTimer(void);87 void FiniTimer(void);88 89 88 struct passwd { 90 89 char *pw_name; … … 188 187 #define timespec timeval 189 188 190 //not available in win32191 struct itimerval192 {193 timeval it_interval;194 timeval it_value;195 };196 197 189 //win32 deals in usec not nsec - so need to ensure this follows through 198 190 #define tv_nsec tv_usec … … 314 306 }; 315 307 316 #if 0 317 // I think this should get us going 318 // Although there is a warning about 319 // mount points in win32 can now exists - which means inode number can be 320 // duplicated, so potential of a problem - perhaps this needs to be 321 // implemented with a little more thought... TODO 322 323 struct stat { 324 //_dev_t st_dev; 325 u_int64_t st_ino; 308 struct emu_stat { 309 int st_dev; 310 uint64_t st_ino; 326 311 DWORD st_mode; 327 312 short st_nlink; … … 329 314 short st_gid; 330 315 //_dev_t st_rdev; 331 u _int64_t st_size;316 uint64_t st_size; 332 317 time_t st_atime; 333 318 time_t st_mtime; 334 319 time_t st_ctime; 335 320 }; 336 #endif // 0337 321 338 322 // need this for conversions … … 343 327 int emu_mkdir (const char* pPathName); 344 328 int emu_unlink (const char* pFileName); 345 int emu_fstat (HANDLE file, struct stat* st);346 int emu_stat (const char* pName, struct stat* st);329 int emu_fstat (HANDLE file, struct emu_stat* st); 330 int emu_stat (const char* pName, struct emu_stat* st); 347 331 int emu_utimes (const char* pName, const struct timeval[]); 348 332 int emu_chmod (const char* pName, mode_t mode); … … 353 337 #define mkdir(path, mode) emu_mkdir (path) 354 338 #define unlink(file) emu_unlink (file) 355 #define stat(filename, struct) emu_stat (filename, struct)356 #define lstat(filename, struct) emu_stat (filename, struct)357 #define fstat(handle, struct) emu_fstat (handle, struct)358 339 #define utimes(buffer, times) emu_utimes (buffer, times) 359 340 #define chmod(file, mode) emu_chmod (file, mode) 360 341 #define getcwd(buffer, size) emu_getcwd (buffer, size) 361 342 #define rename(oldname, newname) emu_rename (oldname, newname) 343 344 // Not safe to replace stat/fstat/lstat on mingw at least, as struct stat 345 // has a 16-bit st_ino and we need a 64-bit one. 346 // 347 // #define stat(filename, struct) emu_stat (filename, struct) 348 // #define lstat(filename, struct) emu_stat (filename, struct) 349 // #define fstat(handle, struct) emu_fstat (handle, struct) 350 // 351 // But lstat doesn't exist on Windows, so we have to provide something: 352 353 #define lstat(filename, struct) stat(filename, struct) 362 354 363 355 int statfs(const char * name, struct statfs * s); -
box/trunk/test/bbackupd/testbbackupd.cpp
r2452 r2460 259 259 bool attrmatch(const char *f1, const char *f2) 260 260 { 261 struct stats1, s2;262 TEST_THAT( ::lstat(f1, &s1) == 0);263 TEST_THAT( ::lstat(f2, &s2) == 0);261 EMU_STRUCT_STAT s1, s2; 262 TEST_THAT(EMU_LSTAT(f1, &s1) == 0); 263 TEST_THAT(EMU_LSTAT(f2, &s2) == 0); 264 264 265 265 #ifdef HAVE_SYS_XATTR_H … … 2028 2028 "their contents can be restored.\n"); 2029 2029 2030 int compareReturnValue; 2031 2030 2032 { 2031 2033 #ifdef WIN32 … … 2040 2042 wait_for_sync_end(); // should be backed up now 2041 2043 2042 intcompareReturnValue = ::system(BBACKUPQUERY " "2044 compareReturnValue = ::system(BBACKUPQUERY " " 2043 2045 "-Wwarning " 2044 2046 "-c testfiles/bbackupd.conf " … … 2083 2085 2084 2086 } 2085 2086 int compareReturnValue;2087 2087 2088 2088 #ifdef WIN32
Note: See TracChangeset
for help on using the changeset viewer.
