Skip to content

Commit 4e0ff82

Browse files
authored
Add cmake check for ioclt prototype (#82173)
* Add cmake check for ioclt prototype * .
1 parent 82c8918 commit 4e0ff82

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/native/libs/Common/pal_config.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#cmakedefine01 PRIORITY_REQUIRES_INT_WHO
4444
#cmakedefine01 KEVENT_REQUIRES_INT_PARAMS
4545
#cmakedefine01 HAVE_IOCTL
46+
#cmakedefine01 HAVE_IOCTL_WITH_INT_REQUEST
4647
#cmakedefine01 HAVE_TIOCGWINSZ
4748
#cmakedefine01 HAVE_TIOCSWINSZ
4849
#cmakedefine01 HAVE_SCHED_GETAFFINITY

src/native/libs/System.Native/pal_io.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,11 @@ int32_t SystemNative_CopyFile(intptr_t sourceFd, intptr_t destinationFd, int64_t
13251325
// Try copying data using a copy-on-write clone. This shares storage between the files.
13261326
if (sourceLength != 0)
13271327
{
1328+
#if HAVE_IOCTL_WITH_INT_REQUEST
13281329
while ((ret = ioctl(outFd, (int)FICLONE, inFd)) < 0 && errno == EINTR);
1330+
#else
1331+
while ((ret = ioctl(outFd, FICLONE, inFd)) < 0 && errno == EINTR);
1332+
#endif
13291333
copied = ret == 0;
13301334
}
13311335
#endif

src/native/libs/configure.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,13 @@ check_prototype_definition(
790790
${STATFS_INCLUDES}
791791
HAVE_NON_LEGACY_STATFS)
792792

793+
check_prototype_definition(
794+
ioctl
795+
"int ioctl(int fd, int request, ...)"
796+
0
797+
"sys/ioctl.h"
798+
HAVE_IOCTL_WITH_INT_REQUEST)
799+
793800
check_c_source_compiles(
794801
"
795802
#include <stdlib.h>

0 commit comments

Comments
 (0)