fix fallocate build with OSes that actually support it

This commit is contained in:
Arvid Norberg 2010-01-18 01:08:19 +00:00
parent 55aea5b863
commit 5d5ded4032
1 changed files with 2 additions and 2 deletions

View File

@ -80,7 +80,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <asm/unistd_64.h> // For __NR_fallocate #include <asm/unistd_64.h> // For __NR_fallocate
// circumvent the lack of support in glibc // circumvent the lack of support in glibc
static int 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)
{ {
return syscall(__NR_fallocate, fd, mode, offset, len); return syscall(__NR_fallocate, fd, mode, offset, len);
} }
@ -1449,7 +1449,7 @@ namespace libtorrent
return false; return false;
} }
#elif defined TORRENT_LINUX #elif defined TORRENT_LINUX
int ret = fallocate(m_fd, FALLOC_FL_KEEP_SIZE, 0, s); int ret = my_fallocate(m_fd, FALLOC_FL_KEEP_SIZE, 0, s);
if (ret != 0 && ret != EOPNOTSUPP && errno != ENOSYS) if (ret != 0 && ret != EOPNOTSUPP && errno != ENOSYS)
{ {
ec.assign(ret, get_posix_category()); ec.assign(ret, get_posix_category());