diff --git a/cmdline/stream.c b/cmdline/stream.c index c5ced0c7..81834043 100644 --- a/cmdline/stream.c +++ b/cmdline/stream.c @@ -47,11 +47,16 @@ STREAM* sopen_read(const char* file) #if HAVE_POSIX_FADVISE /* advise sequential access */ ret = posix_fadvise(s->handle[0].f, 0, 0, POSIX_FADV_SEQUENTIAL); + if (ret == ENOSYS) { + /* call is not supported, like in armhf, see posix_fadvise manpage */ + ret = 0; + } if (ret != 0) { /* LCOV_EXCL_START */ close(s->handle[0].f); free(s->handle); free(s); + errno = ret; /* posix_fadvise return the error code */ return 0; /* LCOV_EXCL_STOP */ } @@ -116,9 +121,14 @@ int sopen_multi_file(STREAM* s, unsigned i, const char* file) #if HAVE_POSIX_FADVISE /* advise sequential access */ ret = posix_fadvise(f, 0, 0, POSIX_FADV_SEQUENTIAL); + if (ret == ENOSYS) { + /* call is not supported, like in armhf, see posix_fadvise manpage */ + ret = 0; + } if (ret != 0) { /* LCOV_EXCL_START */ close(f); + errno = ret; /* posix_fadvise return the error code */ return -1; /* LCOV_EXCL_STOP */ } diff --git a/cmdline/support.c b/cmdline/support.c index b82b4391..8d4c7f56 100644 --- a/cmdline/support.c +++ b/cmdline/support.c @@ -940,6 +940,10 @@ int advise_open(struct advise_struct* advise, int f) /* advise sequential access */ ret = posix_fadvise(f, 0, 0, POSIX_FADV_SEQUENTIAL); + if (ret == ENOSYS) { + /* call is not supported, like in armhf, see posix_fadvise manpage */ + ret = 0; + } if (ret != 0) { /* LCOV_EXCL_START */ errno = ret; /* posix_fadvise return the error code */ @@ -1116,6 +1120,10 @@ 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; + } if (ret != 0) { /* LCOV_EXCL_START */ errno = ret; /* posix_fadvise return the error code */ @@ -1143,6 +1151,10 @@ 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; + } if (ret != 0) { /* LCOV_EXCL_START */ errno = ret; /* posix_fadvise return the error code */