From patchwork Fri Jun 24 21:47:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1648193 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=z7CxNARd; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LV9jd1Zn0z9sG2 for ; Sat, 25 Jun 2022 07:48:37 +1000 (AEST) Received: from localhost ([::1]:56380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4rAJ-0002eY-0d for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2022 17:48:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r99-0002bb-8L for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:23 -0400 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:45769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4r97-0007Uq-Fe for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:22 -0400 Received: by mail-io1-xd2c.google.com with SMTP id i194so3980566ioa.12 for ; Fri, 24 Jun 2022 14:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TrqFubMWK6vYp8ssFg9YAQd4SKhUAEjv/YEPYS2wSqs=; b=z7CxNARd/i4wWlyZvaNcjyY58bNxFBUibvj4nw1W4oZS9B8uS4Qi01ImscmfgVoqqM //VDqGuAaj/ZcW1zw78reQRKVXUcTQ+SfpOUY75ipRFcVD1OhjMaYcDLVjkhzUv+UtHx rB+aPzqiSDuvfOvKGBzJVxTv5FpKRKsGwfBgQG7Q6INKbXTGqSNzu+vAqLbS1t52EWZo bLhvm9GlhLGybPfnoPNfrXXI4n3gnqjFLkmoiKE16dDUceoQwYDkRaw2fGL0lfGfvxjm 5YVE3kySx01oGPJt/ztso9zYdU3XelIovKOp9vP+yy82bVW7S7fTROz7y0pJTGW62Xum Zd/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TrqFubMWK6vYp8ssFg9YAQd4SKhUAEjv/YEPYS2wSqs=; b=LdQ8LibObdtZi5Z2XrhKE7KIZIsEzVwV4WyKYi/VLQFoIgTOobtnQhnw+v0eptUVoJ omNSMpfucv/jN5uYidmlj+ZZ3UBG4/GIf5Wav4hJezee4X0zbDcqNSYHypeJXFyDkRrf fAt9l7prRthfzcbkAVx3p60mb/CyoZHRJwBGZd7JULMYDRixBTCLb0RF06qX2RtC3ECU UUOhO0EctoWYRtl3KC3FdxGA2vveQrtl3l7My4LI4O7xkl8fYfmIvKwdDqOCE5n/diTD b2MpK0QBhCSmjhl8Rtgu7OwKf1qVA3J7sD2Ruhimt1yrUF/NH08Yp1Y193cxrdhrTZy+ WnhA== X-Gm-Message-State: AJIora8pCsPGOeCtO562hxepAf3vvPdecFDYUq8CAP8Av4EY81vVSnpq UxP3fUz6Y+sTCZsiAlbHttq5HLKwElOZPA== X-Google-Smtp-Source: AGRyM1s+fFtPC4Jt2vGmuPRDmTAUa+zPFV6uPu5KZb7tHnnltlSN6KwdPsHzbYH/6ReAWz72AFgMxA== X-Received: by 2002:a05:6638:1511:b0:332:3cb6:a920 with SMTP id b17-20020a056638151100b003323cb6a920mr798732jat.34.1656107240228; Fri, 24 Jun 2022 14:47:20 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id q45-20020a056638346d00b00331563be3ecsm1553561jav.121.2022.06.24.14.47.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 14:47:19 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , Warner Losh , Stacey Son , Jung-uk Kim , Richard Henderson Subject: [PATCH v2 01/11] bsd-user: Implement mount, umount and nmount Date: Fri, 24 Jun 2022 15:47:32 -0600 Message-Id: <20220624214742.89229-2-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220624214742.89229-1-imp@bsdimp.com> References: <20220624214742.89229-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2c; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2c.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Stacey Son Signed-off-by: Jung-uk Kim Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-file.h | 52 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 13 +++++++++ 2 files changed, 65 insertions(+) diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h index b2dca586129..a0f03102639 100644 --- a/bsd-user/bsd-file.h +++ b/bsd-user/bsd-file.h @@ -549,4 +549,56 @@ static abi_long do_bsd_sync(void) return 0; } +/* mount(2) */ +static abi_long do_bsd_mount(abi_long arg1, abi_long arg2, abi_long arg3, + abi_long arg4) +{ + abi_long ret; + void *p1, *p2; + + LOCK_PATH2(p1, arg1, p2, arg2); + /* + * XXX arg4 should be locked, but it isn't clear how to do that since it may + * be not be a NULL-terminated string. + */ + if (arg4 == 0) { + ret = get_errno(mount(p1, p2, arg3, NULL)); /* XXX path(p2)? */ + } else { + ret = get_errno(mount(p1, p2, arg3, g2h_untagged(arg4))); /* XXX path(p2)? */ + } + UNLOCK_PATH2(p1, arg1, p2, arg2); + + return ret; +} + +/* unmount(2) */ +static abi_long do_bsd_unmount(abi_long arg1, abi_long arg2) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(unmount(p, arg2)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg1); + + return ret; +} + +/* nmount(2) */ +static abi_long do_bsd_nmount(abi_long arg1, abi_long count, + abi_long flags) +{ + abi_long ret; + struct iovec *vec = lock_iovec(VERIFY_READ, arg1, count, 1); + + if (vec != NULL) { + ret = get_errno(nmount(vec, count, flags)); + unlock_iovec(vec, arg1, count, 0); + } else { + return -TARGET_EFAULT; + } + + return ret; +} + #endif /* BSD_FILE_H */ diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index 2623caf8007..bd4dfa6ddc7 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -33,6 +33,7 @@ #include "qemu/path.h" #include #include +#include #include #include @@ -373,6 +374,18 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = do_bsd_sync(); break; + case TARGET_FREEBSD_NR_mount: /* mount(2) */ + ret = do_bsd_mount(arg1, arg2, arg3, arg4); + break; + + case TARGET_FREEBSD_NR_unmount: /* unmount(2) */ + ret = do_bsd_unmount(arg1, arg2); + break; + + case TARGET_FREEBSD_NR_nmount: /* nmount(2) */ + ret = do_bsd_nmount(arg1, arg2, arg3); + break; + default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); ret = -TARGET_ENOSYS; From patchwork Fri Jun 24 21:47:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1648194 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=s3UhAv4g; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LV9jf0q6xz9sG2 for ; Sat, 25 Jun 2022 07:48:38 +1000 (AEST) Received: from localhost ([::1]:56438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4rAJ-0002hX-Mj for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2022 17:48:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r9A-0002dm-Kn for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:24 -0400 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]:35597) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4r98-0007Uu-8y for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:24 -0400 Received: by mail-io1-xd29.google.com with SMTP id y18so4035469iof.2 for ; Fri, 24 Jun 2022 14:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bgwQMyFdeqw2DWHzdfLeOHQc+nkcKWljBJRsPafIN7M=; b=s3UhAv4g+srghjS3y4MIrcu9SPG1dV7GiScVTDuqGe07oOHaw4r9nKc4zKq3vadQ11 ozLyIGg7tDeUT4X/xhi2Q3zNNPoWhBhgpt2VZiXTT1nkKKiQIVdX+ZCWmpp3hFfT/goQ N9x2TkYKqhYlyBGbO3AD+Sa0u/g9VXa297CDF1UvXHPUUkgofL8pT0ARiySAZfmNfi2E +qJCAP8AVZWhHNnV1dM1jO2KUmmG6/1OsDm/+gRce7lRvvyAopBy2hYYf1lo+yA64pZW Ii8yK5RThfjLxWJ09XR3d1obf8KlUgY10s1074ADoCZTKdnGk/5NNA3uWQ0XRhHm2Nrg NDMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bgwQMyFdeqw2DWHzdfLeOHQc+nkcKWljBJRsPafIN7M=; b=ZjSYvu/Z1iB+aJbbiShPdx5ZIis8lVH2R/qfgsjgP42AebAm3u50JTFQRaFhtM/AyO sa+dsa45wKcYPX0/to9HrCwFd94vw/Pca7uhWioa4svmY2SbPoM+qzFHRkov5qiuv3jc eOwt7i801fYcYoCB20cgBHwOSGseCoc+BTXNJEvwnqbQ8NU1WlbZu0b5Bqs9mD/J8F3w NHhgBZRFSOuVSLFP3aF+yfeB+FWTUAkWo9VdNLQwAYsPlKMUB3+L+T1aU9gaLNMObUhg kwARhxeuWMA8WCzxWyJco7kAztDZbLoVlvart+0kFD5Zx6p742XIeL3iVtkKqk1ZCQ7u pUJQ== X-Gm-Message-State: AJIora9lUUmeTv+6Y7CvgNs4hP2+xKU6F9wvSBXvsoDeylb1R3lrkqDk PwCv8bhClp5FmT/lRQyGIRSDWTRRf5MB5Q== X-Google-Smtp-Source: AGRyM1uWFCSZNEAfDhSJj2DantDnc6+Tzu1XkyXq0FhirL/p64GsV5b2LOm9DR18uNm7dQXf5CZ5eg== X-Received: by 2002:a05:6602:1410:b0:657:86b8:e641 with SMTP id t16-20020a056602141000b0065786b8e641mr562199iov.188.1656107240990; Fri, 24 Jun 2022 14:47:20 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id q45-20020a056638346d00b00331563be3ecsm1553561jav.121.2022.06.24.14.47.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 14:47:20 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , Warner Losh , Stacey Son , Jung-uk Kim Subject: [PATCH v2 02/11] bsd-user: Implement symlink, symlinkat, readlink and readlinkat Date: Fri, 24 Jun 2022 15:47:33 -0600 Message-Id: <20220624214742.89229-3-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220624214742.89229-1-imp@bsdimp.com> References: <20220624214742.89229-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d29; envelope-from=imp@bsdimp.com; helo=mail-io1-xd29.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Stacey Son Signed-off-by: Jung-uk Kim Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-file.h | 74 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 16 ++++++++ 2 files changed, 90 insertions(+) diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h index a0f03102639..635ac8d0e62 100644 --- a/bsd-user/bsd-file.h +++ b/bsd-user/bsd-file.h @@ -601,4 +601,78 @@ static abi_long do_bsd_nmount(abi_long arg1, abi_long count, return ret; } +/* symlink(2) */ +static abi_long do_bsd_symlink(abi_long arg1, abi_long arg2) +{ + abi_long ret; + void *p1, *p2; + + LOCK_PATH2(p1, arg1, p2, arg2); + ret = get_errno(symlink(p1, p2)); /* XXX path(p1), path(p2) */ + UNLOCK_PATH2(p1, arg1, p2, arg2); + + return ret; +} + +/* symlinkat(2) */ +static abi_long do_bsd_symlinkat(abi_long arg1, abi_long arg2, + abi_long arg3) +{ + abi_long ret; + void *p1, *p2; + + LOCK_PATH2(p1, arg1, p2, arg3); + ret = get_errno(symlinkat(p1, arg2, p2)); /* XXX path(p1), path(p2) */ + UNLOCK_PATH2(p1, arg1, p2, arg3); + + return ret; +} + +/* readlink(2) */ +static abi_long do_bsd_readlink(CPUArchState *env, abi_long arg1, + abi_long arg2, abi_long arg3) +{ + abi_long ret; + void *p1, *p2; + + LOCK_PATH(p1, arg1); + p2 = lock_user(VERIFY_WRITE, arg2, arg3, 0); + if (p2 == NULL) { + UNLOCK_PATH(p1, arg1); + return -TARGET_EFAULT; + } + if (strcmp(p1, "/proc/curproc/file") == 0) { + CPUState *cpu = env_cpu(env); + TaskState *ts = (TaskState *)cpu->opaque; + strncpy(p2, ts->bprm->fullpath, arg3); + ret = MIN((abi_long)strlen(ts->bprm->fullpath), arg3); + } else { + ret = get_errno(readlink(path(p1), p2, arg3)); + } + unlock_user(p2, arg2, ret); + UNLOCK_PATH(p1, arg1); + + return ret; +} + +/* readlinkat(2) */ +static abi_long do_bsd_readlinkat(abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4) +{ + abi_long ret; + void *p1, *p2; + + LOCK_PATH(p1, arg2); + p2 = lock_user(VERIFY_WRITE, arg3, arg4, 0); + if (p2 == NULL) { + UNLOCK_PATH(p1, arg2); + return -TARGET_EFAULT; + } + ret = get_errno(readlinkat(arg1, p1, p2, arg4)); + unlock_user(p2, arg3, ret); + UNLOCK_PATH(p1, arg2); + + return ret; +} + #endif /* BSD_FILE_H */ diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index bd4dfa6ddc7..80ec9dd4954 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -386,6 +386,22 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = do_bsd_nmount(arg1, arg2, arg3); break; + case TARGET_FREEBSD_NR_symlink: /* symlink(2) */ + ret = do_bsd_symlink(arg1, arg2); + break; + + case TARGET_FREEBSD_NR_symlinkat: /* symlinkat(2) */ + ret = do_bsd_symlinkat(arg1, arg2, arg3); + break; + + case TARGET_FREEBSD_NR_readlink: /* readlink(2) */ + ret = do_bsd_readlink(cpu_env, arg1, arg2, arg3); + break; + + case TARGET_FREEBSD_NR_readlinkat: /* readlinkat(2) */ + ret = do_bsd_readlinkat(arg1, arg2, arg3, arg4); + break; + default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); ret = -TARGET_ENOSYS; From patchwork Fri Jun 24 21:47:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1648197 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=VbKwqNX5; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LV9p458Kyz9sG2 for ; Sat, 25 Jun 2022 07:52:28 +1000 (AEST) Received: from localhost ([::1]:36884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4rE2-0000PB-HE for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2022 17:52:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r9A-0002ds-MY for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:24 -0400 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]:36530) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4r99-0007V2-5x for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:24 -0400 Received: by mail-io1-xd2b.google.com with SMTP id r133so4038919iod.3 for ; Fri, 24 Jun 2022 14:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eBqWqkQgsRng63/sJNZmq8NBH7vr2Z23dtkmb5w8maI=; b=VbKwqNX58NfQE3/z1cZL2VwwVma8kT8v9EHdpsY/2OMzTYkFgfx87XuAVzOGaB0Mkg 42jR/kZ0TlMMxbJq2aYrCOXrgX9hOTMO5OGv1Kxy8y3FBlUXr1Qb319aXaCm0Fd/XchT 4u0vAKPRTxIGuar0Y/xZHnlFTfisQiziuFt1YPnZl2R963gzoVhE8WjGTbfsBuH6WIgU Mw/7d0VaZ25xTCjOPObzJ6/G8CMF/uPQueWVTHkcSF8GOxwonCm5hAEalHi0rRLo7a6Z TXQhHcCUwaavYU3/VffAUdzItU77lNyyfodHNHa3Qb2BocDS8B1flxUHLRG8SBjxg0vs MhCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eBqWqkQgsRng63/sJNZmq8NBH7vr2Z23dtkmb5w8maI=; b=XZpr4+DBhaHeXaZa6Kw/nYSV/X5r3vG8KZfcpZVlR+Jhb0GLiPa46D1+O+Dvhi1R7e OHC0Ihe2gPj5Sz1Q3hywmwKYD4KxnoHkeWNn18WKo73GVcX098lorlbF61QNwtQ8Oah/ qiP3rMKT7fC/o44m/fiDz9vvs9WvqNrn3U/oWYDemD4HXaAvGkJUuvUiJDSAgd56mlTn j5gIJqx4wlT6GIbwGG1otcUVviOZE7f5lxfBak9AbrWUDrMuTHrYhC64K8+2HQv14Dez N6yM3oflNhZ0A/KgfnYrrvltbcl9tlKEuQtH4azvURcCe+VBfshGsyJHg5Ck/Qw+KCjS gDrg== X-Gm-Message-State: AJIora8U6+KlsTLOqyhF+hSkorUtUG7tgGfmnWwXRGxpftYgPKgmyHbH CNKjf+bp0Zi+/s0SvzGDTza79Nrnz8V9Gg== X-Google-Smtp-Source: AGRyM1treZFqKzImSMvnKycE+pD//el+MjsYJnikeZTdi9dMk0V04r/qoKAQnxAv/Lxw8RGNqzAGTQ== X-Received: by 2002:a05:6638:2110:b0:33b:b100:551e with SMTP id n16-20020a056638211000b0033bb100551emr809851jaj.116.1656107241858; Fri, 24 Jun 2022 14:47:21 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id q45-20020a056638346d00b00331563be3ecsm1553561jav.121.2022.06.24.14.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 14:47:21 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , Warner Losh , Stacey Son , Richard Henderson Subject: [PATCH v2 03/11] bsd-user: implement chmod, fchmod, lchmod and fchmodat Date: Fri, 24 Jun 2022 15:47:34 -0600 Message-Id: <20220624214742.89229-4-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220624214742.89229-1-imp@bsdimp.com> References: <20220624214742.89229-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2b; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2b.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-file.h | 46 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 16 ++++++++++++ 2 files changed, 62 insertions(+) diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h index 635ac8d0e62..1af79866fc6 100644 --- a/bsd-user/bsd-file.h +++ b/bsd-user/bsd-file.h @@ -675,4 +675,50 @@ static abi_long do_bsd_readlinkat(abi_long arg1, abi_long arg2, return ret; } +/* chmod(2) */ +static abi_long do_bsd_chmod(abi_long arg1, abi_long arg2) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(chmod(p, arg2)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg1); + + return ret; +} + +/* fchmod(2) */ +static abi_long do_bsd_fchmod(abi_long arg1, abi_long arg2) +{ + return get_errno(fchmod(arg1, arg2)); +} + +/* lchmod(2) */ +static abi_long do_bsd_lchmod(abi_long arg1, abi_long arg2) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(lchmod(p, arg2)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg1); + + return ret; +} + +/* fchmodat(2) */ +static abi_long do_bsd_fchmodat(abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg2); + ret = get_errno(fchmodat(arg1, p, arg3, arg4)); + UNLOCK_PATH(p, arg2); + + return ret; +} + #endif /* BSD_FILE_H */ diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index 80ec9dd4954..b33d548a4b6 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -402,6 +402,22 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = do_bsd_readlinkat(arg1, arg2, arg3, arg4); break; + case TARGET_FREEBSD_NR_chmod: /* chmod(2) */ + ret = do_bsd_chmod(arg1, arg2); + break; + + case TARGET_FREEBSD_NR_fchmod: /* fchmod(2) */ + ret = do_bsd_fchmod(arg1, arg2); + break; + + case TARGET_FREEBSD_NR_lchmod: /* lchmod(2) */ + ret = do_bsd_lchmod(arg1, arg2); + break; + + case TARGET_FREEBSD_NR_fchmodat: /* fchmodat(2) */ + ret = do_bsd_fchmodat(arg1, arg2, arg3, arg4); + break; + default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); ret = -TARGET_ENOSYS; From patchwork Fri Jun 24 21:47:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1648200 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=Jcc8VMq4; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LV9y01bPkz9s0w for ; Sat, 25 Jun 2022 07:59:18 +1000 (AEST) Received: from localhost ([::1]:48498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4rKd-000057-8t for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2022 17:59:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r9C-0002hG-46 for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:26 -0400 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]:44588) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4r9A-0007VI-1l for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:25 -0400 Received: by mail-io1-xd33.google.com with SMTP id z7so3986119ioe.11 for ; Fri, 24 Jun 2022 14:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NGeZtblBEzDSbgJqh8FDdYvIEAG+akNqqEhJldgR+0U=; b=Jcc8VMq48AkVrT67rHJJypySEb21QU8a2fnUkNOoh08X5cys59ZUGl8Kz6cQtGtIIA idedWpxPh85zDiXyYHETddZzhxF3YtZEJcwbGt65MnmcckPn/7C8KXQVE/Vsn22h3uxf fZCQ8e6YIDciKFuqvIPO3NpY5mzXnia0GuB0eW4464t5zz1oSU8rfoVZjltrZLBjJmYc L1cUnDbYVrH4l6394g7c2qOE+OBi5+GAT3YKWdbWK1pdL1V+l0LP6GLLWBIMMSRVKNYv 2mvYZjg0mVTzCWcq8rM/Vikl+bhQa+HbdM+U9oHVzkW4MMhEPTkrssGZozOjlWVPhpHs 5pig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NGeZtblBEzDSbgJqh8FDdYvIEAG+akNqqEhJldgR+0U=; b=Z+go/kQhSrSf446n15to8G77I5rtq0wRk1iAV3/12hTHlIfbxjNVrlJOhdWso4PyvE lVkyiFOVmRAs0xENda9n9t/RSbTAHOZWIvlzJ7LF2zMC9tSEAdtsUI7KbD3Xk6iUaKrH Jiv5BZbEf3BMcxbwOEMjpHbz1GCHYRbLy61EiPThIoWqaTWXtBEAWvNsXtUYP4eyGMSx j2pCXmJDa085z0Ze8BbazfQXJYw6l9DDWeYTU5AjpTTeSO3ue2lzX+Esm8mhAZ1/0UaO VMpEUirp79EBxU1fOlb+utzcEHgMHOUvXKSJUd+M+NRlKurxY5l3QqecN8fg9/Xqzxnk W4cg== X-Gm-Message-State: AJIora/mDC93qMRMy8h6nyqG9u5l0BD/x17cvv7nmGPD6S+Eqv+Ve4Zw JMAUrDoBwEE7Iycl6CaeCHCwKtVFSVZbsw== X-Google-Smtp-Source: AGRyM1vdLlBLQBChz5Ux95ub/CVz0W6/PPPD1yAg4Or87ARLwiKmpyYsLXtH1j2OE3exvyfJqCkrIw== X-Received: by 2002:a05:6638:4908:b0:33b:be12:df36 with SMTP id cx8-20020a056638490800b0033bbe12df36mr757597jab.278.1656107242594; Fri, 24 Jun 2022 14:47:22 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id q45-20020a056638346d00b00331563be3ecsm1553561jav.121.2022.06.24.14.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 14:47:22 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , Warner Losh , Stacey Son , Michal Meloun Subject: [PATCH v2 04/11] bsd-user: Implement freebsd11_mknod, freebsd11_mknodat and mknodat Date: Fri, 24 Jun 2022 15:47:35 -0600 Message-Id: <20220624214742.89229-5-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220624214742.89229-1-imp@bsdimp.com> References: <20220624214742.89229-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d33; envelope-from=imp@bsdimp.com; helo=mail-io1-xd33.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" These implement both the old-pre INO64 mknod variations, as well as the now current INO64 variant. To implement the old stuff, we use some linker magic to bind to the old versions of these functions. Signed-off-by: Stacey Son Signed-off-by: Michal Meloun Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-file.h | 47 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 13 ++++++++++ 2 files changed, 60 insertions(+) diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h index 1af79866fc6..b05d3cbb717 100644 --- a/bsd-user/bsd-file.h +++ b/bsd-user/bsd-file.h @@ -721,4 +721,51 @@ static abi_long do_bsd_fchmodat(abi_long arg1, abi_long arg2, return ret; } +/* pre-ino64 mknod(2) */ +static abi_long do_bsd_freebsd11_mknod(abi_long arg1, abi_long arg2, abi_long arg3) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(syscall(SYS_freebsd11_mknod, p, arg2, arg3)); + UNLOCK_PATH(p, arg1); + + return ret; +} + +/* pre-ino64 mknodat(2) */ +static abi_long do_bsd_freebsd11_mknodat(abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg2); + ret = get_errno(syscall(SYS_freebsd11_mknodat, arg1, p, arg3, arg4)); + UNLOCK_PATH(p, arg2); + + return ret; +} + +/* post-ino64 mknodat(2) */ +static abi_long do_bsd_mknodat(void *cpu_env, abi_long arg1, + abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, + abi_long arg6) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg2); + /* 32-bit arch's use two 32 registers for 64 bit return value */ + if (regpairs_aligned(cpu_env) != 0) { + ret = get_errno(mknodat(arg1, p, arg3, target_arg64(arg5, arg6))); + } else { + ret = get_errno(mknodat(arg1, p, arg3, target_arg64(arg4, arg5))); + } + UNLOCK_PATH(p, arg2); + + return ret; +} + #endif /* BSD_FILE_H */ diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index b33d548a4b6..d3125f340f7 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -32,6 +32,7 @@ #include "qemu/cutils.h" #include "qemu/path.h" #include +#include #include #include #include @@ -418,6 +419,18 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = do_bsd_fchmodat(arg1, arg2, arg3, arg4); break; + case TARGET_FREEBSD_NR_freebsd11_mknod: /* mknod(2) */ + ret = do_bsd_freebsd11_mknod(arg1, arg2, arg3); + break; + + case TARGET_FREEBSD_NR_freebsd11_mknodat: /* mknodat(2) */ + ret = do_bsd_freebsd11_mknodat(arg1, arg2, arg3, arg4); + break; + + case TARGET_FREEBSD_NR_mknodat: /* mknodat(2) */ + ret = do_bsd_mknodat(cpu_env, arg1, arg2, arg3, arg4, arg5, arg6); + break; + default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); ret = -TARGET_ENOSYS; From patchwork Fri Jun 24 21:47:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1648199 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=7VmOcled; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LV9vR0XWhz9sG2 for ; Sat, 25 Jun 2022 07:57:07 +1000 (AEST) Received: from localhost ([::1]:44718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4rIW-0005yJ-6z for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2022 17:57:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r9F-0002kH-4F for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:30 -0400 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]:38485) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4r9C-0007Vf-Tq for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:28 -0400 Received: by mail-il1-x129.google.com with SMTP id 9so2333679ill.5 for ; Fri, 24 Jun 2022 14:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kzAzIpUIXo+c189sqZVTv1xr+Ava31F6GIsxzJh2kq4=; b=7VmOcledEHEhWLsTlgR4kMF4pdAwRyo02VUrx3lkGEaTMuPCvL84+xsONblD9C2Dog ci2q1JpQxU2+E1rGDTQseZtJ2t+tqwFlc0zdTpHJB9ZFAqZIKkr89BmggTX6rwqphDR6 M/ZHr/uKZBvfG6NafgqiwbKBOQBrGuYLeVxljh4EnlzqIYFTW3edLiQaz2HR2hSy/8t1 8kP9r1h3ZX98dFHGtPKF9r/ro96nE1X1Zn/X4Za0fuxGMGA/1mGclcN6k6MrqS+qbbtt kGy4WW+cCBOmx4LmvxOtoqXpequW6RhF8rdHruecdDK8A28y6kjniBZP74ajIqu7sz5O Q/AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kzAzIpUIXo+c189sqZVTv1xr+Ava31F6GIsxzJh2kq4=; b=w3y4UF50ZjpoR7Lhwq0LLmu6jidJkGxmwGySBoGymKg96s08oxPa2eo0hCdWlfytE7 OALYfF/40bmoISz9RUnNATP3klNg7hoX886FkZ0tOqnfb/fPn3qbK3Ku7+alFpXG77Xh cBSAfiyAaHoML6j03/LxpNlzhWsjV/cI9ESjntVNHqOIERrXauHsroLNlNdWc7zXV4ve gVbUxODkz6yJ8cs83S3rZSe4hPVuBKYOINS/cz/Vr3sKXt17er9W198DRCibE2s3Itoz JhlABlbDsoEbvzbbQftYWsmzfyJtb7jI4zTzZgrisZ7WClASpnOMoN4vXXW6Ax+nWGG3 pFdQ== X-Gm-Message-State: AJIora/znmJl9IRdH5YwrId0zrpXlIe8Rytpyp+em8Linb83PThuZ/9p thndHzjEV2Q02vE8EPGUOSr2GgbdsPr1Sw== X-Google-Smtp-Source: AGRyM1txP0Gwk6IgQfsQoa+L7fmpEAIM+aaRnmR09fZMLg5Q+k761zhYsVEVUtLXzLqaoYTenFsDGg== X-Received: by 2002:a05:6e02:15c4:b0:2d7:aa1e:5b55 with SMTP id q4-20020a056e0215c400b002d7aa1e5b55mr616261ilu.120.1656107243555; Fri, 24 Jun 2022 14:47:23 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id q45-20020a056638346d00b00331563be3ecsm1553561jav.121.2022.06.24.14.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 14:47:22 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , Warner Losh , Stacey Son , Richard Henderson Subject: [PATCH v2 05/11] bsd-user: Implement chown, fchown, lchown and fchownat Date: Fri, 24 Jun 2022 15:47:36 -0600 Message-Id: <20220624214742.89229-6-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220624214742.89229-1-imp@bsdimp.com> References: <20220624214742.89229-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::129; envelope-from=imp@bsdimp.com; helo=mail-il1-x129.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-file.h | 48 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 16 ++++++++++++ 2 files changed, 64 insertions(+) diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h index b05d3cbb717..ac171c409ca 100644 --- a/bsd-user/bsd-file.h +++ b/bsd-user/bsd-file.h @@ -768,4 +768,52 @@ static abi_long do_bsd_mknodat(void *cpu_env, abi_long arg1, return ret; } +/* chown(2) */ +static abi_long do_bsd_chown(abi_long arg1, abi_long arg2, abi_long arg3) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(chown(p, arg2, arg3)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg1); + + return ret; +} + +/* fchown(2) */ +static abi_long do_bsd_fchown(abi_long arg1, abi_long arg2, + abi_long arg3) +{ + return get_errno(fchown(arg1, arg2, arg3)); +} + +/* lchown(2) */ +static abi_long do_bsd_lchown(abi_long arg1, abi_long arg2, + abi_long arg3) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(lchown(p, arg2, arg3)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg1); + + return ret; +} + +/* fchownat(2) */ +static abi_long do_bsd_fchownat(abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg2); + ret = get_errno(fchownat(arg1, p, arg3, arg4, arg5)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg2); + + return ret; +} + #endif /* BSD_FILE_H */ diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index d3125f340f7..8090666b0d9 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -431,6 +431,22 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = do_bsd_mknodat(cpu_env, arg1, arg2, arg3, arg4, arg5, arg6); break; + case TARGET_FREEBSD_NR_chown: /* chown(2) */ + ret = do_bsd_chown(arg1, arg2, arg3); + break; + + case TARGET_FREEBSD_NR_fchown: /* fchown(2) */ + ret = do_bsd_fchown(arg1, arg2, arg3); + break; + + case TARGET_FREEBSD_NR_lchown: /* lchown(2) */ + ret = do_bsd_lchown(arg1, arg2, arg3); + break; + + case TARGET_FREEBSD_NR_fchownat: /* fchownat(2) */ + ret = do_bsd_fchownat(arg1, arg2, arg3, arg4, arg5); + break; + default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); ret = -TARGET_ENOSYS; From patchwork Fri Jun 24 21:47:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1648203 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=W3e6pxZK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LVB2w1gbHz9s0w for ; Sat, 25 Jun 2022 08:03:36 +1000 (AEST) Received: from localhost ([::1]:56072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4rOn-0005SP-7H for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2022 18:03:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r9G-0002nI-Ib for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:30 -0400 Received: from mail-il1-x12f.google.com ([2607:f8b0:4864:20::12f]:33448) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4r9B-0007Vb-NA for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:30 -0400 Received: by mail-il1-x12f.google.com with SMTP id p13so2366419ilq.0 for ; Fri, 24 Jun 2022 14:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IUq6K6+TLwzMF9mxiNvWb9xoCrCozKtJXeSE/WgpCmc=; b=W3e6pxZKlCCuwjpG+9rIKvmgE6Cs3bgXuCXaegjo3jhkTyPLo5J5f8gAJanjQBwwp7 fEtXPICK//8pjIC7ijNuqN/xoguEenuuK9p3GSshZajQGrzpLa7awYygRyMTrI4LGYYK EB6Y+B+vEzCfySsxDq/0u6FQDyxuJlmRVumOrJwWIE514Djrhm/AjFAiKmLXFQbWuvhD m7sEa2V0cYIKnHevtzEg6SUdqlEqg9NfJRAttQ+kPiAeacgOHupF4S4RIvSBCKbOziVV X1baCQV57wCVvhfSObCoKm8dUPOHMA7dUq0O050nvWveskI5I7PkbLvzgJVW0SZyEfb2 sqxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IUq6K6+TLwzMF9mxiNvWb9xoCrCozKtJXeSE/WgpCmc=; b=jfOiDucacbBlMtWHI0oPGD5i1ND7CXxaEZUc3eRYB+cR/oEF3kGS4GRQ2QcUUtNgyk e8VcoVER63YdoiBvCO8g/9TaHolMvDVKhSXSUDjd39nfjIAz8WKIljLCy4DExXCeUn2u 6MaCQuoArc0qVIgcIf+DBq5LiwBLBYhzz7EOpQSmrM39x8Wz/xqEZhAtpss1/6rF7o97 3XQVQHWLigsm6hILybLsrNH8qivr/vKGVaH3UwsAUoubGik42iDU+7We5iGv27YslmJk o9xuMlCfS0zSH+dmvPicd6rMxKN2gZir3DbFk3uKpKHLpGx2Z07HywVXSsjKA2aq9u+v wrvg== X-Gm-Message-State: AJIora8O80SCFWXHvQnWcbdVZLDBwtmXqLpNO4eYCKnYofggRtSWAW33 gH31Ld604G6hna2y80AnNXo6YCMmHxA2rQ== X-Google-Smtp-Source: AGRyM1tQg4o2gIFoz4h7iJIVRsa2sLVeJShxnuvUAQPEC+ks1olHSOOvjwP+dRxRo9R+y/jZiPhmKg== X-Received: by 2002:a05:6e02:168f:b0:2da:72fc:feec with SMTP id f15-20020a056e02168f00b002da72fcfeecmr368573ila.185.1656107244307; Fri, 24 Jun 2022 14:47:24 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id q45-20020a056638346d00b00331563be3ecsm1553561jav.121.2022.06.24.14.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 14:47:23 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , Warner Losh , Stacey Son , Richard Henderson Subject: [PATCH v2 06/11] bsd-user: Implement chflags, lchflags and fchflags Date: Fri, 24 Jun 2022 15:47:37 -0600 Message-Id: <20220624214742.89229-7-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220624214742.89229-1-imp@bsdimp.com> References: <20220624214742.89229-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12f; envelope-from=imp@bsdimp.com; helo=mail-il1-x12f.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_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-file.h | 32 ++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 12 ++++++++++++ 2 files changed, 44 insertions(+) diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h index ac171c409ca..a1c80428d98 100644 --- a/bsd-user/bsd-file.h +++ b/bsd-user/bsd-file.h @@ -816,4 +816,36 @@ static abi_long do_bsd_fchownat(abi_long arg1, abi_long arg2, return ret; } +/* chflags(2) */ +static abi_long do_bsd_chflags(abi_long arg1, abi_long arg2) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(chflags(p, arg2)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg1); + + return ret; +} + +/* lchflags(2) */ +static abi_long do_bsd_lchflags(abi_long arg1, abi_long arg2) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(lchflags(p, arg2)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg1); + + return ret; +} + +/* fchflags(2) */ +static abi_long do_bsd_fchflags(abi_long arg1, abi_long arg2) +{ + return get_errno(fchflags(arg1, arg2)); +} + #endif /* BSD_FILE_H */ diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index 8090666b0d9..06bc76a326b 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -447,6 +447,18 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = do_bsd_fchownat(arg1, arg2, arg3, arg4, arg5); break; + case TARGET_FREEBSD_NR_chflags: /* chflags(2) */ + ret = do_bsd_chflags(arg1, arg2); + break; + + case TARGET_FREEBSD_NR_lchflags: /* lchflags(2) */ + ret = do_bsd_lchflags(arg1, arg2); + break; + + case TARGET_FREEBSD_NR_fchflags: /* fchflags(2) */ + ret = do_bsd_fchflags(arg1, arg2); + break; + default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); ret = -TARGET_ENOSYS; From patchwork Fri Jun 24 21:47:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1648196 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=rgq6VLDJ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LV9nz4Sgwz9sG2 for ; Sat, 25 Jun 2022 07:52:22 +1000 (AEST) Received: from localhost ([::1]:36668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4rDu-0000FI-QF for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2022 17:52:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r9E-0002iJ-5r for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:28 -0400 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]:35597) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4r9C-0007Uu-9Q for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:27 -0400 Received: by mail-io1-xd29.google.com with SMTP id y18so4035469iof.2 for ; Fri, 24 Jun 2022 14:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=k8IKafcPetXhYaW8vSA9hmiAtlGDDQQOeGPD01WxZFo=; b=rgq6VLDJEvLmSwrURs0fTSHV+cKPsl2pkhSbrrQodbAkqu0Borq2j6sNglfmWM5YTo vJXH4wJnv5SsH1YzP3n4QYuUuyDGT2026x5FwZ3OSa/AwTllbVRFJwgomyvQsRBfdF1o QyrrRvw7ZGlzhLdRCk5vIgXG5XkmgU5Mm2RLJm/BAbIF4PC2cyJIxfKqkksKSodKeDik z6ZdChwfoRBU+v4l/ySYrsCZuvizpMrXWVwNqOLtfeda2SWfBreXq7WeOc7MnERW6LbM Ft5WIX6MvfTP2wN4/aeqw0ddR5ide+aXqfIY6WdUkEe0iFWQbNYf17Ejw++bbBD57T5F 8C6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k8IKafcPetXhYaW8vSA9hmiAtlGDDQQOeGPD01WxZFo=; b=JLbA7xs9jgcUwpAcKUzNj9mxj26CQS1B12kdzgfsD8XQ3BXSEXDYJV302MwNva64p4 dJofONRCKYGRqRoI3+UiB6ijtsS0ylTQHTAZCW7RnMrvMKU50XE5inkAt1koW3mcD+7E aypcIatsXxWwT2LB9xkLv24+VTFTq+hYrCgTAD/2fmXlvq5FRCDf69xnHMDo0FvQvpmG EIcqhTaSUac6Nl6qFrBbWNXFoA1WW3PHSEdrjWKyKfBPk7j/+q6T+8kvQNcf9KDZDcw2 g8OFQgNjY+rY2MarucSt/1QmbX1VwnvCNXWcqDWPAo4NBbdZe+zsbHNd2Zf+mQCvNXO8 MR+g== X-Gm-Message-State: AJIora9K5tJ/YXk8PCazk3b9d+hGDcek28hp7zytj0eM5VzhGvLMtKSf V3cz0idq+2OY00xgMRLXedJwXry6bSRnHQ== X-Google-Smtp-Source: AGRyM1viFQxfP2FMkZfxKa9YjfdapqI9jYJ3/9fsO946dAjr3bEQpmC/ZVVKZ/mm9HyKcaQB0tiBmA== X-Received: by 2002:a05:6638:16c2:b0:332:3901:d8b7 with SMTP id g2-20020a05663816c200b003323901d8b7mr748617jat.73.1656107245420; Fri, 24 Jun 2022 14:47:25 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id q45-20020a056638346d00b00331563be3ecsm1553561jav.121.2022.06.24.14.47.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 14:47:25 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , Warner Losh , Stacey Son , Richard Henderson Subject: [PATCH v2 07/11] bsd-user: Implement chroot and flock Date: Fri, 24 Jun 2022 15:47:38 -0600 Message-Id: <20220624214742.89229-8-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220624214742.89229-1-imp@bsdimp.com> References: <20220624214742.89229-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d29; envelope-from=imp@bsdimp.com; helo=mail-io1-xd29.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-file.h | 19 +++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h index a1c80428d98..c24054fed11 100644 --- a/bsd-user/bsd-file.h +++ b/bsd-user/bsd-file.h @@ -848,4 +848,23 @@ static abi_long do_bsd_fchflags(abi_long arg1, abi_long arg2) return get_errno(fchflags(arg1, arg2)); } +/* chroot(2) */ +static abi_long do_bsd_chroot(abi_long arg1) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(chroot(p)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg1); + + return ret; +} + +/* flock(2) */ +static abi_long do_bsd_flock(abi_long arg1, abi_long arg2) +{ + return get_errno(flock(arg1, arg2)); +} + #endif /* BSD_FILE_H */ diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index 06bc76a326b..d252fb40737 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -459,6 +459,14 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = do_bsd_fchflags(arg1, arg2); break; + case TARGET_FREEBSD_NR_chroot: /* chroot(2) */ + ret = do_bsd_chroot(arg1); + break; + + case TARGET_FREEBSD_NR_flock: /* flock(2) */ + ret = do_bsd_flock(arg1, arg2); + break; + default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); ret = -TARGET_ENOSYS; From patchwork Fri Jun 24 21:47:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1648202 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=Vh+etAdf; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LVB1j04YJz9s0w for ; Sat, 25 Jun 2022 08:02:32 +1000 (AEST) Received: from localhost ([::1]:54596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4rNm-0004Q5-2a for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2022 18:02:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r9F-0002kI-A7 for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:30 -0400 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]:43858) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4r9D-0007W3-QR for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:29 -0400 Received: by mail-io1-xd34.google.com with SMTP id p69so4000306iod.10 for ; Fri, 24 Jun 2022 14:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=guUnp9hZinCJOwjoZiIYjs2izQAW1BB4o6jwqxF1ChQ=; b=Vh+etAdfqxjOP+GN9D5Sl9fXeS3WnfbJR2GUD0Tb2idgt+GoIoseFE89rdT+SxZiEk irQ35RCbxMjMNVFxfml2nk18U9hMGPiYrrf44LGYGJfs/w857LkfCc+9zp4RE0rCKggz Ob3tVaek0U4t+0/akaB5cjvJQOdUria0Yhmpj0m1q7GIuTHqjeL9FBXmFrnkWPcR/aGl naNrOFGmu/Y48bKbEfMtBSbwLUhUMs09aMPgAoKaIniYdWluobaNZjhJPwzwYfX/jTGN kzrFQ65ZSnOlmLuc78K2JwCpX/n7PbTjXLh80OppcmRcPL/BH75U5M2jWtmOKQvKuj4U 9LtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=guUnp9hZinCJOwjoZiIYjs2izQAW1BB4o6jwqxF1ChQ=; b=5IQ749kfJlGp1p0UDYi0I7B37nZV1aOBWojM4Ef06W90ZKET/oHC0AOc8O2dNh/IWJ 6VjmDYVufEtMs6g2nZ/ImtOl6lEvUg0zYJgiUjIPoci8cD84OVbrU0JdMnt1Q38OpZ4V Gu8HJqfXBdCa4/eqJk4QY+JxGfCS1WQdKTgR/JE9tBlF6QWP6dcGmnCKe2nX6PN5uBjB DT+SlJruVt3Jg7FSP6JpNGEuDjPBjXN+2Vh5kiJuu63RHANBt2rQq3HNy9CcPB9ctebX frQmTPV3NHBubaQi6Oc6PnS5E/d9NbFfmEGBfQs1eaWgyd3kPte2djQBrus+8ZBTsCKl Vy8A== X-Gm-Message-State: AJIora9eeK/BPSK4EokIJXtNe7YtIPVHxVNGUdoAabs+T09af93pPw2q G79By7SrpEnbWN1ZYvGM5QwgKxCP9YNIdA== X-Google-Smtp-Source: AGRyM1u8Ab1ntoCJBOqkmFc27uk+iTR5h2JEqso8zuzPTYmBP+CwOGP16J4rnWBjWZZjoos9eF1aEQ== X-Received: by 2002:a02:94a2:0:b0:339:e395:764c with SMTP id x31-20020a0294a2000000b00339e395764cmr758033jah.230.1656107246306; Fri, 24 Jun 2022 14:47:26 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id q45-20020a056638346d00b00331563be3ecsm1553561jav.121.2022.06.24.14.47.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 14:47:25 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , Warner Losh , Stacey Son , Richard Henderson Subject: [PATCH v2 08/11] bsd-user: Implement mkfifo and mkfifoat Date: Fri, 24 Jun 2022 15:47:39 -0600 Message-Id: <20220624214742.89229-9-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220624214742.89229-1-imp@bsdimp.com> References: <20220624214742.89229-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d34; envelope-from=imp@bsdimp.com; helo=mail-io1-xd34.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-file.h | 27 +++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 8 ++++++++ 2 files changed, 35 insertions(+) diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h index c24054fed11..4b2f6dcc1dc 100644 --- a/bsd-user/bsd-file.h +++ b/bsd-user/bsd-file.h @@ -867,4 +867,31 @@ static abi_long do_bsd_flock(abi_long arg1, abi_long arg2) return get_errno(flock(arg1, arg2)); } +/* mkfifo(2) */ +static abi_long do_bsd_mkfifo(abi_long arg1, abi_long arg2) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(mkfifo(p, arg2)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg1); + + return ret; +} + +/* mkfifoat(2) */ +static abi_long do_bsd_mkfifoat(abi_long arg1, abi_long arg2, + abi_long arg3) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg2); + ret = get_errno(mkfifoat(arg1, p, arg3)); + UNLOCK_PATH(p, arg2); + + return ret; +} + #endif /* BSD_FILE_H */ diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index d252fb40737..be225195fbd 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -467,6 +467,14 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = do_bsd_flock(arg1, arg2); break; + case TARGET_FREEBSD_NR_mkfifo: /* mkfifo(2) */ + ret = do_bsd_mkfifo(arg1, arg2); + break; + + case TARGET_FREEBSD_NR_mkfifoat: /* mkfifoat(2) */ + ret = do_bsd_mkfifoat(arg1, arg2, arg3); + break; + default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); ret = -TARGET_ENOSYS; From patchwork Fri Jun 24 21:47:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1648204 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=bHfFibFv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LVB4G2YjBz9s0w for ; Sat, 25 Jun 2022 08:04:44 +1000 (AEST) Received: from localhost ([::1]:59146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4rPt-0007iy-Nt for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2022 18:04:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r9G-0002lz-AV for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:30 -0400 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:39460) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4r9E-0007WB-CV for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:30 -0400 Received: by mail-il1-x132.google.com with SMTP id a16so2328821ilr.6 for ; Fri, 24 Jun 2022 14:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7rP1gEhSKhqMbSa+L+cwEFk3+lhmI1TzozVh4dmnW1U=; b=bHfFibFvcLe/62zx/9oqlTXeBIFXMS0AykQZ7JeySWrlR3MLDWV/NFXH+SyZoFLpUA +Bs8+EH/jQVnovWZjJiKKMzIJ4lwG9ZvNUFn5ymM7yxi2zdLtDJxarJelR29Nnv8uCJr cF18XaPeIG2UzFUMVxWKXJZ+aCrnScdOXTCDMbCcaUZ52Yzb3YQACLcBAdo+WqSd1AEZ HsdAa+APfcDpNnIPNT0zsOinuPzTMVc9ZRBEqVUgZ2tXEyMK4Cr743OaeIGkVKh8hxdd rAKfoQvzz620id6wXB47aUwGjrY+uEXxbewTThvSjxLYU8fWMSH8Vs2VL7IM6QiReVH3 1njw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7rP1gEhSKhqMbSa+L+cwEFk3+lhmI1TzozVh4dmnW1U=; b=dMjOHXz+64dQRpoDF4KJjZKGLcTNJGyfXHdNsEk1mUemosjonpO8/DwmZ8PN8shQKq 9ou2SyjuV+LV6/ln1zoeGxTfxqqX+Xs1O3sOCR78LBrPLVCmi2QWqws0e0BW0XA6ts8q YlXqQzGbVT58tEETOOAY6nGTBZA+liPzFrWx7z6rZK9th7PCi3UoIPnucJUBaySPvIX9 gXXHRRu2v3aGh0lYuNiIm2kfLRBgml6ZtuBx3QUL/k1MPkJ/7C9VMC3MfjOOrirdDkQJ YemHkZCfUmaBTSE00RCHzNdaXLE3a0Gfm29SChOym1C5nxtIlcUPg1MuzW+9xwQyC/p+ rPyw== X-Gm-Message-State: AJIora87bpCOTdVs19+KV3EJh4kj1qga89qiW0R75Ymu8D3Ai8udBIF4 +ko3W+GsBYRuLt1zZ5x5E4zicSPhpHYoYg== X-Google-Smtp-Source: AGRyM1s8oi05Om5ixXeUqWPVXXnD98/QMruUX8kNv0BZEUUEGvwFrUuXIR4TmeLoDrIYLPpCOD+pDg== X-Received: by 2002:a05:6e02:1487:b0:2d8:faa7:b62a with SMTP id n7-20020a056e02148700b002d8faa7b62amr606114ilk.228.1656107247029; Fri, 24 Jun 2022 14:47:27 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id q45-20020a056638346d00b00331563be3ecsm1553561jav.121.2022.06.24.14.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 14:47:26 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , Warner Losh , Stacey Son , Richard Henderson Subject: [PATCH v2 09/11] bsd-user: Implement pathconf, lpathconf and fpathconf Date: Fri, 24 Jun 2022 15:47:40 -0600 Message-Id: <20220624214742.89229-10-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220624214742.89229-1-imp@bsdimp.com> References: <20220624214742.89229-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::132; envelope-from=imp@bsdimp.com; helo=mail-il1-x132.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-file.h | 32 ++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 12 ++++++++++++ 2 files changed, 44 insertions(+) diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h index 4b2f6dcc1dc..065f576dfe8 100644 --- a/bsd-user/bsd-file.h +++ b/bsd-user/bsd-file.h @@ -894,4 +894,36 @@ static abi_long do_bsd_mkfifoat(abi_long arg1, abi_long arg2, return ret; } +/* pathconf(2) */ +static abi_long do_bsd_pathconf(abi_long arg1, abi_long arg2) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(pathconf(p, arg2)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg1); + + return ret; +} + +/* lpathconf(2) */ +static abi_long do_bsd_lpathconf(abi_long arg1, abi_long arg2) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(lpathconf(p, arg2)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg1); + + return ret; +} + +/* fpathconf(2) */ +static abi_long do_bsd_fpathconf(abi_long arg1, abi_long arg2) +{ + return get_errno(fpathconf(arg1, arg2)); +} + #endif /* BSD_FILE_H */ diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index be225195fbd..7de4c40bb16 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -475,6 +475,18 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = do_bsd_mkfifoat(arg1, arg2, arg3); break; + case TARGET_FREEBSD_NR_pathconf: /* pathconf(2) */ + ret = do_bsd_pathconf(arg1, arg2); + break; + + case TARGET_FREEBSD_NR_lpathconf: /* lpathconf(2) */ + ret = do_bsd_lpathconf(arg1, arg2); + break; + + case TARGET_FREEBSD_NR_fpathconf: /* fpathconf(2) */ + ret = do_bsd_fpathconf(arg1, arg2); + break; + default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); ret = -TARGET_ENOSYS; From patchwork Fri Jun 24 21:47:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1648201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=VYXiIEwc; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LV9zX199Zz9s0w for ; Sat, 25 Jun 2022 08:00:40 +1000 (AEST) Received: from localhost ([::1]:50640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4rLx-0001Yd-V4 for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2022 18:00:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r9G-0002nA-Gl for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:30 -0400 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]:39450) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4r9F-0007WU-29 for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:30 -0400 Received: by mail-io1-xd33.google.com with SMTP id z191so4008712iof.6 for ; Fri, 24 Jun 2022 14:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8kkD0I+Ru5IcZB0L5eyNo83IbFVlqdLSdNar/0a50Tw=; b=VYXiIEwc3kFfqClcSAh7tAbAKgaXi74gPq3Ws7mf0Ef1PQRgodssNDGXothrNUUmnO W2iz/MyRReU0AGIZ+avpVLkEb6mgkosnuy0TWYY3f1fNiDBdFTIBkBZ99plXZuBR6n2E 0DzF5EoO+YMN4b4leQWcmIVc4uwFXW8Sndb2LLObNwAt/ZmzTY1Em4sly9ospogAyKWR D7gvcX1PMIRV6cvabT1/yp98yjM/UJS9299LEXop90vTOxpclAx5Zyx3gVoBp2gJ4NZo AaI0wSWDhX88VAkiMERmgb4EiJB3Cc2NPL89gkXmzm0JC3qiBjOqt3SR7liNGmw5GS32 PVtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8kkD0I+Ru5IcZB0L5eyNo83IbFVlqdLSdNar/0a50Tw=; b=u4RsEJDs45hIzb2ri2QlblBA/FE+kaGZpUyDRiZq1jcxJ408geoPvNve5vntk1s87y t1y5hg45t5H/0ukqlPBztG7fXKqQOt5qIEKgA5KGd+OHBxmmzlBeoGrk97s8rySK0ecw fUJ7K5KGLxBX97uh8PXNqbxfB1nDN0LX2YueHA42ubHfNIHKLuTE8wsx2zj2F+d79sC2 8JrZBd4ce/MVjCZs/XPxHE9YiFiGhruA8yMaEN6XcaSNgJM+wu92Glx+b+pykHR1dpZC HW/HrTAlv8WGsmWWaifuamKvdwmY7qsar5+wv/RdEKrjFisY+KtGr5wMT0vkZDhUcKR7 fS9g== X-Gm-Message-State: AJIora/Fde7Us0pbjWym+M62nl/q2gR1rgFvuax2eYgiMf8gsDfiHwyS y2HKITwx7cDM0fq9dVJONJ81nLRBnAQCMg== X-Google-Smtp-Source: AGRyM1uCEuokwofGamz79ZC488/JvReNwIxj/kVMY3Sy9Jaal+ZfQDIjbs7Vc3MYJQSjdVsDWWbSkw== X-Received: by 2002:a05:6638:1a8e:b0:339:cb8c:df22 with SMTP id ce14-20020a0566381a8e00b00339cb8cdf22mr746048jab.152.1656107247834; Fri, 24 Jun 2022 14:47:27 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id q45-20020a056638346d00b00331563be3ecsm1553561jav.121.2022.06.24.14.47.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 14:47:27 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , Warner Losh , Stacey Son , Richard Henderson Subject: [PATCH v2 10/11] bsd-user: Implement undelete Date: Fri, 24 Jun 2022 15:47:41 -0600 Message-Id: <20220624214742.89229-11-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220624214742.89229-1-imp@bsdimp.com> References: <20220624214742.89229-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d33; envelope-from=imp@bsdimp.com; helo=mail-io1-xd33.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-file.h | 13 +++++++++++++ bsd-user/freebsd/os-syscall.c | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h index 065f576dfe8..108a5061850 100644 --- a/bsd-user/bsd-file.h +++ b/bsd-user/bsd-file.h @@ -926,4 +926,17 @@ static abi_long do_bsd_fpathconf(abi_long arg1, abi_long arg2) return get_errno(fpathconf(arg1, arg2)); } +/* undelete(2) */ +static abi_long do_bsd_undelete(abi_long arg1) +{ + abi_long ret; + void *p; + + LOCK_PATH(p, arg1); + ret = get_errno(undelete(p)); /* XXX path(p)? */ + UNLOCK_PATH(p, arg1); + + return ret; +} + #endif /* BSD_FILE_H */ diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index 7de4c40bb16..57996cad8ae 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -487,6 +487,10 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = do_bsd_fpathconf(arg1, arg2); break; + case TARGET_FREEBSD_NR_undelete: /* undelete(2) */ + ret = do_bsd_undelete(arg1); + break; + default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); ret = -TARGET_ENOSYS; From patchwork Fri Jun 24 21:47:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1648205 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=JUDV/Cg6; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LVB5T2W6pz9s0w for ; Sat, 25 Jun 2022 08:05:49 +1000 (AEST) Received: from localhost ([::1]:60432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4rQw-0000Ff-68 for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2022 18:05:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r9H-0002qV-Dy for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:31 -0400 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]:33454) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4r9F-0007Wj-Ul for qemu-devel@nongnu.org; Fri, 24 Jun 2022 17:47:31 -0400 Received: by mail-il1-x135.google.com with SMTP id p13so2366536ilq.0 for ; Fri, 24 Jun 2022 14:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iRRKSO1rSwzhJvNkiVF11IeWLxX/jjQkuC6nogP90gA=; b=JUDV/Cg6FXZvDR24Lv3m0gamK+enNqTC9yJqZzq3baCX/SgOzmLCcS1hMxzYYPUHof I3Lf+NBA5LfRjfVbvo6B0yt0Yb9WBrfTh0U9lxSVHuQXAJqdHhwuY6/FyMKb/bTy1NcP wTuVo/505hrym5BXCCMyCNDAWKR3LxYsZcsNsyfAftUw9nQhSigYggrPY5t3Td1TqElw MNVX/rhh+Zodva21Rpujx+xzTNlyGoccf/kory67e4/JoDrwCZsjKMKVlKLNPqJR/+Sk o4W6ID4hHzPhGWzZBblbWnM7lNxBhCIeEelOYNglXjr9L+l5nk5HwC2z3g2CaXNsluks Gznw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iRRKSO1rSwzhJvNkiVF11IeWLxX/jjQkuC6nogP90gA=; b=lQZ7I0vKlbZXblYKq6hcOhNR1VGR9l0syQlXh4jRAZMst1s91s+luPbPyhDWBNaCWW VjiCxTxWduvRSnAcVtfELgv0EC2/MI4P3TauZ2628FnupO/kfOpO3pkmC38uc7XcnkMe ADoC9CMNmdsf/t6Yg0E+AgDmaTOXzNIFB+YjYrpWqGI9eyoWE0+jI8Uens8BNXsA09cM SsMToP8CatcWdSPBrR92i0EOx+UzQUA9zE3OR+jvmiMp8AjNTyjySGL6l/VbXZMF2G9+ 1+Mwr6GzeYymNmVgsCoyMwQyFBDsNuVCV2g8Sa4Njy9me8JFreMABPxBfZORVMBXpAU4 XBGw== X-Gm-Message-State: AJIora9yO/iGgHf6djHwVElMKyzeb87uaChl4hd0RLH7g7qko0MKPP98 OPf5ax8L/u2F6Bl3VJ9qhnTFIpALDTq8FQ== X-Google-Smtp-Source: AGRyM1tCsVvKYWqVHqZ/lptPI5NK5rBHebEM4kF829MFFiqq6UIk1wZz21jbD0wgEWIcWpr0FNRVoA== X-Received: by 2002:a05:6e02:1908:b0:2d9:5288:bd04 with SMTP id w8-20020a056e02190800b002d95288bd04mr623555ilu.148.1656107248682; Fri, 24 Jun 2022 14:47:28 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id q45-20020a056638346d00b00331563be3ecsm1553561jav.121.2022.06.24.14.47.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 14:47:28 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , Warner Losh Subject: [PATCH v2 11/11] bsd-user: Remove stray 'inline' from do_bsd_close Date: Fri, 24 Jun 2022 15:47:42 -0600 Message-Id: <20220624214742.89229-12-imp@bsdimp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220624214742.89229-1-imp@bsdimp.com> References: <20220624214742.89229-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::135; envelope-from=imp@bsdimp.com; helo=mail-il1-x135.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, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" In the last series, I inadvertantly didn't remove this inline, but did all the others. Remove it for consistency. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-file.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h index 108a5061850..588e0c50d45 100644 --- a/bsd-user/bsd-file.h +++ b/bsd-user/bsd-file.h @@ -252,7 +252,7 @@ static abi_long do_bsd_openat(abi_long arg1, abi_long arg2, } /* close(2) */ -static inline abi_long do_bsd_close(abi_long arg1) +static abi_long do_bsd_close(abi_long arg1) { return get_errno(close(arg1)); }