1 2 #ifndef FILELOCKS_H_ 3 #define FILELOCKS_H_ 4 5 #include <memory> 6 #include <set> 7 #include <sys/types.h> 8 #include <sys/stat.h> 9 #include <unistd.h> 10 11 namespace acng 12 { 13 14 struct TFileShrinkGuard 15 { 16 static std::unique_ptr<TFileShrinkGuard> Acquire(const struct stat&); 17 ~TFileShrinkGuard(); 18 19 private: 20 static std::set<std::pair<dev_t,ino_t > > g_mmapLocks; 21 decltype(g_mmapLocks)::iterator m_it; 22 TFileShrinkGuard() =default; 23 }; 24 25 } 26 27 #endif /* FILELOCKS_H_ */ 28