From d65450dda889dd0c38322feac5e204f537a9badf Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 29 Oct 2016 08:08:52 +0200 Subject: [PATCH] Don't allow ENOSYS for fadvise(DONT_NEED) We want to know if it's failing. In case, a different advise method has to be used. --- cmdline/support.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cmdline/support.c b/cmdline/support.c index 8d4c7f56..316dd981 100644 --- a/cmdline/support.c +++ b/cmdline/support.c @@ -1120,10 +1120,7 @@ int advise_write(struct advise_struct* advise, int f, data_off_t offset, data_of /* flush the data from the cache */ ret = posix_fadvise(f, discard_offset, discard_size, POSIX_FADV_DONTNEED); - if (ret == ENOSYS) { - /* call is not supported, like in armhf, see posix_fadvise manpage */ - ret = 0; - } + /* for POSIX_FADV_DONTNEED we don't allow failure with ENOSYS */ if (ret != 0) { /* LCOV_EXCL_START */ errno = ret; /* posix_fadvise return the error code */ @@ -1151,10 +1148,7 @@ int advise_read(struct advise_struct* advise, int f, data_off_t offset, data_off /* flush the data from the cache */ ret = posix_fadvise(f, offset, size, POSIX_FADV_DONTNEED); - if (ret == ENOSYS) { - /* call is not supported, like in armhf, see posix_fadvise manpage */ - ret = 0; - } + /* for POSIX_FADV_DONTNEED we don't allow failure with ENOSYS */ if (ret != 0) { /* LCOV_EXCL_START */ errno = ret; /* posix_fadvise return the error code */