From ecc11611d3c8c4e36b67cb9adc2f4a3f1e18ab78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E8=8B=8F=E6=B3=A2=20=28Super=20Zheng=29?= Date: Mon, 20 May 2024 20:17:06 +0800 Subject: [PATCH] darwin: fix crash on iOS(arm64) Disable sendfile() on iOS with arm64 architecture to avoid crashes caused by throwing SIGSYS signal. Fixes: #3187 --- src/unix/fs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/unix/fs.c b/src/unix/fs.c index a2c8d763..aad55fed 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -1070,7 +1070,10 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) { return -1; } -#elif defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) +/* sendfile() on iOS(arm64) will throw SIGSYS signal cause crash. */ +#elif (defined(__APPLE__) && !TARGET_OS_IPHONE) \ + || defined(__DragonFly__) \ + || defined(__FreeBSD__) { off_t len; ssize_t r;