* Added support for Linux's fallocate and Darwin's fcntl(...,F_PREALLOCATE,...) to preallocate files by default. The 'system.file_allocate' setting will now only be used to indicate you want posix_fallocate called, which may block while it zeros out the file manually.

* Added 'event.download.hash_failed' and 'event.download.hash_final_failed'.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1130 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2010-02-14 01:20:20 +00:00
parent 8954393e52
commit 31abf85846
4 changed files with 88 additions and 8 deletions
+78 -2
View File
@@ -61,7 +61,6 @@ AC_DEFUN([TORRENT_CHECK_EPOLL], [
])
])
AC_DEFUN([TORRENT_WITHOUT_EPOLL], [
AC_ARG_WITH(epoll,
[ --without-epoll Do not check for epoll support.],
@@ -75,12 +74,70 @@ AC_DEFUN([TORRENT_WITHOUT_EPOLL], [
])
AC_DEFUN([TORRENT_CHECK_KQUEUE], [
AC_MSG_CHECKING(for kqueue support)
AC_LINK_IFELSE(
[[#include <sys/time.h> /* Because OpenBSD's sys/event.h fails to compile otherwise. Yeah... */
#include <sys/event.h>
int main() {
int fd = kqueue();
return 0;
}
]],
[
AC_DEFINE(USE_KQUEUE, 1, Use kqueue.)
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
])
])
AC_DEFUN([TORRENT_CHECK_KQUEUE_SOCKET_ONLY], [
AC_MSG_CHECKING(whether kqueue supports pipes and ptys)
AC_RUN_IFELSE(
[[#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/event.h>
#include <sys/time.h>
int main() {
struct kevent ev[2], ev_out[2];
struct timespec ts = { 0, 0 };
int pfd[2], pty[2], kfd, n;
char buffer[9001];
if (pipe(pfd) == -1) return 1;
if (fcntl(pfd[1], F_SETFL, O_NONBLOCK) == -1) return 2;
while ((n = write(pfd[1], buffer, sizeof(buffer))) == sizeof(buffer));
if ((pty[0]=posix_openpt(O_RDWR | O_NOCTTY)) == -1) return 3;
if ((pty[1]=grantpt(pty[0])) == -1) return 4;
EV_SET(ev+0, pfd[1], EVFILT_WRITE, EV_ADD | EV_ENABLE, 0, 0, NULL);
EV_SET(ev+1, pty[1], EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, NULL);
if ((kfd = kqueue()) == -1) return 5;
if ((n = kevent(kfd, ev, 2, NULL, 0, NULL)) == -1) return 6;
if (ev_out[0].flags & EV_ERROR) return 7;
if (ev_out[1].flags & EV_ERROR) return 8;
read(pfd[0], buffer, sizeof(buffer));
if ((n = kevent(kfd, NULL, 0, ev_out, 2, &ts)) < 1) return 9;
return 0;
}
]],
[
AC_MSG_RESULT(yes)
], [
AC_DEFINE(KQUEUE_SOCKET_ONLY, 1, kqueue only supports sockets.)
AC_MSG_RESULT(no)
])
])
AC_DEFUN([TORRENT_WITH_KQUEUE], [
AC_ARG_WITH(kqueue,
[ --with-kqueue enable kqueue. [[default=no]]],
[
if test "$withval" = "yes"; then
AC_DEFINE(USE_KQUEUE, 1, Enable kqueue.)
TORRENT_CHECK_KQUEUE
TORRENT_CHECK_KQUEUE_SOCKET_ONLY
fi
])
])
@@ -100,6 +157,25 @@ AC_DEFUN([TORRENT_WITHOUT_VARIABLE_FDSET], [
])
AC_DEFUN([TORRENT_CHECK_FALLOCATE], [
AC_MSG_CHECKING(for fallocate)
AC_COMPILE_IFELSE(
[[#include <fcntl.h>
int main() {
fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 0);
return 0;
}
]],
[
AC_DEFINE(HAVE_FALLOCATE, 1, Linux's fallocate supported.)
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
])
])
AC_DEFUN([TORRENT_CHECK_POSIX_FALLOCATE], [
AC_MSG_CHECKING(for posix_fallocate)