diff --git a/src/native/libs/Common/pal_config.h.in b/src/native/libs/Common/pal_config.h.in index 7b592d10326f69..a5ce0ce2a46d4b 100644 --- a/src/native/libs/Common/pal_config.h.in +++ b/src/native/libs/Common/pal_config.h.in @@ -43,6 +43,7 @@ #cmakedefine01 PRIORITY_REQUIRES_INT_WHO #cmakedefine01 KEVENT_REQUIRES_INT_PARAMS #cmakedefine01 HAVE_IOCTL +#cmakedefine01 HAVE_IOCTL_WITH_INT_REQUEST #cmakedefine01 HAVE_TIOCGWINSZ #cmakedefine01 HAVE_TIOCSWINSZ #cmakedefine01 HAVE_SCHED_GETAFFINITY diff --git a/src/native/libs/System.Native/pal_io.c b/src/native/libs/System.Native/pal_io.c index 22fcf3a4f76917..7551b426d0b844 100644 --- a/src/native/libs/System.Native/pal_io.c +++ b/src/native/libs/System.Native/pal_io.c @@ -1325,7 +1325,11 @@ int32_t SystemNative_CopyFile(intptr_t sourceFd, intptr_t destinationFd, int64_t // Try copying data using a copy-on-write clone. This shares storage between the files. if (sourceLength != 0) { +#if HAVE_IOCTL_WITH_INT_REQUEST while ((ret = ioctl(outFd, (int)FICLONE, inFd)) < 0 && errno == EINTR); +#else + while ((ret = ioctl(outFd, FICLONE, inFd)) < 0 && errno == EINTR); +#endif copied = ret == 0; } #endif diff --git a/src/native/libs/configure.cmake b/src/native/libs/configure.cmake index 0b86bd6df64ed7..cbaac692f26301 100644 --- a/src/native/libs/configure.cmake +++ b/src/native/libs/configure.cmake @@ -790,6 +790,13 @@ check_prototype_definition( ${STATFS_INCLUDES} HAVE_NON_LEGACY_STATFS) +check_prototype_definition( + ioctl + "int ioctl(int fd, int request, ...)" + 0 + "sys/ioctl.h" + HAVE_IOCTL_WITH_INT_REQUEST) + check_c_source_compiles( " #include