- Enhanced split algorithm to be non-destrutive, and therefore faster

- Added autoconf testing to detect Solaris
- Added Solaris-specific flock implementation
This commit is contained in:
Paul Beckingham 2008-12-14 15:18:33 -05:00
parent 50ccb67185
commit 3d4beaf41f
5 changed files with 73 additions and 28 deletions

View file

@ -331,3 +331,37 @@ std::string expandPath (const std::string& in)
}
////////////////////////////////////////////////////////////////////////////////
// On Solaris no flock function exists.
#ifdef SOLARIS
int flock (int fd, int operation)
{
struct flock flock;
switch (operation & ~LOCK_NB)
{
case LOCK_SH:
flock.l_type = F_RDLCK;
break;
case LOCK_EX:
flock.l_type = F_WRLCK;
break;
case LOCK_UN:
flock.l_type = F_UNLCK;
break;
default:
errno = EINVAL;
return -1;
}
flock.l_whence = 0;
flock.l_start = 0;
flock.l_len = 0;
return fcntl (fd, (operation & LOCK_NB) ? F_SETLK : F_SETLKW, &flock);
}
#endif
////////////////////////////////////////////////////////////////////////////////