fixed fallocate usage on linux distros that don't have it
This commit is contained in:
@@ -76,12 +76,16 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <linux/fiemap.h>
|
#include <linux/fiemap.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <asm/unistd_64.h> // For __NR_fallocate
|
#include <asm/unistd.h> // For __NR_fallocate
|
||||||
|
|
||||||
// circumvent the lack of support in glibc
|
// circumvent the lack of support in glibc
|
||||||
static int my_fallocate(int fd, int mode, loff_t offset, loff_t len)
|
static int my_fallocate(int fd, int mode, loff_t offset, loff_t len)
|
||||||
{
|
{
|
||||||
|
#ifdef __NR_fallocate
|
||||||
return syscall(__NR_fallocate, fd, mode, offset, len);
|
return syscall(__NR_fallocate, fd, mode, offset, len);
|
||||||
|
#else
|
||||||
|
return EOPNOTSUPP;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined __APPLE__ && defined __MACH__
|
#elif defined __APPLE__ && defined __MACH__
|
||||||
|
Reference in New Issue
Block a user