From nobody Mon Feb 9 01:50:52 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=126.com ARC-Seal: i=1; a=rsa-sha256; t=1767895478; cv=none; d=zohomail.com; s=zohoarc; b=gut+h7yR68vGMOSPhgN+fU2w6hOAKygoJHv65jfTshtiyS4ZvcywaqbIVfvHJ7DLm8xWH8iTkhothukauLy4a11QRv6/D5d4NriBibfZgRnlpiB83VN6XiFjbnk0LdETgq+909PbCXwwsvUzwXGoqKPjFB7ZUZEMcLhmHeEz4Uo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767895478; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=09tCkdU8nwORaDi7FEX5Ds2RD2ozXaRRISY7ZYG2FPM=; b=jCa5Wq3caWkPrusjP+dTmAzn2hbOgmPz0wiymERWGGvHzz+JsNyj4RQO0Dl+YOOE+eRGmeie9eaRqFeDcMmkT78ymnxoqjAr6IiGZnkWV1ezS+dlkEZzrZBG2nDH93Qoj/gHyRL0RxYHcl74hGHaqCzAdz1DDlmW2Nj5B5yuP6c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176789547876754.771973083922376; Thu, 8 Jan 2026 10:04:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vduMc-0005W4-MQ; Thu, 08 Jan 2026 13:04:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vduMS-00053G-DC for qemu-devel@nongnu.org; Thu, 08 Jan 2026 13:03:55 -0500 Received: from m16.mail.126.com ([117.135.210.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vduMN-0003ZV-De for qemu-devel@nongnu.org; Thu, 08 Jan 2026 13:03:52 -0500 Received: from SSS-WIN-GP76HX (unknown []) by gzga-smtp-mtada-g1-4 (Coremail) with SMTP id _____wDXv7dn8V9pt_Q6Bg--.22025S2; Fri, 09 Jan 2026 02:03:20 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=09 tCkdU8nwORaDi7FEX5Ds2RD2ozXaRRISY7ZYG2FPM=; b=TfZVNAXnmJs9k5/QHy JQqRaWbr36ahszJkTxdHkL04PSfCjhvdmrm4E89E3wFqvon4LMvsn4gdhH0L0j4x infaUtQHpaoNSIXTroaWl3uGhXfY63z9hUlG0/aRkIxZNwvtvwvscQSOU8Ac2TS0 adwJSSjAPDLXHyQWMXsb1xtnY= From: Tianlan Zhou To: qemu-devel@nongnu.org Cc: Tianlan Zhou , Stefan Weil Subject: [PATCH] win32: Add ftruncate function detection Date: Fri, 9 Jan 2026 02:03:15 +0800 Message-ID: <20260108180315.1587-1-bobby825@126.com> X-Mailer: git-send-email 2.52.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wDXv7dn8V9pt_Q6Bg--.22025S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7KF47tw17Xr48Wr15urW5trb_yoW8GrWfpF Z2yryYgF4UJ34rJrWxuF1xur4fXF4kGw17GFyUtr1kWr1xXF1Utrs8K3Wakw47XrsYyr4r uFyfJFZxurWjqr7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pE73kXUUUUU= X-Originating-IP: [2409:8a1e:6e71:2040:a1d7:92ec:eb8e:be55] X-CM-SenderInfo: xereu5qysvqiyswou0bp/xtbBqAnIG2lf8WlxEwAA3+ Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=117.135.210.9; envelope-from=bobby825@126.com; helo=m16.mail.126.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @126.com) X-ZM-MESSAGEID: 1767895481226158500 Content-Type: text/plain; charset="utf-8" Add detection for `ftruncate` function in Meson, so that it can be used when possible instead of fallback version `qemu_ftruncate64`. Signed-off-by: Tianlan Zhou Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3234 --- include/system/os-win32.h | 2 +- meson.build | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/system/os-win32.h b/include/system/os-win32.h index 22d72babdf..9832b7589a 100644 --- a/include/system/os-win32.h +++ b/include/system/os-win32.h @@ -140,7 +140,7 @@ static inline void os_setup_limits(void) =20 int qemu_ftruncate64(int, int64_t); =20 -#if !defined(ftruncate) +#ifndef CONFIG_FTRUNCATE # define ftruncate qemu_ftruncate64 #endif =20 diff --git a/meson.build b/meson.build index db87358d62..0b41952a0b 100644 --- a/meson.build +++ b/meson.build @@ -3253,6 +3253,17 @@ if host_os =3D=3D 'windows' config_host_data.set('CONFIG_CONVERT_STRING_TO_BSTR', has_convert_string= _to_bstr) endif =20 +# Detect if ftruncate exist +if host_os =3D=3D 'windows' + has_ftruncate =3D cxx.links(''' + #include + int main() { + return ftruncate(0, 0); + } + ''') + config_host_data.set('CONFIG_FTRUNCATE', has_ftruncate) +endif + ######################## # Target configuration # ######################## --=20 2.52.0