]> git.pld-linux.org Git - packages/transmission.git/blob - transmission-preallocate_syscall.patch
- only SYS_fallocate
[packages/transmission.git] / transmission-preallocate_syscall.patch
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  
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
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>
22  #endif
23  
24 +#ifdef HAVE_SYS_FALLOCATE
25 + #include <linux/falloc.h>
26 + #include <sys/syscall.h>
27 +#endif
28 +
29  #ifdef HAVE_XFS_XFS_H
30   #include <xfs/xfs.h>
31  #endif
32 @@ -176,6 +181,12 @@
33              success = !fcntl( fd, F_PREALLOCATE, &fst );
34          }
35  # endif
36 +# ifdef HAVE_SYS_FALLOCATE
37 +        if( !success )
38 +        {
39 +            success = !syscall( SYS_fallocate, fd, FALLOC_FL_KEEP_SIZE, 0, (loff_t)length );
40 +        }
41 +# endif
42  # ifdef HAVE_POSIX_FALLOCATE
43          if( !success )
44          {
This page took 0.067941 seconds and 3 git commands to generate.