]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/posix-process: Define kernel internal `getpid`
authorSergiu Moga <sergiu@unikraft.io>
Fri, 7 Feb 2025 09:35:04 +0000 (11:35 +0200)
committerUnikraft Bot <monkey@unikraft.io>
Fri, 14 Feb 2025 14:16:47 +0000 (14:16 +0000)
Add the kernel internal variant of `getpid`, `uk_sys_getpid`. This
allows kernel internal code to call this system call's logic without
having the syscall shim wrapper logic intervene.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Andrei Tatar <andrei@unikraft.io>
GitHub-Closes: #1583

lib/posix-process/exportsyms.uk
lib/posix-process/include/uk/process.h
lib/posix-process/process.c

index d44e781bb442531f8a79c4305845291b2c595b1e..18dc25a074ee90e25b6f9fba027866093f294fbd 100644 (file)
@@ -30,6 +30,7 @@ wait3
 wait4
 waitpid
 waitid
+uk_sys_getpid
 getpid
 uk_sys_getppid
 getppid
index decd79a2d2165407892ae3a837197ee8d2759ae3..63e926daa0a05c9fcada1f71294428bae99a658d 100644 (file)
@@ -149,6 +149,7 @@ static inline int uk_sys_setrlimit(int resource, const struct rlimit *rlim)
 
 pid_t uk_sys_gettid(void);
 pid_t uk_sys_getppid(void);
+pid_t uk_sys_getpid(void);
 
 #if CONFIG_LIBUKSCHED
 int uk_posix_process_create(struct uk_alloc *a,
index bfab83f7fd387c413cced11b83ae3722f92daa81..2a63366c4ed7e9ef329812f9ebb05108e39dd4db 100644 (file)
@@ -530,7 +530,7 @@ pid_t ukthread2pid(struct uk_thread *thread)
        return pthread->process->pid;
 }
 
-UK_SYSCALL_R_DEFINE(pid_t, getpid)
+pid_t uk_sys_getpid(void)
 {
        if (!pthread_self)
                return -ENOTSUP;
@@ -655,7 +655,7 @@ UK_POSIX_CLONE_HANDLER(CLONE_THREAD, false, pprocess_clone_thread, 0x0);
 #define UNIKRAFT_TID      1
 #define UNIKRAFT_PPID     0
 
-UK_SYSCALL_R_DEFINE(int, getpid)
+pid_t uk_sys_getpid(void)
 {
        return UNIKRAFT_PID;
 }
@@ -681,3 +681,8 @@ UK_SYSCALL_R_DEFINE(pid_t, getppid)
 {
        return uk_sys_getppid();
 }
+
+UK_SYSCALL_R_DEFINE(pid_t, getpid)
+{
+       return uk_sys_getpid();
+}