mirror of https://github.com/trapexit/mergerfs.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
788 B
58 lines
788 B
#pragma once
|
|
|
|
#include <fcntl.h>
|
|
|
|
namespace fs
|
|
{
|
|
static
|
|
inline
|
|
int
|
|
fcntl(const int fd_,
|
|
const int op_)
|
|
{
|
|
int rv;
|
|
|
|
rv = ::fcntl(fd_,op_);
|
|
|
|
return ((rv == -1) ? -errno : rv);
|
|
}
|
|
|
|
static
|
|
inline
|
|
int
|
|
fcntl(const int fd_,
|
|
const int op_,
|
|
const int arg_)
|
|
{
|
|
int rv;
|
|
|
|
rv = ::fcntl(fd_,op_,arg_);
|
|
|
|
return ((rv == -1) ? -errno : rv);
|
|
}
|
|
|
|
static
|
|
inline
|
|
int
|
|
fcntl_setlease_rdlck(const int fd_)
|
|
{
|
|
#if defined(F_SETLEASE) && defined(F_RDLCK)
|
|
return fs::fcntl(fd_,F_SETLEASE,F_RDLCK);
|
|
#else
|
|
return -ENOTSUP;
|
|
#endif
|
|
}
|
|
|
|
static
|
|
inline
|
|
int
|
|
fcntl_setlease_unlck(const int fd_)
|
|
{
|
|
#if defined(F_SETLEASE) && defined(F_UNLCK)
|
|
return fs::fcntl(fd_,F_SETLEASE,F_UNLCK);
|
|
#else
|
|
return -ENOTSUP;
|
|
#endif
|
|
|
|
}
|
|
}
|