diff --git a/src/header/unistd/mod.rs b/src/header/unistd/mod.rs
index 7e2b935b5b4680d76b80f2572569150f577cd8ef..98b4ec6ba86cf75b4a880b1897be462f0cb493a4 100644
--- a/src/header/unistd/mod.rs
+++ b/src/header/unistd/mod.rs
@@ -421,7 +421,12 @@ pub extern "C" fn pause() -> c_int {
 
 #[no_mangle]
 pub unsafe extern "C" fn pipe(fildes: *mut c_int) -> c_int {
-    Sys::pipe(slice::from_raw_parts_mut(fildes, 2))
+    pipe2(fildes, 0)
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn pipe2(fildes: *mut c_int, flags: c_int) -> c_int {
+    Sys::pipe2(slice::from_raw_parts_mut(fildes, 2), flags)
 }
 
 #[no_mangle]
diff --git a/src/platform/linux/mod.rs b/src/platform/linux/mod.rs
index a92776c9a5fc42b242526c595f15ef3e32410821..af4a1115ed5763b270d3527faf81788703cf3b30 100644
--- a/src/platform/linux/mod.rs
+++ b/src/platform/linux/mod.rs
@@ -315,8 +315,8 @@ impl Pal for Sys {
         e(unsafe { syscall!(OPENAT, AT_FDCWD, path.as_ptr(), oflag, mode) }) as c_int
     }
 
-    fn pipe(fildes: &mut [c_int]) -> c_int {
-        e(unsafe { syscall!(PIPE2, fildes.as_mut_ptr(), 0) }) as c_int
+    fn pipe2(fildes: &mut [c_int], flags: c_int) -> c_int {
+        e(unsafe { syscall!(PIPE2, fildes.as_mut_ptr(), flags) }) as c_int
     }
 
     #[cfg(target_arch = "x86_64")]
diff --git a/src/platform/pal/mod.rs b/src/platform/pal/mod.rs
index a3d55f53753567eb4e017b91c5f471ec7d19122a..8c542b3a14bdcf45385be22b9eb1cf3675ddf9b2 100644
--- a/src/platform/pal/mod.rs
+++ b/src/platform/pal/mod.rs
@@ -114,7 +114,7 @@ pub trait Pal {
 
     fn open(path: &CStr, oflag: c_int, mode: mode_t) -> c_int;
 
-    fn pipe(fildes: &mut [c_int]) -> c_int;
+    fn pipe2(fildes: &mut [c_int], flags: c_int) -> c_int;
 
     unsafe fn pte_clone(stack: *mut usize) -> pid_t;
 
diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs
index 272f18903417e69a33a425a29cde1fbe0330f638..b3293534f75d85a6d4a31d486643de1164195348 100644
--- a/src/platform/redox/mod.rs
+++ b/src/platform/redox/mod.rs
@@ -679,9 +679,9 @@ impl Pal for Sys {
         )) as c_int
     }
 
-    fn pipe(fds: &mut [c_int]) -> c_int {
+    fn pipe(fds: &mut [c_int], flags: c_int) -> c_int {
         let mut usize_fds: [usize; 2] = [0; 2];
-        let res = e(syscall::pipe2(&mut usize_fds, 0));
+        let res = e(syscall::pipe2(&mut usize_fds, flags as usize));
         fds[0] = usize_fds[0] as c_int;
         fds[1] = usize_fds[1] as c_int;
         res as c_int