The branch main has been updated by imp:

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

commit 764780294f1df220174c1eb2208c0774d685d594
Author:     Warner Losh <[email protected]>
AuthorDate: 2022-06-30 18:12:51 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2022-07-15 18:00:50 +0000

    kboot: Implement getpid(2)
    
    Add host_getpid() so we can know if we're running as init(8) or not.  If
    we are, we may chose to do early system setup / sanity operations.
    
    Sponsored by:           Netflix
---
 stand/kboot/arch/amd64/syscall_nr.h     | 1 +
 stand/kboot/arch/powerpc64/syscall_nr.h | 1 +
 stand/kboot/host_syscall.h              | 1 +
 stand/kboot/host_syscalls.c             | 6 ++++++
 4 files changed, 9 insertions(+)

diff --git a/stand/kboot/arch/amd64/syscall_nr.h 
b/stand/kboot/arch/amd64/syscall_nr.h
index 7813eff92890..47bb84cc3a36 100644
--- a/stand/kboot/arch/amd64/syscall_nr.h
+++ b/stand/kboot/arch/amd64/syscall_nr.h
@@ -1,5 +1,6 @@
 #define SYS_close                3
 #define SYS_getdents            78
+#define        SYS_getpid               39
 #define SYS_gettimeofday        96
 #define SYS_kexec_load         246
 #define SYS_lseek                8
diff --git a/stand/kboot/arch/powerpc64/syscall_nr.h 
b/stand/kboot/arch/powerpc64/syscall_nr.h
index 9471fd48ceb2..2b0599b47435 100644
--- a/stand/kboot/arch/powerpc64/syscall_nr.h
+++ b/stand/kboot/arch/powerpc64/syscall_nr.h
@@ -1,6 +1,7 @@
 #define SYS_close                6
 #define SYS_fstat              108
 #define SYS_getdents           141
+#define        SYS_getpid               20
 #define SYS_gettimeofday        78
 #define SYS_kexec_load         268
 #define SYS_llseek             140
diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h
index 8007f29feb9d..4a3ff3ea818e 100644
--- a/stand/kboot/host_syscall.h
+++ b/stand/kboot/host_syscall.h
@@ -92,6 +92,7 @@ struct host_timeval {
 int host_close(int fd);
 int host_fstat(int fd, struct host_kstat *sb);
 int host_getdents(int fd, void *dirp, int count);
+int host_getpid(void);
 int host_gettimeofday(struct host_timeval *a, void *b);
 int host_kexec_load(uint32_t start, int nsegs, uint32_t segs, uint32_t flags);
 ssize_t host_llseek(int fd, int32_t offset_high, int32_t offset_lo, uint64_t 
*result, int whence);
diff --git a/stand/kboot/host_syscalls.c b/stand/kboot/host_syscalls.c
index 3cfccdc0c718..a83bc3bbfe0d 100644
--- a/stand/kboot/host_syscalls.c
+++ b/stand/kboot/host_syscalls.c
@@ -25,6 +25,12 @@ host_getdents(int fd, void *dirp, int count)
        return host_syscall(SYS_getdents, fd, (uintptr_t)dirp, count);
 }
 
+int
+host_getpid(void)
+{
+       return host_syscall(SYS_getpid);
+}
+
 int
 host_gettimeofday(struct host_timeval *a, void *b)
 {

Reply via email to