From nobody Thu Nov 28 10:40:05 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1694234119; cv=none; d=zohomail.com; s=zohoarc; b=HQJekO7jyueR1/FdZtbAOO3vlSK5oirY4PK67Vt7jiftcIdFbbK3K4at5qxLZ06dUXX447aKwWRTUCZi5iQtxgTQICudEGuE5sqKErJyv4YJny3O2fb3BiHFIQnJjMyTN/UxIBRLGh7CeG6Exlc3uUHk+VKK98H/XLweodS14B4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694234119; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NQPQkmqbnFACQIlUwkAtPXqSarrHZNN1zhubxQ6WoBA=; b=GzxkNaL/w+3tJJBzDsd9sqamk6ehSCXInzXejn1ujucpjhvkK7X9L4B7flQ/IGkUclxSmDD5irYQAnBVOCzlERaD6pYWbhPTGYR3z9uJfZdm+5o5bam+T5riT/quTSpYAYgNZISd8VbAfe524Fs4M54vwiTXm7jC9zD9ayfwB9Y= 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 1694234119189242.41666936218132; Fri, 8 Sep 2023 21:35:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qepfJ-000119-IF; Sat, 09 Sep 2023 00:33:50 -0400 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 1qepfF-0000zQ-7w for qemu-devel@nongnu.org; Sat, 09 Sep 2023 00:33:45 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qepfD-0002vu-2O for qemu-devel@nongnu.org; Sat, 09 Sep 2023 00:33:45 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-31f7638be6eso1852566f8f.3 for ; Fri, 08 Sep 2023 21:33:42 -0700 (PDT) Received: from karim.my.domain ([197.39.120.250]) by smtp.gmail.com with ESMTPSA id d16-20020adff2d0000000b0031981c500aasm3615102wrp.25.2023.09.08.21.33.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Sep 2023 21:33:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694234021; x=1694838821; 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=NQPQkmqbnFACQIlUwkAtPXqSarrHZNN1zhubxQ6WoBA=; b=KB5Mg1cnwpYR89z22XtLLOkUHK6vPUohHOX1gujODfYyXKOmAFCWxVzSflBvSFzI99 /gBExeNc5/OMYNr9kfuLinQ78HflYlRiFbRtjnkbQIeP19OyEmTNDO06kvpJDR9ncQJq p8apBkPajGCMWfx6eKlg306uG4ibQB2Ud9PKfTK6xkoAMKZlsD0DIwt/RJfy3nYvt8WR uz8pxezLZn1jkd3q839TmZVH8QWZJxQZBBQrIBjHHD1JKvwzeEcX5Yn4YsJ/OAgOU/jS sH7QKdlHcL++OV48GAVAZRkTO/CsXsHvAwsMTy0AEQb6Q8AgyMv7KXSrdASMBs45334I DwPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694234021; x=1694838821; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NQPQkmqbnFACQIlUwkAtPXqSarrHZNN1zhubxQ6WoBA=; b=VBiOfVPc7Y+pO9+Im1RJgkQUf5Z+6s8d1AIWMgoU286ikKcjAe7w2XMS/SaA1jJxBO 6z472VUDCNDvjj2kjHcIWcoggexi1twiebG3wGFiK6XnGwpUXoUzTQipFoHhnQfMwIOE VVMHDdNuF73ll3lKLy/lJcQWypy9GYgtb9K35gWzBSU0h4C82qcRbk9FzDl7DlAVFTCW wRDKTbycgGzy1c3BTK/VIGwivk2HZga49QyRez0Y6s7fetcRhoL1htnNG8D6rVARwn9C sNyslYJ4K8o9kDe97Gg8JzG5tJs82+38y6LtLknosHrYMYI6H5i1PaGIA5ouw0OdiCaZ ZSyA== X-Gm-Message-State: AOJu0Yy4WJllZv/zmp+ljONirnLZM2xXQYs2st/7qdir+eRTGemJGKFP /6SZ3f4cP/2qsFPfe1jatuIxXPzriCc= X-Google-Smtp-Source: AGHT+IG6Hw0IwcyY7A+xgHSGYHWjw2DyFUi9jD8bw10JhsQ/2Q2PgpU4HX6GWiM38aQx8TJu37CF5A== X-Received: by 2002:a05:6000:c8:b0:315:9676:c360 with SMTP id q8-20020a05600000c800b003159676c360mr3735985wrx.25.1694234021098; Fri, 08 Sep 2023 21:33:41 -0700 (PDT) From: Karim Taha To: qemu-devel@nongnu.org Cc: imp@bsdimp.com, Kyle Evans , Karim Taha , Richard Henderson Subject: [PATCH v2 06/23] bsd-user: Implement shm_rename(2) system call Date: Thu, 7 Sep 2023 09:42:45 +0200 Message-ID: <20230907074302.79234-7-kariem.taha2.7@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230907074302.79234-1-kariem.taha2.7@gmail.com> References: <20230907074302.79234-1-kariem.taha2.7@gmail.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: pass client-ip=2a00:1450:4864:20::434; envelope-from=kariem.taha2.7@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_24_48=1.34, 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 @gmail.com) X-ZM-MESSAGEID: 1694234119965100007 Content-Type: text/plain; charset="utf-8" From: Kyle Evans Signed-off-by: Kyle Evans Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/freebsd/os-misc.h | 24 ++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 6 ++++++ 2 files changed, 30 insertions(+) diff --git a/bsd-user/freebsd/os-misc.h b/bsd-user/freebsd/os-misc.h index 6b424b7078..67e450fe7c 100644 --- a/bsd-user/freebsd/os-misc.h +++ b/bsd-user/freebsd/os-misc.h @@ -66,5 +66,29 @@ static inline abi_long do_freebsd_shm_open2(abi_ulong pa= thptr, abi_ulong flags, } #endif /* __FreeBSD_version >=3D 1300048 */ =20 +#if defined(__FreeBSD_version) && __FreeBSD_version >=3D 1300049 +/* shm_rename(2) */ +static inline abi_long do_freebsd_shm_rename(abi_ulong fromptr, abi_ulong = toptr, + abi_ulong flags) +{ + int ret; + void *ufrom, *uto; + + ufrom =3D lock_user_string(fromptr); + if (ufrom =3D=3D NULL) { + return -TARGET_EFAULT; + } + uto =3D lock_user_string(toptr); + if (uto =3D=3D NULL) { + unlock_user(ufrom, fromptr, 0); + return -TARGET_EFAULT; + } + ret =3D get_errno(shm_rename(ufrom, uto, flags)); + unlock_user(ufrom, fromptr, 0); + unlock_user(uto, toptr, 0); + + return ret; +} +#endif /* __FreeBSD_version >=3D 1300049 */ =20 #endif /* OS_MISC_H */ diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index b4311db578..2920370ad2 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -495,6 +495,12 @@ static abi_long freebsd_syscall(void *cpu_env, int num= , abi_long arg1, break; #endif =20 +#if defined(__FreeBSD_version) && __FreeBSD_version >=3D 1300049 + case TARGET_FREEBSD_NR_shm_rename: /* shm_rename(2) */ + ret =3D do_freebsd_shm_rename(arg1, arg2, arg3); + break; +#endif + /* * sys{ctl, arch, call} */ --=20 2.42.0