mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 10:07:19 +02:00
- 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:
parent
50ccb67185
commit
3d4beaf41f
5 changed files with 73 additions and 28 deletions
34
src/util.cpp
34
src/util.cpp
|
@ -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
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue