Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
PKTH-Jx committed Mar 4, 2025
2 parents 0f85878 + 1d0ca34 commit f883f12
Show file tree
Hide file tree
Showing 11 changed files with 187 additions and 128 deletions.
3 changes: 2 additions & 1 deletion api/ruxos_posix_api/src/imp/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,8 @@ pub fn sys_getsockopt(
| ctypes::SO_RCVTIMEO
| ctypes::SO_REUSEADDR
| ctypes::SO_SNDBUF
| ctypes::SO_SNDTIMEO => 0,
| ctypes::SO_SNDTIMEO
| ctypes::SO_BINDTODEVICE => 0,
_ => return Err(LinuxError::ENOPROTOOPT),
};

Expand Down
8 changes: 8 additions & 0 deletions api/ruxos_posix_api/src/imp/stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ pub fn sys_setpgid(pid: pid_t, pgid: pid_t) -> c_int {
debug!("sys_setpgid: pid {}, pgid {} ", pid, pgid);
syscall_body!(sys_setpgid, Ok(0))
}

/// set process sid (empty implementation)
///
/// TODO:
pub fn sys_setsid() -> c_int {
warn!("sys_setsid: do nothing",);
syscall_body!(sys_setsid, Ok(0))
}
2 changes: 1 addition & 1 deletion api/ruxos_posix_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub use imp::prctl::{sys_arch_prctl, sys_prctl};
pub use imp::resources::{sys_getrlimit, sys_prlimit64, sys_setrlimit};
pub use imp::stat::{
sys_getegid, sys_geteuid, sys_getgid, sys_getpgid, sys_getuid, sys_setgid, sys_setpgid,
sys_setuid, sys_umask,
sys_setsid, sys_setuid, sys_umask,
};
pub use imp::sys::{sys_sysinfo, sys_uname};
pub use imp::sys_invalid;
Expand Down
7 changes: 4 additions & 3 deletions apps/c/httpclient/expect_info.out
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ Primary CPU 0 init OK.
Hello, Ruxos C HTTP client!
IP: [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+
HTTP/1.1 200 OK
Date:
Content-Type: text/plain
Content-Length:
Access-Control-Allow-Origin: *
Alt-Svc: h3=":443"; ma=
Cache-Control: no-cache, no-store, must-revalidate
Date:
Content-Length:
Content-Type: text/plain; charset=utf-8

^[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+
Shutting down...
14 changes: 11 additions & 3 deletions modules/ruxfs/src/mounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ pub(crate) fn etcfs() -> VfsResult<Arc<fs::ramfs::RamFileSystem>> {
etc_root.create(&RelPath::new("passwd"), VfsNodeType::File)?;
let file_passwd = etc_root.clone().lookup(&RelPath::new("passwd"))?;
// format: username:password:uid:gid:allname:homedir:shell
file_passwd.write_at(0, b"root:x:0:0:root:/root:/bin/bash\n")?;
file_passwd.write_at(
0,
b"root:x:0:0:root:/root:/bin/busybox\n\
syswonder:x:1000:1000:root:/root:/bin/busybox\n",
)?;

// Create /etc/group
etc_root.create(&RelPath::new("group"), VfsNodeType::File)?;
Expand All @@ -134,13 +138,17 @@ pub(crate) fn etcfs() -> VfsResult<Arc<fs::ramfs::RamFileSystem>> {
ff02::3 ip6-allhosts\n",
)?;

etc_root.create(&RelPath::new("services"), VfsNodeType::File)?;
let file_services = etc_root.clone().lookup(&RelPath::new("services"))?;
file_services.write_at(0, b"ssh 22/tcp")?;

// Create /etc/resolv.conf
etc_root.create(&RelPath::new("resolv.conf"), VfsNodeType::File)?;
let file_resolv = etc_root.clone().lookup(&RelPath::new("resolv.conf"))?;
file_resolv.write_at(
0,
b"nameserver 127.0.0.53\n\
nameserver 8.8.8.8\n\
b"nameserver 8.8.8.8\n\
nameserver 114.114.114.114\n\
options edns0 trust-ad\n\
search lan\n
",
Expand Down
2 changes: 1 addition & 1 deletion modules/ruxnet/src/smoltcp_impl/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl DnsSocket {
}
})?;
loop {
SOCKET_SET.poll_interfaces();
SOCKET_SET.poll_interfaces(None);
match SOCKET_SET.with_socket_mut::<dns::Socket, _, _>(handle, |socket| {
socket.get_query_result(query_handle).map_err(|e| match e {
GetQueryResultError::Pending => AxError::WouldBlock,
Expand Down
9 changes: 5 additions & 4 deletions modules/ruxnet/src/smoltcp_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ impl<'a> SocketSetWrapper<'a> {
f(socket)
}

pub fn poll_interfaces(&self) {
pub fn poll_interfaces(&self, iface_name: Option<String>) {
for iface in IFACE_LIST.lock().iter() {
iface.poll(&self.0);
if iface_name.is_none() || iface_name.clone().unwrap() == iface.name() {
iface.poll(&self.0);
}
}
}

Expand Down Expand Up @@ -287,7 +289,6 @@ impl<'a> TxToken for AxNetTxToken<'a> {
let mut dev = self.0.borrow_mut();
let mut tx_buf = dev.alloc_tx_buffer(len).unwrap();
let ret = f(tx_buf.packet_mut());
trace!("SEND {} bytes: {:02X?}", len, tx_buf.packet());
dev.transmit(tx_buf).unwrap();
ret
}
Expand Down Expand Up @@ -317,7 +318,7 @@ fn snoop_tcp_packet(buf: &[u8], sockets: &mut SocketSet<'_>) -> Result<(), smolt
/// It may receive packets from the NIC and process them, and transmit queued
/// packets to the NIC.
pub fn poll_interfaces() {
SOCKET_SET.poll_interfaces();
SOCKET_SET.poll_interfaces(None);
}

/// Benchmark raw socket transmit bandwidth.
Expand Down
Loading

0 comments on commit f883f12

Please sign in to comment.