diff --git a/bash-5.1/r_execute_cmd/src/lib.rs b/bash-5.1/r_execute_cmd/src/lib.rs index 1c2f1a048da21f95e1d33dbef98393a16160c9b7..fe0106882d8b9d8bd2552a8c1d6a6b0cb77cc299 100644 --- a/bash-5.1/r_execute_cmd/src/lib.rs +++ b/bash-5.1/r_execute_cmd/src/lib.rs @@ -1895,8 +1895,40 @@ pub unsafe extern "C" fn coproc_dispose(mut cp: *mut coproc) { UNBLOCK_SIGNAL!(oset); } +#[no_mangle] +pub unsafe extern "C" fn coproc_flush() { + coproc_dispose(&mut sh_coproc); +} +#[no_mangle] +pub unsafe extern "C" fn coproc_close(mut cp: *mut coproc) { + if (*cp).c_rfd >= 0 { + close((*cp).c_rfd); + (*cp).c_rfd = -1; + } + if (*cp).c_wfd >= 0 { + close((*cp).c_wfd); + (*cp).c_wfd = -1; + } + let ref mut fresh27 = (*cp).c_wsave; + (*cp).c_wsave = -1; + (*cp).c_rsave = -1; +} +#[no_mangle] +pub unsafe extern "C" fn coproc_closeall() { + coproc_close(&mut sh_coproc); +} + +#[no_mangle] +pub unsafe extern "C" fn coproc_reap() { + let mut cp: *mut coproc = 0 as *mut coproc; + + cp = &mut sh_coproc; + if !cp.is_null() && (*cp).c_flags & COPROC_DEAD as libc::c_int != 0 { + coproc_dispose(cp); + } +}