Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linux/linux_fork.c
Show First 20 Lines • Show All 401 Lines • ▼ Show 20 Lines | LINUX_CTR3(set_tid_address, "tidptr(%d) %p, returns %d", | ||||
em->em_tid, args->tidptr, td->td_retval[0]); | em->em_tid, args->tidptr, td->td_retval[0]); | ||||
return (0); | return (0); | ||||
} | } | ||||
void | void | ||||
linux_thread_detach(struct thread *td) | linux_thread_detach(struct thread *td) | ||||
{ | { | ||||
struct linux_sys_futex_args cup; | |||||
struct linux_emuldata *em; | struct linux_emuldata *em; | ||||
int *child_clear_tid; | int *child_clear_tid; | ||||
int error; | int error; | ||||
em = em_find(td); | em = em_find(td); | ||||
KASSERT(em != NULL, ("thread_detach: emuldata not found.\n")); | KASSERT(em != NULL, ("thread_detach: emuldata not found.\n")); | ||||
LINUX_CTR1(thread_detach, "thread(%d)", em->em_tid); | LINUX_CTR1(thread_detach, "thread(%d)", em->em_tid); | ||||
release_futexes(td, em); | release_futexes(td, em); | ||||
child_clear_tid = em->child_clear_tid; | child_clear_tid = em->child_clear_tid; | ||||
if (child_clear_tid != NULL) { | if (child_clear_tid != NULL) { | ||||
LINUX_CTR2(thread_detach, "thread(%d) %p", | LINUX_CTR2(thread_detach, "thread(%d) %p", | ||||
em->em_tid, child_clear_tid); | em->em_tid, child_clear_tid); | ||||
error = suword32(child_clear_tid, 0); | error = suword32(child_clear_tid, 0); | ||||
if (error != 0) | if (error != 0) | ||||
return; | return; | ||||
cup.uaddr = child_clear_tid; | error = futex_wake(td, child_clear_tid, 1, false); | ||||
cup.op = LINUX_FUTEX_WAKE; | |||||
cup.val = 1; /* wake one */ | |||||
cup.timeout = NULL; | |||||
cup.uaddr2 = NULL; | |||||
cup.val3 = 0; | |||||
error = linux_sys_futex(td, &cup); | |||||
/* | /* | ||||
* this cannot happen at the moment and if this happens it | * this cannot happen at the moment and if this happens it | ||||
* probably means there is a user space bug | * probably means there is a user space bug | ||||
*/ | */ | ||||
if (error != 0) | if (error != 0) | ||||
linux_msg(td, "futex stuff in thread_detach failed."); | linux_msg(td, "futex stuff in thread_detach failed."); | ||||
} | } | ||||
} | } |