]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/posix-process: Migrate tid2pprocess / tid2pthread to process.h
authorMichalis Pappas <michalis@unikraft.io>
Thu, 4 Jan 2024 09:46:12 +0000 (10:46 +0100)
committerUnikraft Bot <monkey@unikraft.io>
Fri, 17 Jan 2025 14:59:21 +0000 (14:59 +0000)
Migrate the definitions of tid2pthread() and tid2pprocess() to
the private process.h to make them available to the rest of the
library. This requires to additionally migrate the definitions of
struct posix_process() and struct posix_thread().

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

lib/posix-process/process.c
lib/posix-process/process.h

index d38e0d1592d8bf1d471c268a0af681fd46413af8..fbc85d6f923b4e13ca541ffcc3ccb30ea5a8a88d 100644 (file)
@@ -40,8 +40,6 @@
 #include <uk/config.h>
 #include <uk/syscall.h>
 
-#define TIDMAP_SIZE (CONFIG_LIBPOSIX_PROCESS_MAX_PID + 1)
-
 #if CONFIG_LIBPOSIX_PROCESS_PIDS
 #include <uk/bitmap.h>
 #include <uk/list.h>
 
 #include "process.h"
 
-/**
- * Internal structures
- */
-struct posix_process {
-       pid_t pid;
-       struct posix_process *parent;
-       struct uk_list_head children; /* child processes */
-       struct uk_list_head child_list_entry;
-       struct uk_list_head threads;
-       struct uk_alloc *_a;
-
-       /* TODO: Mutex */
-};
-
-struct posix_thread {
-       pid_t tid;
-       struct posix_process *process;
-       struct uk_list_head thread_list_entry;
-       struct uk_thread *thread;
-       struct uk_alloc *_a;
-
-       /* TODO: Mutex */
-};
-
 /**
  * System global lists
  * NOTE: We pre-allocate PID/TID 0 which is reserved by the kernel.
@@ -461,14 +435,14 @@ static void posix_thread_fini(struct uk_thread *child)
 
 UK_THREAD_INIT_PRIO(posix_thread_init, posix_thread_fini, UK_PRIO_EARLIEST);
 
-static inline struct posix_thread *tid2pthread(pid_t tid)
+struct posix_thread *tid2pthread(pid_t tid)
 {
        if ((__sz)tid >= ARRAY_SIZE(tid_thread) || tid < 0)
                return NULL;
        return tid_thread[tid];
 }
 
-static inline struct posix_process *tid2pprocess(pid_t tid)
+struct posix_process *tid2pprocess(pid_t tid)
 {
        struct posix_thread *pthread;
 
index e893900ab9b1db15f6ff4ef1e00f8fee09252f71..28560470cca1c5d255fcf0ee2d44a691bed19b70 100644 (file)
 #include <uk/thread.h>
 #endif /* CONFIG_LIBPOSIX_PROCESS_PIDS */
 
+#define TIDMAP_SIZE (CONFIG_LIBPOSIX_PROCESS_MAX_PID + 1)
+
+struct posix_process {
+       pid_t pid;
+       struct posix_process *parent;
+       struct uk_list_head children; /* child processes */
+       struct uk_list_head child_list_entry;
+       struct uk_list_head threads;
+       struct uk_alloc *_a;
+
+       /* TODO: Mutex */
+};
+
+struct posix_thread {
+       pid_t tid;
+       struct posix_process *process;
+       struct uk_list_head thread_list_entry;
+       struct uk_thread *thread;
+       struct uk_alloc *_a;
+
+       /* TODO: Mutex */
+};
+
 #if CONFIG_LIBPOSIX_PROCESS_PIDS
 struct uk_thread *tid2ukthread(pid_t tid);
+struct posix_thread *tid2pthread(pid_t tid);
+struct posix_process *tid2pprocess(pid_t tid);
 pid_t ukthread2tid(struct uk_thread *thread);
 pid_t ukthread2pid(struct uk_thread *thread);
 #endif /* CONFIG_LIBPOSIX_PROCESS_PIDS */