* apt-pkg/contrib/fileutl.cc:
[ntk/apt.git] / apt-pkg / contrib / mmap.h
index cd2b15b..2bf2c15 100644 (file)
@@ -44,6 +44,11 @@ class MMap
    unsigned long iSize;
    void *Base;
 
+   // In case mmap can not be used, we keep a dup of the file
+   // descriptor that should have been mmaped so that we can write to
+   // the file in Sync().
+   FileFd *SyncToFd;
+
    bool Map(FileFd &Fd);
    bool Close(bool DoSync = true);
    
@@ -56,6 +61,8 @@ class MMap
    inline operator void *() {return Base;};
    inline void *Data() {return Base;}; 
    inline unsigned long Size() {return iSize;};
+   inline void AddSize(unsigned long const size) {iSize += size;};
+   inline bool validData() const { return Base != (void *)-1 && Base != 0; };
    
    // File manipulators
    bool Sync();