]> git.pld-linux.org Git - packages/transmission.git/blame - transmission-preallocate_syscall.patch
- only SYS_fallocate
[packages/transmission.git] / transmission-preallocate_syscall.patch
CommitLineData
60a7808a
KK
1--- transmission-1.72/configure.ac.orig 2009-06-17 02:01:56.000000000 +0200
2+++ transmission-1.72/configure.ac 2009-06-18 18:25:44.000000000 +0200
3@@ -81,6 +81,14 @@
4 AC_HEADER_STDC
5 AC_HEADER_TIME
6
925715cb
KK
7+AC_MSG_CHECKING([for SYS_fallocate])
8+AC_TRY_LINK([#include <sys/syscall.h>
9+#include <sys/types.h>],
10+ [return syscall(SYS_fallocate, 0, 0, (loff_t) 0, (loff_t) 0);],
11+ [AC_DEFINE([HAVE_SYS_FALLOCATE],[1],[Defined if you have the SYS_fallocate syscall number])
12+ AC_MSG_RESULT([yes])],
13+ [AC_MSG_RESULT([no])])
14+
15 AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename daemon strcasecmp localtime_r posix_fallocate memmem])
16 AC_PROG_INSTALL
17 AC_PROG_MAKE_SET
60a7808a
KK
18--- transmission-1.72/libtransmission/fdlimit.c.orig 2009-06-17 02:01:44.000000000 +0200
19+++ transmission-1.72/libtransmission/fdlimit.c 2009-06-18 18:24:45.000000000 +0200
20@@ -43,6 +43,11 @@
21 #include <fcntl.h>
925715cb
KK
22 #endif
23
60a7808a
KK
24+#ifdef HAVE_SYS_FALLOCATE
25+ #include <linux/falloc.h>
925715cb
KK
26+ #include <sys/syscall.h>
27+#endif
28+
29 #ifdef HAVE_XFS_XFS_H
30 #include <xfs/xfs.h>
31 #endif
3e5a65aa 32@@ -176,6 +181,12 @@
60a7808a 33 success = !fcntl( fd, F_PREALLOCATE, &fst );
925715cb 34 }
60a7808a
KK
35 # endif
36+# ifdef HAVE_SYS_FALLOCATE
925715cb
KK
37+ if( !success )
38+ {
60a7808a 39+ success = !syscall( SYS_fallocate, fd, FALLOC_FL_KEEP_SIZE, 0, (loff_t)length );
925715cb 40+ }
60a7808a 41+# endif
925715cb
KK
42 # ifdef HAVE_POSIX_FALLOCATE
43 if( !success )
44 {
This page took 0.062627 seconds and 4 git commands to generate.