mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
add osx version of fallocate
This commit is contained in:
parent
939b4a0fe5
commit
45f757dc60
5 changed files with 159 additions and 24 deletions
|
|
@ -14,31 +14,12 @@
|
|||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "fs_fallocate.hpp"
|
||||
|
||||
namespace fs
|
||||
{
|
||||
int
|
||||
fallocate(const int fd,
|
||||
const int mode,
|
||||
const off_t offset,
|
||||
const off_t len)
|
||||
{
|
||||
int rv;
|
||||
|
||||
#ifdef __linux__
|
||||
rv = ::fallocate(fd,mode,offset,len);
|
||||
# include "fs_fallocate_linux.icpp"
|
||||
#elif _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L
|
||||
rv = (mode ?
|
||||
(errno=EOPNOTSUPP,-1) :
|
||||
(::posix_fallocate(fd,offset,len)));
|
||||
# include "fs_fallocate_posix.icpp"
|
||||
#elif __APPLE__
|
||||
# include "fs_fallocate_osx.icpp"
|
||||
#else
|
||||
rv = (errno=EOPNOTSUPP,-1);
|
||||
# include "fs_fallocate_unsupported.icpp"
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue