v2/guest: Add support for FIONREAD ioctl
@@ -12,7 +12,7 @@ use core::slice;
use libc::{
c_int, c_uint, c_ulong, c_void, clockid_t, epoll_event, gid_t, off_t, pid_t, pollfd, sigaction,
sigset_t, size_t, stack_t, stat, timespec, uid_t, utsname, EBADFD, EFAULT, EINVAL, ENOSYS,
- ENOTSUP, ENOTTY, FIONBIO, STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO, TIOCGWINSZ,
+ ENOTSUP, ENOTTY, FIONBIO, FIONREAD, STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO, TIOCGWINSZ,
};
pub trait Execute {
@@ -226,7 +226,7 @@ pub trait Execute {
Err(ENOTTY)
}
(STDIN_FILENO | STDOUT_FILENO | STDERR_FILENO, _) => Err(EINVAL),
- (_, FIONBIO) => self.execute(syscall::Ioctl { fd, request, argp })?,
+ (_, FIONBIO | FIONREAD) => self.execute(syscall::Ioctl { fd, request, argp })?,
_ => Err(EBADFD),
}
}
@@ -608,12 +608,14 @@ impl<'a, P: Platform> Execute for Handler<'a, P> {
None
} else {
match request as _ {
- FIONBIO => self.platform.validate_mut::<c_int>(argp).map(|argp| {
+ FIONBIO | FIONREAD => {
+ self.platform.validate_mut::<c_int>(argp).map(|argp| {
Some(slice::from_raw_parts_mut(
argp as *mut _ as _,
size_of::<c_int>(),
))
- })?,
+ })?
+ }
_ => return Err(ENOTSUP),
}
};
