MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / pipe

Function pipe

src/backend/linux_raw/pipe/syscalls.rs:18–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17#[inline]
18pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
19 // aarch64 and risc64 omit `__NR_pipe`. On mips, `__NR_pipe` uses a special
20 // calling convention, but using it is not worth complicating our syscall
21 // wrapping infrastructure at this time.
22 #[cfg(any(
23 target_arch = "aarch64",
24 target_arch = "mips",
25 target_arch = "mips32r6",
26 target_arch = "mips64",
27 target_arch = "mips64r6",
28 target_arch = "riscv64",
29 ))]
30 {
31 pipe_with(PipeFlags::empty())
32 }
33 #[cfg(not(any(
34 target_arch = "aarch64",
35 target_arch = "mips",
36 target_arch = "mips32r6",
37 target_arch = "mips64",
38 target_arch = "mips64r6",
39 target_arch = "riscv64",
40 )))]
41 unsafe {
42 let mut result = MaybeUninit::<[OwnedFd; 2]>::uninit();
43 ret(syscall!(__NR_pipe, &mut result))?;
44 let [p0, p1] = result.assume_init();
45 Ok((p0, p1))
46 }
47}
48
49#[inline]
50pub(crate) fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> {

Callers

nothing calls this directly

Calls 3

assume_initMethod · 0.80
pipe_withFunction · 0.70
retFunction · 0.50

Tested by

no test coverage detected