From nobody Fri Jul 15 18:04:00 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Lkzkm6BtXz4TGpZ; Fri, 15 Jul 2022 18:04:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lkzkm5L9Vz3Rhp; Fri, 15 Jul 2022 18:04:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657908240; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uEeT6OyftQ7x8XsPXLVFAlTRuWgrSoW9JXae2ueYmFE=; b=vXBHaJtHHDElTIs6/56WccjGxGuNtmr0OUqmj3h2UtgzO4xVNpZaoT4a20sLCm+8VVQ7gh 7fSb3fOr3fvrFQJ5sYxf5NacfuO8DrhFHBLus7qzg/SyeUi2EFze6JKrp42hIVL6czRUHV VZC++J0ozGt8jLAA+OVAVI/7pni9F8eaRv4R7Lzi7CHUV0eGoUwzPcfk6PeiiO3EHejgSr Yq+sYUWa2Hdhj/+Pika+JK1E1yRNhyI4Kqr7/u3oY0m7plpfOQm2tzEn5kGqimPoJHOVSt reQyfRtAQrsuXnFX8DKX6byPu0f7NxdaCiU08rkNjZuSM9lxMw4m0J/tahOSKw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Lkzkm4KTwzrNk; Fri, 15 Jul 2022 18:04:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26FI4007060263; Fri, 15 Jul 2022 18:04:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26FI40SW060262; Fri, 15 Jul 2022 18:04:00 GMT (envelope-from git) Date: Fri, 15 Jul 2022 18:04:00 GMT Message-Id: <202207151804.26FI40SW060262@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a4ed0eb1aa64 - main - kboot: Implement symlink(2) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a4ed0eb1aa64d10feaf1e64de39eb07be43a5204 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657908240; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uEeT6OyftQ7x8XsPXLVFAlTRuWgrSoW9JXae2ueYmFE=; b=NEj2L6UoEKlIvNSoqTF/lwHKoXZMyfuXyr2Lu/3WCVCpcnDai6aMWCy0U2H8XLHNJooOJK 1efwmDfx+foGojw7eOX9vCzM5UgUO0HlIqoebPgQlshF/PzMKhsVwdc0G58h0pqOTNvNP/ XQfhj7na/6YguWBZgDGCZuIRGF2bWQOQXSkQSaoM646LJubfaVLqHW8bVoBWtS9pvjWq4J rVueTe/bFFQXe7T5o/W3EAx61dBxxnoFWbfPlWkM6Kybqpu8BB/UeDWx+TzrT8hyw4BdXj dcqr1CYt0mkddu1XtGwPk4exl2yo4Ihr4wn4p5rMJ/Vv9vvso2psh2O+g9yjJA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657908240; a=rsa-sha256; cv=none; b=M3D60L1zUyGsd2qS78CbmkWHQ8Ws9R1dyXBxhz/dAxIihsqtPtPUvhEOUvB00fG6YsQaM2 zJuh/DQoFbEYMMNZYtGmiqv8ODc15oNPHhdiBLGia/qS6s3QJmDGMhXnjcUa21yul8RUSx zoeW2x3qckEuMapEJScqckvmdUzvzB4bcURUpV0EnNebydpKuVxDkC8Em8p9E7Hab8Q0nc Hl0DleSNzFRNTS+jmqSESkzxniRWYwsDkPBVeEJBdmgwxi9n5BwqSXf87SAjTRw1Y5K9CK 4KBDYoEMglwm+ugeoRIJSzPp/Flt9IgTRAC66YmMGn17vzIkZ1dBIPon5eOVqA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a4ed0eb1aa64d10feaf1e64de39eb07be43a5204 commit a4ed0eb1aa64d10feaf1e64de39eb07be43a5204 Author: Warner Losh AuthorDate: 2022-06-30 18:22:33 +0000 Commit: Warner Losh CommitDate: 2022-07-15 18:00:50 +0000 kboot: Implement symlink(2) Linux's /dev/fd is implemented inside of /proc/self/fd, so we may need to create a symlink to it early in boot. "/dev/fd" and "/dev/std*" might not be strictly required for the boot loader, but should be present for maximum flexibility. Sponsored by: Netflix --- stand/kboot/arch/amd64/syscall_nr.h | 1 + stand/kboot/arch/powerpc64/syscall_nr.h | 1 + stand/kboot/host_syscall.h | 3 +++ stand/kboot/host_syscalls.c | 6 ++++++ 4 files changed, 11 insertions(+) diff --git a/stand/kboot/arch/amd64/syscall_nr.h b/stand/kboot/arch/amd64/syscall_nr.h index 47bb84cc3a36..756b3e93af9a 100644 --- a/stand/kboot/arch/amd64/syscall_nr.h +++ b/stand/kboot/arch/amd64/syscall_nr.h @@ -12,6 +12,7 @@ #define SYS_pselect6 270 #define SYS_read 0 #define SYS_reboot 169 +#define SYS_symlinkat 266 #define SYS_uname 63 #define SYS_write 1 diff --git a/stand/kboot/arch/powerpc64/syscall_nr.h b/stand/kboot/arch/powerpc64/syscall_nr.h index 2b0599b47435..13f26d80f6a3 100644 --- a/stand/kboot/arch/powerpc64/syscall_nr.h +++ b/stand/kboot/arch/powerpc64/syscall_nr.h @@ -13,6 +13,7 @@ #define SYS_pselect6 280 #define SYS_read 3 #define SYS_reboot 88 +#define SYS_symlinkat 295 #define SYS_uname 120 #define SYS_write 4 diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h index 4a3ff3ea818e..3b02f2e78304 100644 --- a/stand/kboot/host_syscall.h +++ b/stand/kboot/host_syscall.h @@ -68,6 +68,8 @@ typedef int64_t host_blkcnt_t; #define HOST_O_APPEND 02000 #define HOST_O_NONBLOCK 04000 +#define HOST_AT_FDCWD -100 /* Relative to current directory */ + /* * Data types */ @@ -104,6 +106,7 @@ int host_reboot(int, int, int, uintptr_t); int host_select(int nfds, long *readfds, long *writefds, long *exceptfds, struct host_timeval *timeout); int host_stat(const char *path, struct host_kstat *sb); +int host_symlink(const char *path1, const char *path2); int host_uname(struct old_utsname *); ssize_t host_write(int fd, const void *buf, size_t nbyte); diff --git a/stand/kboot/host_syscalls.c b/stand/kboot/host_syscalls.c index a83bc3bbfe0d..a69937a5a0e1 100644 --- a/stand/kboot/host_syscalls.c +++ b/stand/kboot/host_syscalls.c @@ -110,6 +110,12 @@ host_stat(const char *path, struct host_kstat *sb) return host_syscall(SYS_newfstatat, HOST_AT_FDCWD, (uintptr_t)path, (uintptr_t)sb, 0); } +int +host_symlink(const char *path1, const char *path2) +{ + return host_syscall(SYS_symlinkat, HOST_AT_FDCWD, path1, path2); +} + int host_uname(struct old_utsname *uts) {