The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a4ed0eb1aa64d10feaf1e64de39eb07be43a5204

commit a4ed0eb1aa64d10feaf1e64de39eb07be43a5204
Author:     Warner Losh <[email protected]>
AuthorDate: 2022-06-30 18:22:33 +0000
Commit:     Warner Losh <[email protected]>
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)
 {

Reply via email to