mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-14 07:56:47 +00:00
uevent should be format Enum of smoltcp socket should be optimized. need to add interface for routing subsys actix is still not abled to run. clean some casual added code to other places
29 lines
867 B
Rust
29 lines
867 B
Rust
use crate::net::socket;
|
|
use alloc::sync::Arc;
|
|
use socket::Family;
|
|
use system_error::SystemError;
|
|
|
|
pub fn create_socket(
|
|
family: socket::AddressFamily,
|
|
socket_type: socket::Type,
|
|
protocol: u32,
|
|
is_nonblock: bool,
|
|
is_close_on_exec: bool,
|
|
) -> Result<Arc<socket::Inode>, SystemError> {
|
|
type AF = socket::AddressFamily;
|
|
let inode = match family {
|
|
AF::INet => socket::inet::Inet::socket(socket_type, protocol)?,
|
|
AF::INet6 => {
|
|
todo!("AF_INET6 unimplemented");
|
|
}
|
|
AF::Unix => socket::unix::Unix::socket(socket_type, protocol)?,
|
|
AF::Netlink => socket::netlink::Netlink::socket(socket_type, protocol)?,
|
|
_ => {
|
|
todo!("unsupport address family");
|
|
}
|
|
};
|
|
// inode.set_nonblock(is_nonblock);
|
|
// inode.set_close_on_exec(is_close_on_exec);
|
|
return Ok(inode);
|
|
}
|