Use F_GETLK for fcntl when F_OFD_GETLK not defined. Signed-off-by: Jun Piao <piao...@huawei.com> --- contrib/virtiofsd/passthrough_ll.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c index 9ae1381..757785b 100644 --- a/contrib/virtiofsd/passthrough_ll.c +++ b/contrib/virtiofsd/passthrough_ll.c @@ -1619,7 +1619,11 @@ static void lo_getlk(fuse_req_t req, fuse_ino_t ino, return; } +#ifdef F_OFD_GETLK ret = fcntl(plock->fd, F_OFD_GETLK, lock); +#else + ret = fcntl(plock->fd, F_GETLK, lock); +#endif if (ret == -1) saverr = errno; pthread_mutex_unlock(&inode->plock_mutex); @@ -1668,7 +1672,12 @@ static void lo_setlk(fuse_req_t req, fuse_ino_t ino, /* TODO: Is it alright to modify flock? */ lock->l_pid = 0; + +#ifdef F_OFD_GETLK ret = fcntl(plock->fd, F_OFD_SETLK, lock); +#else + ret = fcntl(plock->fd, F_SETLK, lock); +#endif if (ret == -1) { saverr = errno; } --