================ @@ -0,0 +1,45 @@ +#include <iostream> +#include <thread> +#include <unistd.h> +#include <vector> + +int call_vfork() { + printf("Before vfork\n"); + + pid_t child_pid = vfork(); + + if (child_pid == -1) { + // Error handling + perror("vfork"); + return 1; + } else if (child_pid == 0) { + // This code is executed by the child process + printf("Child process\n"); + _exit(0); // Exit the child process + } else { + // This code is executed by the parent process + printf("Parent process\n"); ---------------- clayborg wrote:
Add the pid to the global vector: ``` printf("Parent process\n"); std::lock_guard<std::mutex> Lock(g_child_pids_mutex); g_child_pids.append(child_pid); ``` https://github.com/llvm/llvm-project/pull/81564 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits