Improved pipe scheme.

This commit is contained in:
4lDO2
2023-06-21 16:30:01 +02:00
parent 7269f9c6f1
commit 5abf16a51e
3 changed files with 211 additions and 202 deletions
+6 -5
View File
@@ -91,16 +91,17 @@ pub fn open(path: &str, flags: usize) -> Result<FileHandle> {
pub fn pipe2(fds: &mut [usize], flags: usize) -> Result<usize> {
if fds.len() < 2 {
return Err(Error::new(EFAULT));
return Err(Error::new(EINVAL));
}
let scheme_id = crate::scheme::pipe::pipe_scheme_id().ok_or(Error::new(ENODEV))?;
let (read_id, write_id) = crate::scheme::pipe::pipe(flags);
let scheme_id = crate::scheme::pipe::pipe_scheme_id();
let (read_id, write_id) = crate::scheme::pipe::pipe(flags)?;
let contexts = context::contexts();
let context_lock = contexts.current().ok_or(Error::new(ESRCH))?;
let context_lock = context::current()?;
let context = context_lock.read();
//log::warn!("Context {} used deprecated pipe2.", context.name);
let read_fd = context.add_file(FileDescriptor {
description: Arc::new(RwLock::new(FileDescription {
namespace: context.ens,