From 4bbbe25802ee5d625d05b9566bcc488b93974692 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 2 Feb 2010 15:28:36 +0000 Subject: * Remove most Cygwin-specific code. Cygwin 1.7 implements advisory POSIX locks, and simulates Unix-style file deletion semantics sufficiently. Note that this means that Nix won't work on Cygwin 1.5 anymore. --- src/libstore/gc.cc | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'src/libstore/gc.cc') diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index baa6826fe2a5..f58f691c99dd 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -15,11 +15,6 @@ #include #include -#ifdef __CYGWIN__ -#include -#include -#endif - namespace nix { @@ -179,15 +174,6 @@ void LocalStore::addTempRoot(const Path & path) fdGCLock.close(); - /* Note that on Cygwin a lot of the following complexity - is unnecessary, since we cannot delete open lock - files. If we have the lock file open, then it's valid; - if we can delete it, then it wasn't in use any more. - - Also note that on Cygwin we cannot "upgrade" a lock - from a read lock to a write lock. */ - -#ifndef __CYGWIN__ debug(format("acquiring read lock on `%1%'") % fnTempRoots); lockFile(fdTempRoots, ltRead, true); @@ -201,10 +187,6 @@ void LocalStore::addTempRoot(const Path & path) /* The garbage collector deleted this file before we could get a lock. (It won't delete the file after we get a lock.) Try again. */ - -#else - break; -#endif } } @@ -217,14 +199,9 @@ void LocalStore::addTempRoot(const Path & path) string s = path + '\0'; writeFull(fdTempRoots, (const unsigned char *) s.c_str(), s.size()); -#ifndef __CYGWIN__ /* Downgrade to a read lock. */ debug(format("downgrading to read lock on `%1%'") % fnTempRoots); lockFile(fdTempRoots, ltRead, true); -#else - debug(format("releasing write lock on `%1%'") % fnTempRoots); - lockFile(fdTempRoots, ltNone, true); -#endif } @@ -252,19 +229,6 @@ static void readTempRoots(PathSet & tempRoots, FDs & fds) Path path = (format("%1%/%2%/%3%") % nixStateDir % tempRootsDir % *i).str(); debug(format("reading temporary root file `%1%'") % path); - -#ifdef __CYGWIN__ - /* On Cygwin we just try to delete the lock file. */ - char win32Path[MAX_PATH]; - cygwin_conv_to_full_win32_path(path.c_str(), win32Path); - if (DeleteFile(win32Path)) { - printMsg(lvlError, format("removed stale temporary roots file `%1%'") - % path); - continue; - } else - debug(format("delete of `%1%' failed: %2%") % path % GetLastError()); -#endif - FDPtr fd(new AutoCloseFD(open(path.c_str(), O_RDWR, 0666))); if (*fd == -1) { /* It's okay if the file has disappeared. */ @@ -276,7 +240,6 @@ static void readTempRoots(PathSet & tempRoots, FDs & fds) //FDPtr fd(new AutoCloseFD(openLockFile(path, false))); //if (*fd == -1) continue; -#ifndef __CYGWIN__ /* Try to acquire a write lock without blocking. This can only succeed if the owning process has died. In that case we don't care about its temporary roots. */ @@ -287,7 +250,6 @@ static void readTempRoots(PathSet & tempRoots, FDs & fds) writeFull(*fd, (const unsigned char *) "d", 1); continue; } -#endif /* Acquire a read lock. This will prevent the owning process from upgrading to a write lock, therefore it will block in -- cgit 1.4.1