/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
undefined4 __pthread_initialize_manager(void)
{
int iVar1;
undefined4 uVar2;
int *piVar3;
void *local_b8;
undefined4 local_b4;
undefined1 auStack_b0 [4];
undefined4 local_ac;
*DAT_00033a64 = 1;
if (__pthread_initial_thread_bos == 0) {
FUN_0001b63c();
}
__pthread_manager_thread_bos = malloc((___pagesize + 0x7ffffff0) * 2) //possible issue identified - semgrep
if (__pthread_manager_thread_bos == (void *)0x0) {
return 0xffffffff;
}
__pthread_manager_thread_tos =
(void *)((int)__pthread_manager_thread_bos + (___pagesize + 0x7ffffff0) * 2);
iVar1 = pipe((int *)&local_b8) //possible issue identified - semgrep
if (iVar1 == -1) {
free(__pthread_manager_thread_bos);
return 0xffffffff;
}
if (__linuxthreads_initial_report_events != 0) {
DAT_000311dc = __linuxthreads_initial_report_events;
}
if ((DAT_000311dc != 0) && (((__pthread_threads_events | DAT_000311e0) & 0x80) != 0)) {
__pthread_lock(PTR___pthread_handles_16__0003123c,0);
iVar1 = clone(__pthread_manager_event,__pthread_manager_thread_tos,0xf00,local_b8);
if (iVar1 != -1) {
DAT_000313c8 = 8;
__pthread_last_event = &__pthread_manager_thread;
DAT_00031230 = 0x801;
DAT_000313cc = &__pthread_manager_thread;
DAT_00031234 = iVar1;
__linuxthreads_create_event();
}
__pthread_unlock(PTR___pthread_handles_16__0003123c);
if (iVar1 != 0) goto LAB_0001ba6c;
}
iVar1 = clone(__pthread_manager,__pthread_manager_thread_tos,0xf00,local_b8);
LAB_0001ba6c:
if (iVar1 == -1) {
free(__pthread_manager_thread_bos);
__libc_close(local_b8);
__libc_close(local_b4);
return 0xffffffff;
}
__pthread_manager_request = local_b4;
__pthread_manager_reader = (int)local_b8;
DAT_00031230 = 0x801;
DAT_00031234 = iVar1;
if ((__pthread_threads_debug != 0) && (0 < __pthread_sig_debug)) {
raise(__pthread_sig_debug);
uVar2 = FUN_0001ae14();
__pthread_wait_for_restart_signal(uVar2);
}
local_ac = 5;
do {
iVar1 = __libc_write(__pthread_manager_request,auStack_b0,0x94);
if (iVar1 != -1) {
return 0;
}
piVar3 = __errno_location();
} while (*piVar3 == 4);
return 0;
}