base: stability fixes — acpid EC, inputd, block driver, ipcd UDS, netstack loopback, ptyd, ramfs, randd, scheme-utils blocking
This commit is contained in:
@@ -12,6 +12,8 @@ pub type PacketBuffer = smoltcp::storage::PacketBuffer<'static, ()>;
|
||||
pub struct LoopbackDevice {
|
||||
name: Rc<str>,
|
||||
buffer: PacketBuffer,
|
||||
enabled: bool,
|
||||
promiscuous: bool,
|
||||
}
|
||||
|
||||
impl Default for LoopbackDevice {
|
||||
@@ -23,6 +25,8 @@ impl Default for LoopbackDevice {
|
||||
LoopbackDevice {
|
||||
name: "loopback".into(),
|
||||
buffer,
|
||||
enabled: true,
|
||||
promiscuous: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,4 +62,29 @@ impl LinkDevice for LoopbackDevice {
|
||||
}
|
||||
|
||||
fn set_ip_address(&mut self, _addr: smoltcp::wire::IpCidr) {}
|
||||
|
||||
fn is_enabled(&self) -> bool {
|
||||
self.enabled
|
||||
}
|
||||
|
||||
fn set_enabled(&mut self, enabled: bool) {
|
||||
self.enabled = enabled;
|
||||
}
|
||||
|
||||
fn is_promiscuous(&self) -> bool {
|
||||
self.promiscuous
|
||||
}
|
||||
|
||||
fn set_promiscuous(&mut self, enabled: bool) {
|
||||
self.promiscuous = enabled;
|
||||
}
|
||||
|
||||
fn mtu(&self) -> usize {
|
||||
1500
|
||||
}
|
||||
|
||||
fn set_mtu(&mut self, _mtu: usize) {
|
||||
// Loopback's packet buffer is fixed at 1500 bytes at construction;
|
||||
// reallocation is not supported. The new value is ignored.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,10 +53,12 @@ impl<'a> SchemeSocket for RawSocket<'a> {
|
||||
}
|
||||
|
||||
fn hop_limit(&self) -> u8 {
|
||||
0
|
||||
smoltcp::socket::raw::Socket::hop_limit(self)
|
||||
}
|
||||
|
||||
fn set_hop_limit(&mut self, _hop_limit: u8) {}
|
||||
fn set_hop_limit(&mut self, hop_limit: u8) {
|
||||
smoltcp::socket::raw::Socket::set_hop_limit(self, hop_limit);
|
||||
}
|
||||
|
||||
fn new_socket(
|
||||
socket_set: &mut SocketSet,
|
||||
|
||||
@@ -922,12 +922,14 @@ where
|
||||
}
|
||||
|
||||
fn fsync(&mut self, fd: usize, _ctx: &CallerCtx) -> SyscallResult<()> {
|
||||
{
|
||||
let _file = self.handles.get_mut(fd)?;
|
||||
}
|
||||
// Verify the socket exists. The netstack is event-driven (polled by
|
||||
// userspace via fevent), so there is no kernel-side buffer to flush.
|
||||
// POSIX fsync(2) on a socket is required to return success when the
|
||||
// socket is valid; the underlying protocol (TCP) handles acknowledgements
|
||||
// asynchronously through the normal poll loop.
|
||||
// Cross-referenced with Linux net/socket.c: sockfs_fsync -> sock_no_fsync.
|
||||
let _file = self.handles.get(fd)?;
|
||||
Ok(())
|
||||
// TODO Implement fsyncing
|
||||
// self.0.network_fsync()
|
||||
}
|
||||
|
||||
fn fpath(&mut self, fd: usize, buf: &mut [u8], _ctx: &CallerCtx) -> SyscallResult<usize> {
|
||||
|
||||
Reference in New Issue
Block a user