1 #include "FileLock.h" 2 3 #include <bits/lockf.h> 4 FileLock(int fd)5 FileLock::FileLock(int fd) : fd_(fd) {} 6 lock()7 int FileLock::lock() { 8 return lockf(fd_, F_LOCK, 0); 9 } 10 unlock()11 int FileLock::unlock() { 12 return lockf(fd_, F_ULOCK, 0); 13 } 14