kernel/object/capability/
mod.rs

1//! Capability traits for KernelObject resources
2//!
3//! This module defines capability traits that represent the operations
4//! that can be performed on different types of kernel objects.
5
6pub mod control;
7pub mod file;
8pub mod ipc;
9pub mod memory_mapping;
10pub mod selectable;
11pub mod stream;
12
13#[cfg(test)]
14mod control_tests;
15
16use crate::object::KernelObject;
17
18// Re-export stream types for backward compatibility
19pub use stream::{StreamError, StreamOps};
20
21// Re-export file types for backward compatibility
22pub use file::{FileObject, SeekFrom};
23
24// Re-export control types
25pub use control::ControlOps;
26
27// Re-export memory mapping types
28pub use memory_mapping::MemoryMappingOps;
29
30// Re-export IPC types
31pub use ipc::{EventReceiver, EventSender, EventSubscriber};
32
33// Re-export selectable capability types
34pub use selectable::{ReadyInterest, ReadySet, SelectWaitOutcome, Selectable};
35
36/// Clone operations capability
37///
38/// This trait represents the ability to properly clone an object
39/// with custom semantics. Objects that need special cloning behavior
40/// (like pipes that need to update reader/writer counts) should implement this.
41///
42/// The presence of this capability indicates that the object needs custom
43/// clone semantics beyond simple Arc::clone.
44pub trait CloneOps: Send + Sync {
45    /// Perform a custom clone operation and return the cloned object
46    ///
47    /// This method should handle any object-specific cloning logic,
48    /// such as incrementing reference counts for pipes or other shared resources.
49    /// Returns the cloned object as a KernelObject.
50    fn custom_clone(&self) -> KernelObject;
51}