diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62617b76ad5..681e950f58b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,12 @@ jobs: uses: dprint/check@v2.2 cargo: - runs-on: ubuntu-latest + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v3 diff --git a/src/exercises/day-3/safe-ffi-wrapper.rs b/src/exercises/day-3/safe-ffi-wrapper.rs index 6746feab730..5f100af5b94 100644 --- a/src/exercises/day-3/safe-ffi-wrapper.rs +++ b/src/exercises/day-3/safe-ffi-wrapper.rs @@ -37,7 +37,7 @@ mod ffi { } // Layout as per man entry for dirent - #[cfg(target_os = "macos")] + #[cfg(all(target_os = "macos", target_arch = "aarch64"))] #[repr(C)] pub struct dirent { pub d_ino: u64, @@ -48,6 +48,17 @@ mod ffi { pub d_name: [c_char; 1024], } + // Layout according to + #[cfg(all(target_os = "macos", target_arch = "x86_64"))] + #[repr(C)] + pub struct dirent { + pub d_fileno: u32, + pub d_reclen: u16, + pub d_type: u8, + pub d_namlen: u8, + pub d_name: [c_char; 256], + } + extern "C" { pub fn opendir(s: *const c_char) -> *mut DIR; pub fn readdir(s: *mut DIR) -> *const dirent;