From 3f065483d06e48db82a13d7ed0df333841ea31c9 Mon Sep 17 00:00:00 2001 From: Konstantin Khlebnikov Date: Sat, 18 Jan 2025 14:53:40 +0100 Subject: [PATCH] Fix musl build --- .github/workflows/ci.yaml | 11 +++++++++++ ioping.c | 17 +++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d1f5e9f..e7ae37d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,6 +29,9 @@ jobs: - os: ubuntu-latest image: debian:12 + - os: ubuntu-latest + image: alpine:3 + - os: ubuntu-24.04-arm # - os: ubuntu-24.04-arm @@ -46,6 +49,9 @@ jobs: - os: ubuntu-24.04-arm image: fedora:42 + # - os: ubuntu-24.04-arm + # image: alpine:3 + - os: macos-13 - os: macos-14 - os: macos-15 @@ -63,6 +69,11 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 + - name: Dependencies (alpine) + if: ${{ startsWith(matrix.build.image, 'alpine') }} + run: | + apk --no-cache add make gcc musl-dev linux-headers + - name: Dependencies (ubuntu, debian) if: ${{ startsWith(matrix.build.image, 'ubuntu') || startsWith(matrix.build.image, 'debian') }} run: | diff --git a/ioping.c b/ioping.c index 229456d..c6edd5f 100644 --- a/ioping.c +++ b/ioping.c @@ -59,6 +59,7 @@ # include # define HAVE_CLOCK_GETTIME # define HAVE_POSIX_FADVICE +# define HAVE_POSIX_FDATASYNC # define HAVE_POSIX_MEMALIGN # define HAVE_MKOSTEMP # define HAVE_DIRECT_IO @@ -74,9 +75,11 @@ # define aio_rw_flags aio_reserved1 # endif -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 32) -# define HAVE_ERR_NAME -#endif +# ifdef __GLIBC_PREREQ +# if __GLIBC_PREREQ(2, 32) +# define HAVE_ERR_NAME +# endif +# endif # undef RWF_NOWAIT # include @@ -174,8 +177,10 @@ # define HAVE_MKOSTEMP /* not required */ #endif -#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 -# define HAVE_POSIX_FDATASYNC +#ifndef HAVE_POSIX_FDATASYNC +# if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 +# define HAVE_POSIX_FDATASYNC +# endif #endif #ifdef O_SYNC @@ -1011,7 +1016,7 @@ int get_device_size(int fd, struct stat *st) #if defined(BLKGETSIZE64) /* linux */ - ret = ioctl(fd, BLKGETSIZE64, &blksize); + ret = ioctl(fd, (unsigned int)BLKGETSIZE64, &blksize); #elif defined(DIOCGMEDIASIZE) /* freebsd */ ret = ioctl(fd, DIOCGMEDIASIZE, &blksize);