mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-09 15:26:47 +00:00
feat(socket): 实现shutdown系统调用的基础结构并启用相关方法
This commit is contained in:
parent
14c21430a5
commit
57e0b2e96a
@ -118,6 +118,8 @@ pub trait Socket: Sync + Send + Debug + Any {
|
|||||||
}
|
}
|
||||||
/// # `shutdown`
|
/// # `shutdown`
|
||||||
fn shutdown(&self, how: ShutdownTemp) -> Result<(), SystemError> {
|
fn shutdown(&self, how: ShutdownTemp) -> Result<(), SystemError> {
|
||||||
|
// TODO 构建shutdown系统调用
|
||||||
|
// set shutdown bit
|
||||||
Err(ENOSYS)
|
Err(ENOSYS)
|
||||||
}
|
}
|
||||||
// sockatmark
|
// sockatmark
|
||||||
|
@ -53,21 +53,21 @@ impl Shutdown {
|
|||||||
.fetch_or(SEND_SHUTDOWN, core::sync::atomic::Ordering::SeqCst);
|
.fetch_or(SEND_SHUTDOWN, core::sync::atomic::Ordering::SeqCst);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn is_recv_shutdown(&self) -> bool {
|
pub fn is_recv_shutdown(&self) -> bool {
|
||||||
// self.bit.load(core::sync::atomic::Ordering::SeqCst) & RCV_SHUTDOWN != 0
|
self.bit.load(core::sync::atomic::Ordering::SeqCst) & RCV_SHUTDOWN != 0
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn is_send_shutdown(&self) -> bool {
|
pub fn is_send_shutdown(&self) -> bool {
|
||||||
// self.bit.load(core::sync::atomic::Ordering::SeqCst) & SEND_SHUTDOWN != 0
|
self.bit.load(core::sync::atomic::Ordering::SeqCst) & SEND_SHUTDOWN != 0
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn is_both_shutdown(&self) -> bool {
|
pub fn is_both_shutdown(&self) -> bool {
|
||||||
// self.bit.load(core::sync::atomic::Ordering::SeqCst) & SHUTDOWN_MASK == SHUTDOWN_MASK
|
self.bit.load(core::sync::atomic::Ordering::SeqCst) & SHUTDOWN_MASK == SHUTDOWN_MASK
|
||||||
// }
|
}
|
||||||
|
|
||||||
// pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
// self.bit.load(core::sync::atomic::Ordering::SeqCst) == 0
|
self.bit.load(core::sync::atomic::Ordering::SeqCst) == 0
|
||||||
// }
|
}
|
||||||
|
|
||||||
pub fn from_how(how: usize) -> Self {
|
pub fn from_how(how: usize) -> Self {
|
||||||
Self::from(ShutdownBit::from_bits_truncate(how as u8))
|
Self::from(ShutdownBit::from_bits_truncate(how as u8))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user