From nobody Mon Mar 2 10:39: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 ARC-Seal: i=1; a=rsa-sha256; t=1772425423; cv=none; d=zohomail.com; s=zohoarc; b=CQMbquSOijuHLqBbht2btyAJPm+qj5zT3j47tCSzujDi/dLvasCGlM+rB7qjJ6PgM5dMtRo54d9pfOntbrbbnJ4A3bgG5ZsOm+fQPakR7/N0pqb6Zh5EgsgokZ6e+ddj6TAgyi7gQq/0vjb74uJ7jrLzNf4Sn5YzFFvbeNJOOr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772425423; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kaJ7/WMIHYxKTm6O9Jk5r3Fvy48JrSl/V92soW/xRBY=; b=FDROKiX1w10PJ8OEn1yplaY/1xaZB3BqJWIk5EfKLGfDXo6jMsjIgmDnFDL7hlmnE6pH5Zy+0lTrcRVkfy2ekR/ixGIkT+OtwGboANlMA78MrtDYnoais9dxbXkZpF/WO61YhkJNK9UGsNgA683maPOvHdz82m646sEgfCi/kqo= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772425423300264.7358503133935; Sun, 1 Mar 2026 20:23:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vwun8-00012w-OB; Sun, 01 Mar 2026 23:21:58 -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 1vwun7-00012H-2F for qemu-devel@nongnu.org; Sun, 01 Mar 2026 23:21:57 -0500 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vwun5-0006rH-K5 for qemu-devel@nongnu.org; Sun, 01 Mar 2026 23:21:56 -0500 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-7d18a9d2b1aso3425948a34.2 for ; Sun, 01 Mar 2026 20:21:55 -0800 (PST) Received: from rebo.bsdimp.com ([50.253.99.174]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-41668233c4bsm2236778fac.19.2026.03.01.20.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Mar 2026 20:21:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1772425314; x=1773030114; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kaJ7/WMIHYxKTm6O9Jk5r3Fvy48JrSl/V92soW/xRBY=; b=QAFmmH4PXQh8jstXZp9P+sxtYKj5KKH/+oehO5CX51S+KSrTD5b3igyHzo5ouu8frp M4r63Se8sn3n0chYaMRbi3/9s2JG5HvOKLiP0TLQ/SeI2vWUU5roSr/eO8XnRx9RAait OMwMbbSzx1THzXZD6dpKN/GhZwYDnv1Jtdj8JDPHfon723OeHCPLjuPMCxvSLvLtkEDB PmndJ9REgubaOZln7d98mOFb7K16euGwQDnXycaMB7MlbX1jBwDBdmilNrB+rai2pZby z4sfLswCeELzZdmndsr7wG2jMQmpuO6d5RLdNpcRPeWRo6IppMbEdmPV1karBQnd3enX hTYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772425314; x=1773030114; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=kaJ7/WMIHYxKTm6O9Jk5r3Fvy48JrSl/V92soW/xRBY=; b=VJtLJYTwbPKkXMq75CkCYmXHcCZD0E615afpOTSBXxLaXrbfWpuRf9zezCqc29p/Pt lqPhz/ozSum8o7gtmU1be8SiHD9QZvy7WaKGJZx5OFnDjIf5D1Eks9iHhx94N6oEd+xO oSbUXRJ+0J8C+Z/I+ypy2qYAajIULze03iQBT5q11jgadnBdcq0YXJpUcuwyk4tmHQE8 HgzhjYjF3i5qNEwrNYnGcItUVhmNaQb2E/n/hMph8fzRXog4J7JikbpXUvGoes96zUCA 8u6PqeAphvMJ8+CFfESfxhGOeTW1RgbSAFjUGXbs/0M8bNqQxYqKE7oSe5prByW0Oi/V iGVA== X-Gm-Message-State: AOJu0Yz+8Zh6mKY/wSkqLLrul9Jkx3JipVCiZyZqxE6g9wkw9UN1fpHp /MGP53JPdKKDlQk/yx9m+wv3b6I27lgQ9jb7igN7TfVSzX9SsIgmVvdremvGS/vxRHU287ikIgJ sCWfybp4= X-Gm-Gg: ATEYQzzitIxFPkvwmC/KyIFRYW679wEfgbAjXwFHD5dMrETtfvVn80ZFVjuI1/uJbJR hmAirHTyQ5UTYPSeJj6rZH4UKEyuqdjeroVKM4U0qq2QE0da8UeW4Oza906mfjT/V8koiojMRj8 aqzhRPaqMJu9sCD1P5hiWEfghTMvRpbwas2VCnyF5ftohAASHMFIJSrkIg98GAu0gJCQ4LyDuCg h87VDzeN7FmODpnW3MuvppfrvbDuU5FQc2UlRxMZr/SvYVuj6MDfpuoPoNx8tY4daZqRdE4+GDo v+7pzRir6G3+cCHmasIry+QfyCTGRzht61pqireM5PVU11kkaJEFYQnGaazsV5GBsxtULexX2vT 9PfaQ1bLJlM1OyLmMoC/Ml+4maAJBr4pFBbPI/vggJfwdE7C9Xc1H6kFghr+3BmaGqAHK76jukX YpYwhorxOP0w== X-Received: by 2002:a05:6870:dc49:b0:349:de3c:bfc5 with SMTP id 586e51a60fabf-41626e4fd29mr5604405fac.7.1772425314334; Sun, 01 Mar 2026 20:21:54 -0800 (PST) From: Warner Losh To: qemu-devel@nongnu.org Cc: Reinoud Zandijk , Warner Losh , Ryo ONODERA , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Kyle Evans , Brad Smith , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Riku Voipio , Stacey Son , Brooks Davis , Sean Bruno , Mikael Urankar , Richard Henderson Subject: [PULL 14/27] bsd-user: Add host_to_target_msqid_ds for msgctl(2) Date: Sun, 1 Mar 2026 21:21:02 -0700 Message-ID: <20260302042115.83410-15-imp@bsdimp.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260302042115.83410-1-imp@bsdimp.com> References: <20260302042115.83410-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::334; envelope-from=imp@bsdimp.com; helo=mail-ot1-x334.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: qemu development 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 @bsdimp-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1772425424544158500 Content-Type: text/plain; charset="utf-8" From: Stacey Son Add host_to_target_msqid_ds() to convert host struct msqid_ds to target format for msgctl(2) IPC_STAT operations. Signed-off-by: Stacey Son Signed-off-by: Brooks Davis Signed-off-by: Sean Bruno Signed-off-by: Mikael Urankar Reviewed-by: Richard Henderson Signed-off-by: Warner Losh --- bsd-user/bsd-misc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/bsd-user/bsd-misc.c b/bsd-user/bsd-misc.c index 5e5a590227..3e1968718f 100644 --- a/bsd-user/bsd-misc.c +++ b/bsd-user/bsd-misc.c @@ -163,3 +163,30 @@ abi_long target_to_host_msqid_ds(struct msqid_ds *host= _md, =20 return 0; } + +abi_long host_to_target_msqid_ds(abi_ulong target_addr, + struct msqid_ds *host_md) +{ + struct target_msqid_ds *target_md; + + if (!lock_user_struct(VERIFY_WRITE, target_md, target_addr, 0)) { + return -TARGET_EFAULT; + } + + memset(target_md, 0, sizeof(struct target_msqid_ds)); + host_to_target_ipc_perm__locked(&target_md->msg_perm, + &host_md->msg_perm); + + /* msg_first and msg_last are not used by IPC_SET/IPC_STAT in kernel. = */ + __put_user(target_md->msg_cbytes, &host_md->msg_cbytes); + __put_user(target_md->msg_qnum, &host_md->msg_qnum); + __put_user(target_md->msg_qbytes, &host_md->msg_qbytes); + __put_user(target_md->msg_lspid, &host_md->msg_lspid); + __put_user(target_md->msg_lrpid, &host_md->msg_lrpid); + __put_user(target_md->msg_stime, &host_md->msg_stime); + __put_user(target_md->msg_rtime, &host_md->msg_rtime); + __put_user(target_md->msg_ctime, &host_md->msg_ctime); + unlock_user_struct(target_md, target_addr, 1); + + return 0; +} --=20 2.52.0