From e525e2c251dc5e99cef57f3d8776acdd43f73952 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 20 Feb 2013 12:59:11 +0100 Subject: [PATCH] Drop posix_fadvise(3) completely before unpacking. Some systems with small memory might fail to make the preallocation, as seen in the rpi. It doesn't give us too much gain anyway. --- configure | 18 ------------------ lib/package_unpack.c | 8 -------- 2 files changed, 26 deletions(-) diff --git a/configure b/configure index f5e2611b..a50301af 100755 --- a/configure +++ b/configure @@ -344,24 +344,6 @@ else fi rm -f _$func.c _$func -# Check for posix_fadvise(2) -func=posix_fadvise -printf "Checking for $func() ... " -cat <_$func.c -#include -int main(void) { - posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL); - return 0; -} -EOF -if $XCC _$func.c -o _$func 2>/dev/null; then - echo "yes." - echo "CPPFLAGS += -DHAVE_POSIX_FADVISE" >>$CONFIG_MK -else - echo "no." -fi -rm -f _$func _$func.c - # # Check for strcasestr(). # diff --git a/lib/package_unpack.c b/lib/package_unpack.c index 37089516..28db843d 100644 --- a/lib/package_unpack.c +++ b/lib/package_unpack.c @@ -586,7 +586,6 @@ int HIDDEN xbps_unpack_binary_pkg(struct xbps_handle *xhp, prop_dictionary_t pkg_repod) { struct archive *ar = NULL; - struct stat pkg_stat; const char *pkgname, *version, *pkgver; char *bpkg; int pkg_fd, rv = 0; @@ -634,10 +633,6 @@ xbps_unpack_binary_pkg(struct xbps_handle *xhp, prop_dictionary_t pkg_repod) archive_read_open_fd(ar, pkg_fd, ARCHIVE_READ_BLOCKSIZE); free(bpkg); -#ifdef HAVE_POSIX_FADVISE - fstat(pkg_fd, &pkg_stat); - posix_fadvise(pkg_fd, 0, pkg_stat.st_size, POSIX_FADV_SEQUENTIAL); -#endif /* * Extract archive files. */ @@ -648,9 +643,6 @@ xbps_unpack_binary_pkg(struct xbps_handle *xhp, prop_dictionary_t pkg_repod) pkgver, strerror(rv)); goto out; } -#ifdef HAVE_POSIX_FADVISE - posix_fadvise(pkg_fd, 0, pkg_stat.st_size, POSIX_FADV_DONTNEED); -#endif /* * Set package state to unpacked. */