]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/posix-process: Add posix_thread parent
authorMichalis Pappas <michalis@unikraft.io>
Tue, 16 Apr 2024 09:44:51 +0000 (11:44 +0200)
committerUnikraft Bot <monkey@unikraft.io>
Fri, 17 Jan 2025 14:59:21 +0000 (14:59 +0000)
Add a field to posix_thread to keep track of its parent. This is
populated during the creation of a posix_thread, and it is used
for deriving the parent's state in execve() / exit().

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 fbc85d6f923b4e13ca541ffcc3ccb30ea5a8a88d..f3aed6f408e338af71fd8605325eb5c60d5751a6 100644 (file)
@@ -33,6 +33,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+
 #include <uk/config.h>
 #include <sys/types.h>
 #include <stddef.h>
@@ -250,6 +251,8 @@ int uk_posix_process_create(struct uk_alloc *a,
                        pprocess_release(orig_pprocess);
        }
 
+       (*pthread)->parent = parent_pthread;
+
        pprocess->parent = parent_pprocess;
        if (parent_pprocess) {
                uk_list_add_tail(&pprocess->child_list_entry,
index 0e60fe3715f4abb5f5c7a56288bed4f830d47150..fb313e05972ec2af8e9e70bad921c81e41592040 100644 (file)
@@ -70,6 +70,7 @@ struct posix_process {
 struct posix_thread {
        pid_t tid;
        struct posix_process *process;
+       struct posix_thread *parent;
        struct uk_list_head thread_list_entry;
        struct uk_thread *thread;
        struct uk_alloc *_a;