pub(super) fn task_drop_common<T: Task>(t: &T) {
    log!(LogDebug, "task {} (rec:{}) is dying ...", t.tid, t.rec_tid);

    t.fallible_ptrace(PTRACE_DETACH, RemotePtr::null(), PtraceData::None);

    if t.unstable.get() {
        log!(
            LogWarn,
            "{} is unstable; not blocking on its termination",
            t.tid
        );
        // This will probably leak a zombie process for rd's lifetime.

        // Destroying a Session may result in unstable exits during which
        // destroy_buffers() will not have been called.
        if !t.syscallbuf_child.is_null() {
            t.vm_shr_ptr()
                .unmap(t, RemotePtr::cast(t.syscallbuf_child), t.syscallbuf_size);
        }
    } else {
        ed_assert!(t, t.seen_ptrace_exit_event);
        ed_assert!(t, t.syscallbuf_child.is_null());

        if t.thread_group().task_set().is_empty() && !t.session().is_recording() {
            // Reap the zombie.
            let ret = unsafe { waitpid(t.thread_group().real_tgid, ptr::null_mut(), __WALL) };
            if ret == -1 {
                ed_assert!(t, errno() == ECHILD || errno() == ESRCH);
            } else {
                ed_assert_eq!(t, ret, t.thread_group().real_tgid);
            }
        }
    }

    // Session Rc may be getting drop()-ed so we may not have access to it
    // via weak pointer
    t.try_session().map(|sess| sess.on_destroy_task(t.tuid()));
    t.thread_group_shr_ptr()
        .borrow_mut()
        .task_set_mut()
        .erase(t.weak_self_ptr());
    t.vm_shr_ptr().task_set_mut().erase(t.weak_self_ptr());
    t.fd_table_shr_ptr()
        .borrow_mut()
        .task_set_mut()
        .erase(t.weak_self_ptr());

    log!(LogDebug, "  dead");
}
/// Takes sess as a param because sess might be in the process of
/// getting drop()-ed. Calling t.session() will not be a good idea
/// in this case because the weak point upgrade will fail as the
/// session is gettng dropped.
Takes sess as a param because sess might be in the process of
getting drop()-ed. Calling t.session() will not be a good idea
in this case because the weak point upgrade will fail as the
session is gettng dropped.
Takes sess as a param because sess might be in the process of getting drop () - ed . Calling t . session () will not be a good idea in this case because the weak point upgrade will fail as the session is gettng dropped .
pub(super) fn task_drop_common<T: Task>(t: &T) {
    log!(LogDebug, "task {} (rec:{}) is dying ...", t.tid, t.rec_tid);
    t.fallible_ptrace(PTRACE_DETACH, RemotePtr::null(), PtraceData::None);
    if t.unstable.get() {
        log!(
            LogWarn,
            "{} is unstable; not blocking on its termination",
            t.tid
        );
        // This will probably leak a zombie process for rd's lifetime.
        // Destroying a Session may result in unstable exits during which
        // destroy_buffers() will not have been called.
        if !t.syscallbuf_child.is_null() {
            t.vm_shr_ptr()
                .unmap(t, RemotePtr::cast(t.syscallbuf_child), t.syscallbuf_size);
        }
    } else {
        ed_assert!(t, t.seen_ptrace_exit_event);
        ed_assert!(t, t.syscallbuf_child.is_null());
        if t.thread_group().task_set().is_empty() && !t.session().is_recording() {
            // Reap the zombie.
            let ret = unsafe { waitpid(t.thread_group().real_tgid, ptr::null_mut(), __WALL) };
            if ret == -1 {
                ed_assert!(t, errno() == ECHILD || errno() == ESRCH);
            } else {
                ed_assert_eq!(t, ret, t.thread_group().real_tgid);
            }
        }
    }
    // Session Rc may be getting drop()-ed so we may not have access to it
    // via weak pointer
    t.try_session().map(|sess| sess.on_destroy_task(t.tuid()));
    t.thread_group_shr_ptr()
        .borrow_mut()
        .task_set_mut()
        .erase(t.weak_self_ptr());
    t.vm_shr_ptr().task_set_mut().erase(t.weak_self_ptr());
    t.fd_table_shr_ptr()
        .borrow_mut()
        .task_set_mut()
        .erase(t.weak_self_ptr());
    log!(LogDebug, "  dead");
}
pub ( super ) fn task_drop_common < T : Task > ( t : & T ) { log ! ( LogDebug " " t tid t rec_tid ) ; t . fallible_ptrace ( PTRACE_DETACH , RemotePtr :: null ( ) , PtraceData :: None ) ; if t . unstable . get ( ) { log ! ( LogWarn " " t tid ) ; // This will probably leak a zombie process for rd's lifetime. // Destroying a Session may result in unstable exits during which // destroy_buffers() will not have been called. if ! t . syscallbuf_child . is_null ( ) { t . vm_shr_ptr ( ) . unmap ( t , RemotePtr :: cast ( t . syscallbuf_child ) , t . syscallbuf_size ) ; } } else { ed_assert ! ( t t seen_ptrace_exit_event ) ; ed_assert ! ( t t syscallbuf_child is_null ( ) ) ; if t . thread_group ( ) . task_set ( ) . is_empty ( ) && ! t . session ( ) . is_recording ( ) { // Reap the zombie. let ret = unsafe { waitpid ( t . thread_group ( ) . real_tgid , ptr :: null_mut ( ) , __WALL ) } ; if ret == - 1 { ed_assert ! ( t errno ( ) ECHILD errno ( ) ESRCH ) ; } else { ed_assert_eq ! ( t ret t thread_group ( ) real_tgid ) ; } } } // Session Rc may be getting drop()-ed so we may not have access to it // via weak pointer t . try_session ( ) . map ( | sess | sess . on_destroy_task ( t . tuid ( ) ) ) ; t . thread_group_shr_ptr ( ) . borrow_mut ( ) . task_set_mut ( ) . erase ( t . weak_self_ptr ( ) ) ; t . vm_shr_ptr ( ) . task_set_mut ( ) . erase ( t . weak_self_ptr ( ) ) ; t . fd_table_shr_ptr ( ) . borrow_mut ( ) . task_set_mut ( ) . erase ( t . weak_self_ptr ( ) ) ; log ! ( LogDebug " " ) ; }
Takes sess as a param because sess might be in the process of
getting drop()-ed.
Takes sess as a param because sess might be in the process of getting drop () - ed .
t
&T