Fix many error codes in pipes

This commit is contained in:
Ruihan Li
2024-07-01 02:34:55 +08:00
committed by Tate, Hongliang Tian
parent 8e72451448
commit 39cd4420f2
7 changed files with 241 additions and 49 deletions

View File

@ -18,11 +18,11 @@ use crate::{
/// The basic operations defined on a file
pub trait FileLike: Pollable + Send + Sync + Any {
fn read(&self, buf: &mut [u8]) -> Result<usize> {
return_errno_with_message!(Errno::EINVAL, "read is not supported");
return_errno_with_message!(Errno::EBADF, "the file is not valid for reading");
}
fn write(&self, buf: &[u8]) -> Result<usize> {
return_errno_with_message!(Errno::EINVAL, "write is not supported");
return_errno_with_message!(Errno::EBADF, "the file is not valid for writing");
}
/// Read at the given file offset.