Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sync_file_range() with musl 1.2.4 #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ AC_CHECK_HEADERS_ONCE(pthread.h)
AC_CHECK_SIZEOF(mode_t)
AC_CHECK_SIZEOF(int)

AC_CHECK_TYPES([off64_t])

AC_CHECK_TYPE(pthread_barrier_t,,,[
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
Expand Down
11 changes: 9 additions & 2 deletions libeatmydata/libeatmydata.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
#define CHECK_FILE "/tmp/eatmydata"
*/

#ifdef HAVE_OFF64_T
typedef off64_t sync_file_range_off;
#else
typedef off_t sync_file_range_off;
#endif

typedef int (*libc_open_t)(const char*, int, ...);
#ifdef HAVE_OPEN64
typedef int (*libc_open64_t)(const char*, int, ...);
Expand All @@ -44,7 +50,7 @@ typedef int (*libc_sync_t)(void);
typedef int (*libc_fdatasync_t)(int);
typedef int (*libc_msync_t)(void*, size_t, int);
#ifdef HAVE_SYNC_FILE_RANGE
typedef int (*libc_sync_file_range_t)(int, off64_t, off64_t, unsigned int);
typedef int (*libc_sync_file_range_t)(int, sync_file_range_off, sync_file_range_off, unsigned int);
#endif
#ifdef HAVE_SYNCFS
typedef int (*libc_syncfs_t)(int);
Expand Down Expand Up @@ -259,7 +265,8 @@ int LIBEATMYDATA_API msync(void *addr, size_t length, int flags)
}

#ifdef HAVE_SYNC_FILE_RANGE
int LIBEATMYDATA_API sync_file_range(int fd, off64_t offset, off64_t nbytes,
int LIBEATMYDATA_API sync_file_range(int fd, sync_file_range_off offset,
sync_file_range_off nbytes,
unsigned int flags)
{
if (eatmydata_is_hungry()) {
Expand Down