Rename autoclose_pipes_t to AutoClosePipes

This commit is contained in:
Johannes Altmanninger 2023-04-22 19:15:17 +02:00
parent 48e728e9fb
commit 05ec1039ed
2 changed files with 6 additions and 6 deletions

View File

@ -139,7 +139,7 @@ impl Drop for AutoCloseFd {
/// Helper type returned from make_autoclose_pipes.
#[derive(Default)]
pub struct autoclose_pipes_t {
pub struct AutoClosePipes {
/// Read end of the pipe.
pub read: AutoCloseFd,
@ -149,7 +149,7 @@ pub struct autoclose_pipes_t {
/// Construct a pair of connected pipes, set to close-on-exec.
/// \return None on fd exhaustion.
pub fn make_autoclose_pipes() -> Option<autoclose_pipes_t> {
pub fn make_autoclose_pipes() -> Option<AutoClosePipes> {
let pipes = ffi::make_pipes_ffi();
let readp = AutoCloseFd::new(pipes.read);
@ -157,7 +157,7 @@ pub fn make_autoclose_pipes() -> Option<autoclose_pipes_t> {
if !readp.is_valid() || !writep.is_valid() {
None
} else {
Some(autoclose_pipes_t {
Some(AutoClosePipes {
read: readp,
write: writep,
})

View File

@ -21,7 +21,7 @@ set. This is the real power of topics: you can wait for a sigchld signal OR a th
*/
use crate::fd_readable_set::fd_readable_set_t;
use crate::fds::{self, autoclose_pipes_t};
use crate::fds::{self, AutoClosePipes};
use crate::ffi::{self as ffi, c_int};
use crate::flog::{FloggableDebug, FLOG};
use crate::wchar::{widestrs, wstr, WString};
@ -184,7 +184,7 @@ pub struct binary_semaphore_t {
sem_: Pin<Box<UnsafeCell<libc::sem_t>>>,
// Pipes used to emulate a semaphore, if not initialized.
pipes_: autoclose_pipes_t,
pipes_: AutoClosePipes,
}
impl binary_semaphore_t {
@ -194,7 +194,7 @@ impl binary_semaphore_t {
// sem_t does not have an initializer in Rust so we use zeroed().
#[allow(unused_mut)]
let mut sem_ = Pin::from(Box::new(UnsafeCell::new(unsafe { mem::zeroed() })));
let mut pipes_ = autoclose_pipes_t::default();
let mut pipes_ = AutoClosePipes::default();
// sem_init always fails with ENOSYS on Mac and has an annoying deprecation warning.
// On BSD sem_init uses a file descriptor under the hood which doesn't get CLOEXEC (see #7304).
// So use fast semaphores on Linux only.