Ensure gettid == getpid Currently FEX doesn't maintain that gettid == getpid. This is noticed by some applications and confuses them. We should ensure that the guest application's primary thread is FEX's primary thread. The frontend should spin off its own worker threads instead. Alternatively we can return the primary's guest thread's tid for the getpid syscall, but I think that may cause issues in some cases? ```cpp #include #include int main() { pid_t pid = getpid(); pid_t tid = gettid(); if (pid != tid) { printf("FAIL! Something is mucking with us! pid != tid ; %d != %d\n", pid, tid); } else { printf("SUCCESS! TID == PID\n"); } return 0; } ``` Real environment ```bash ryanh@Ryan-TR2:~$ ./a.out SUCCESS! TID == PID ``` FEX ```bash ryanh@Ryan-TR2:~/work/FEXNew/Build$ ./Bin/ELFLoader -U -c irjit -n 500 -- ~/a.out [DEBUG] We installed 2314 instructions to the tables [DEBUG] Precompiling: 0 blocks... [DEBUG] Done FAIL! Something is mucking with us! pid != tid ; 30155 != 30157 [DEBUG] Reason we left VM: 3 [DEBUG] Used 1455012 bytes for compiling [DEBUG] Managed to load? No ```