From nobody Tue Jan 24 22:10:59 2023 X-Original-To: dev-commits-src-branches@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 4P1h4h0llKz3bdwk; Tue, 24 Jan 2023 22:11: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 4P1h4g6K2Vz4M5R; Tue, 24 Jan 2023 22:10:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598260; 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=/mOdwmOiYIyZ7+X+2twtUK5jNYKHnRHHeMcLi+4BULc=; b=Ive0QE8BdyY5L/X6FrZfclLmFT29KdQt7Fv1AWdLJQ1pdx0wI7SF2/AWb7/zSRjYDEYGG4 AazB/MvOuvG8tZ2yaTuaifTAJkAoY8DRPp2EDdVJ6yFxW2MHTA+JYf0AX2gEMdnu0FDdPc 6y6oDQyY64kJxX58SRpeh9nYHHAI8hUQIXaqkqv8WjJBfYDVZKr5pmJIzU4UuF8jMvjzSu dcDQFL0s9J0JGaVzE2HTXDh9f7FHgban9BjXRbkNLMSv2jfmd9AtrPX1UQBHq3G+ef9dqI srdVJblBA2w6E16lOLHhnkpA/fxX4pvDIguWfafByeS0GRSVOvMzevqu4MTqiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598260; 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=/mOdwmOiYIyZ7+X+2twtUK5jNYKHnRHHeMcLi+4BULc=; b=ev+X4b5M1Z2MDct8DVDD2zoeZRXQLpPgWKow1b5lImgffkGy3ku/2AjeA6C6pL8I+IHtJi tsE9Q922vc30wsa2qNNEKh5WviznKZyWBrkrNXzTNK31IRyfrdUy7qe4hbbbLgkUth8cS3 A6jIxLKDT542Jow3gEsIfH2QLRfqp+GyDGfte+sI1WTuLm1CLzzHUE1Z6j7OlrPnn5qvWb GD8ytC48KRvNAREe/xXTcldUuXLCQQUY58qTasltbEheCvd7xpC8gDq9NR5+YQ4LhZCdVK 8dQbfDFKLC7M3Zmqua4SoeBlABwIFaTf0sPjD58AJ123wIeffuIbFDZllVUGZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674598260; a=rsa-sha256; cv=none; b=DL6SECARSD15qQtM/8+nI6K3CxC3jMOTmtJI1mEorz7T/xGGtq5pyJ9t+ANfG9XxKZAWlS p7JQCyFnMjRCzt0iLRFYOFX+nCHGNrnftiKf45PVmGXPkadWevpegLJTK55lf9bIBjGSKH w/agpsNjI7y40iLqyOewTutnn5WRzJfdv8rqTluNJTARMh3nqEDRycJFMCdoJqsKN2iNGz NvZKqL95NsqsuZOQ/PH3sPMJd+GJO8WenA4A9r0cTe3AxNA+gUjX1aJX/yLCyA/ZhRegOd HwhNd/ORO8l9RbXiZVFcfLPfQzoAsOgTr8KaCrx9dsbaI0+caOR2k24jDpkoxQ== 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 4P1h4g4TFfzQNp; Tue, 24 Jan 2023 22:10:59 +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 30OMAxRB083289; Tue, 24 Jan 2023 22:10:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OMAxMp083288; Tue, 24 Jan 2023 22:10:59 GMT (envelope-from git) Date: Tue, 24 Jan 2023 22:10:59 GMT Message-Id: <202301242210.30OMAxMp083288@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 4f1ca9317bbc - stable/13 - kboot: Implement symlink(2) List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4f1ca9317bbc0677f5ff82e4f0ae3a422f9c7229 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4f1ca9317bbc0677f5ff82e4f0ae3a422f9c7229 commit 4f1ca9317bbc0677f5ff82e4f0ae3a422f9c7229 Author: Warner Losh AuthorDate: 2022-06-30 18:22:33 +0000 Commit: Warner Losh CommitDate: 2023-01-24 21:49:24 +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 (cherry picked from commit a4ed0eb1aa64d10feaf1e64de39eb07be43a5204) --- 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) {