mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 18:03:25 +00:00
Refactor current net codes
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
f6b327dbda
commit
ddb7be9296
@ -1,13 +1,19 @@
|
||||
use crate::fs::file_table::FileDescripter;
|
||||
use crate::log_syscall_entry;
|
||||
use crate::prelude::*;
|
||||
use crate::util::write_socket_addr_to_user;
|
||||
use crate::util::net::write_socket_addr_to_user;
|
||||
use crate::util::read_val_from_user;
|
||||
|
||||
use super::SyscallReturn;
|
||||
use super::SYS_GETSOCKNAME;
|
||||
|
||||
pub fn sys_getsockname(sockfd: FileDescripter, addr: Vaddr, addrlen: u32) -> Result<SyscallReturn> {
|
||||
pub fn sys_getsockname(
|
||||
sockfd: FileDescripter,
|
||||
addr: Vaddr,
|
||||
addrlen_ptr: Vaddr,
|
||||
) -> Result<SyscallReturn> {
|
||||
log_syscall_entry!(SYS_GETSOCKNAME);
|
||||
let addrlen: i32 = read_val_from_user(addrlen_ptr)?;
|
||||
debug!("sockfd = {sockfd}, addr = 0x{addr:x}, addrlen = {addrlen}");
|
||||
let socket_addr = {
|
||||
let current = current!();
|
||||
|
Reference in New Issue
Block a user