From nobody Mon Feb 9 19:40:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1650890851; cv=none; d=zohomail.com; s=zohoarc; b=gS6Fy34z8AkGvIqLfjbzpicp2XXn/vkybVfrrv9ZnlInYE/32fbPxVHrsVjQqWvAor38l7Dr5WsDKLahpQbPM51i/ZTLrhs83LN5Mo2nWjYk+lGsWEXJOAwfIRTeoi6/zIaw/N/03ekNDanMAIZkVAjQnAFPWv8dS0esXabA1xw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650890851; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=eiUhLnvniCRFRmHg94IspHR8zuzxCuN7kmOFel0V+B0=; b=I2lwxnOcVOqiAN4PWrGJJpgu5HWacsSClV3QR8ti4ppmVZSZOFNFJQxB6UXakFIRNAx7GiSw4Xtjps2fwBq34R7t0475qd8jym26iuyCuNRjgtzUAKvV9DQT4UiOeFc+SxCsvfrQEqI6qhZgkhPL6kNB8uKB3LRvIPghyZta8OQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1650890851159588.0339494060952; Mon, 25 Apr 2022 05:47:31 -0700 (PDT) Received: from localhost ([::1]:41320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niy7m-0005X3-49 for importer@patchew.org; Mon, 25 Apr 2022 08:47:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <45f83750655d27fae163e1169be44b72e9c72101@lizzy.crudebyte.com>) id 1niy2E-00068g-Sm; Mon, 25 Apr 2022 08:41:46 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:40437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <45f83750655d27fae163e1169be44b72e9c72101@lizzy.crudebyte.com>) id 1niy2C-0002CQ-Gm; Mon, 25 Apr 2022 08:41:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=eiUhLnvniCRFRmHg94IspHR8zuzxCuN7kmOFel0V+B0=; b=BerNB RbopCkoxgG5gOX5xxT49Z8FIqgiRSP/v1Y6cCcqb3cmWRzccbti7WPCbkOzOQho8wMrZ7WAthmya5 S+L/ZvTniSRt8t/Y31sRerVh8ArtwTPn2VvXiJA0/Sg9l8nkiXHwK+PsinGqPDSzPB/qA18rlLZvQ IGFtxzZt/13v6LtTGS9DkbCFiFJPnwLuc6UkqFEczUcbaOSzxCg8AxHtnDkv1J4hy1NGtAHDyWLmQ c6M6JIT0UuqOO0JvUqHTVDn4zi1uxAWBzIyNsTB8WykifQdYihlnjVXdCrKG/IrxZQGe1NpSspoRR XqOS50B17YBo7Yz5Qu1GDyxD2gL1g==; Message-Id: <45f83750655d27fae163e1169be44b72e9c72101.1650889268.git.qemu_oss@crudebyte.com> In-Reply-To: References: Date: Mon, 25 Apr 2022 14:20:43 +0200 Subject: [PATCH v3 1/6] 9pfs: fix qemu_mknodat(S_IFREG) on macOS To: qemu-devel@nongnu.org Cc: Will Cohen , Greg Kurz , Michael Roitzsch , Keno Fischer , Akihiko Odaki , qemu-stable@nongnu.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: none client-ip=91.194.90.13; envelope-from=45f83750655d27fae163e1169be44b72e9c72101@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" Reply-to: Christian Schoenebeck From: Christian Schoenebeck via X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1650890851885100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" mknod() on macOS does not support creating regular files, so divert to openat_file() if S_IFREG is passed with mode argument. Furthermore, 'man 2 mknodat' on Linux says: "Zero file type is equivalent to type S_IFREG". Link: https://lore.kernel.org/qemu-devel/17933734.zYzKuhC07K@silver/ Signed-off-by: Christian Schoenebeck Reviewed-by: Will Cohen Reviewed-by: Greg Kurz --- hw/9pfs/9p-util-darwin.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/9pfs/9p-util-darwin.c b/hw/9pfs/9p-util-darwin.c index bec0253474..e24d09763a 100644 --- a/hw/9pfs/9p-util-darwin.c +++ b/hw/9pfs/9p-util-darwin.c @@ -77,6 +77,15 @@ int fsetxattrat_nofollow(int dirfd, const char *filename= , const char *name, int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev) { int preserved_errno, err; + + if (S_ISREG(mode) || !(mode & S_IFMT)) { + int fd =3D openat_file(dirfd, filename, O_CREAT, mode); + if (fd =3D=3D -1) { + return fd; + } + close(fd); + return 0; + } if (!pthread_fchdir_np) { error_report_once("pthread_fchdir_np() not available on this versi= on of macOS"); return -ENOTSUP; --=20 2.32.0 (Apple Git-132)