ntdll: Use posix_fallocate() instead of fallocate().

Signed-off-by: Chip Davis <cdavis@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Charles Davis 2021-09-14 16:57:41 -05:00 committed by Alexandre Julliard
parent a45bb014e8
commit dd882794d2
4 changed files with 11 additions and 51 deletions

35
configure vendored
View File

@ -18008,6 +18008,7 @@ for ac_func in \
poll \
port_create \
posix_fadvise \
posix_fallocate \
prctl \
proc_pidinfo \
readlink \
@ -18600,40 +18601,6 @@ $as_echo "#define HAVE_SCHED_SETAFFINITY 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fallocate" >&5
$as_echo_n "checking for fallocate... " >&6; }
if ${wine_cv_have_fallocate+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _GNU_SOURCE
#include <fcntl.h>
int
main ()
{
fallocate(-1, 0, 0, 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
wine_cv_have_fallocate=yes
else
wine_cv_have_fallocate=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wine_cv_have_fallocate" >&5
$as_echo "$wine_cv_have_fallocate" >&6; }
if test "$wine_cv_have_fallocate" = "yes"
then
$as_echo "#define HAVE_FALLOCATE 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
$as_echo_n "checking for inline... " >&6; }

View File

@ -2182,6 +2182,7 @@ AC_CHECK_FUNCS(\
poll \
port_create \
posix_fadvise \
posix_fallocate \
prctl \
proc_pidinfo \
readlink \
@ -2273,15 +2274,6 @@ then
AC_DEFINE(HAVE_SCHED_SETAFFINITY, 1, [Define to 1 if you have the `sched_setaffinity' function.])
fi
AC_CACHE_CHECK([for fallocate],wine_cv_have_fallocate,
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[#define _GNU_SOURCE
#include <fcntl.h>]], [[fallocate(-1, 0, 0, 0);]])],[wine_cv_have_fallocate=yes],[wine_cv_have_fallocate=no]))
if test "$wine_cv_have_fallocate" = "yes"
then
AC_DEFINE(HAVE_FALLOCATE, 1, [Define to 1 if you have the `fallocate' function.])
fi
dnl **** Check for types ****
AC_C_INLINE

View File

@ -4494,14 +4494,15 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
status = STATUS_INVALID_PARAMETER;
else
{
#ifdef HAVE_FALLOCATE
if (fallocate( fd, 0, 0, (off_t)info->ValidDataLength.QuadPart ) == -1)
#ifdef HAVE_POSIX_FALLOCATE
int err;
if ((err = posix_fallocate( fd, 0, (off_t)info->ValidDataLength.QuadPart )) != 0)
{
if (errno == EOPNOTSUPP) WARN( "fallocate not supported on this filesystem\n" );
else status = errno_to_status( errno );
if (err == EOPNOTSUPP) WARN( "posix_fallocate not supported on this filesystem\n" );
else status = errno_to_status( err );
}
#else
FIXME( "setting valid data length not supported\n" );
WARN( "setting valid data length not supported\n" );
#endif
}
if (needs_close) close( fd );

View File

@ -83,9 +83,6 @@
/* Define to 1 if you have the `F3DAudioInitialize8' function. */
#undef HAVE_F3DAUDIOINITIALIZE8
/* Define to 1 if you have the `fallocate' function. */
#undef HAVE_FALLOCATE
/* Define to 1 if you have the `FAudioCreateReverb9WithCustomAllocatorEXT'
function. */
#undef HAVE_FAUDIOCREATEREVERB9WITHCUSTOMALLOCATOREXT
@ -507,6 +504,9 @@
/* Define to 1 if you have the `posix_fadvise' function. */
#undef HAVE_POSIX_FADVISE
/* Define to 1 if you have the `posix_fallocate' function. */
#undef HAVE_POSIX_FALLOCATE
/* Define to 1 if you have the `prctl' function. */
#undef HAVE_PRCTL