Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed detecting and using the fallocate() function.
  • Loading branch information
gonosztopi committed Aug 2, 2009
1 parent a56f996 commit b7c8b46
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/Changelog
Expand Up @@ -52,6 +52,9 @@ Version 2.3.0 - The river knows.
morph:
* Patch to uniform and fix minor errors on man pages

mr_hyde:
* Fixed a bug in detecting and using the fallocate() function.

myth:
* Feedback from shared files - add number of clients on queue.

Expand Down
9 changes: 8 additions & 1 deletion m4/fallocate.m4
Expand Up @@ -25,8 +25,14 @@
AC_DEFUN([MULE_CHECK_FALLOCATE],
[
AC_MSG_CHECKING([for fallocate])
MULE_BACKUP([CPPFLAGS])
MULE_APPEND([CPPFLAGS], [$WX_CPPFLAGS])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#include <linux/falloc.h>
]], [[
fallocate(0, 0, 0, 0);
Expand All @@ -38,12 +44,13 @@ AC_DEFUN([MULE_CHECK_FALLOCATE],
], [
AC_MSG_RESULT([no])
])
MULE_RESTORE([CPPFLAGS])
AC_MSG_CHECKING([for SYS_fallocate])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <sys/sycall.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
]], [[
Expand Down
7 changes: 7 additions & 0 deletions src/ThreadTasks.cpp
Expand Up @@ -37,6 +37,9 @@
#include "ScopedPtr.h" // Needed for CScopedPtr and CScopedArray
#include "PlatformSpecific.h" // Needed for CanFSHandleSpecialChars

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

//! This hash represents the value for an empty MD4 hashing
const byte g_emptyMD4Hash[16] = {
Expand Down Expand Up @@ -485,6 +488,10 @@ void CCompletionTask::OnExit()
// CAllocateFileTask

#ifdef HAVE_FALLOCATE
# define _GNU_SOURCE
# ifdef HAVE_FCNTL_H
# include <fcntl.h>
# endif
# include <linux/falloc.h>
#elif defined HAVE_SYS_FALLOCATE
# include <sys/syscall.h>
Expand Down

0 comments on commit b7c8b46

Please sign in to comment.