Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add unixsocket without real inode #145

Merged
merged 1 commit into from
Dec 2, 2024
Merged

add unixsocket without real inode #145

merged 1 commit into from
Dec 2, 2024

Conversation

lhw2002426
Copy link
Contributor

add unix socket ans AF_UNIX type for socket
but not impl SOCK_DGRAM, and use alloced index rather than inode for unixsocket because inode is not impl yet

crates/axfs_ramfs/src/file.rs Outdated Show resolved Hide resolved
api/ruxos_posix_api/src/imp/net.rs Outdated Show resolved Hide resolved
api/arceos_posix_api/src/ctypes_gen.rs Outdated Show resolved Hide resolved
}
}

pub enum Sockaddr {
Copy link
Contributor

@ken4647 ken4647 Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Sockaddr is an illegal Camel case varibale name, and it should be more distinguishable with existing name SocketAddr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SockaddrUn is the same.

Copy link
Contributor Author

@lhw2002426 lhw2002426 Nov 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think SockaddrUn is clear enough to represent unix socket address, and i just change it into SockAddrUn

Copy link
Contributor

@ken4647 ken4647 Nov 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think SockaddrUn is clear enough to represent unix socket address, and i just change it into SockAddrUn

Using "SocketAddrUnix" as a variable name is better; Sock is somewhat less intuitive and can easily lead to confusion.

@@ -208,6 +291,14 @@ impl From<ctypes::sockaddr_in> for SocketAddrV4 {
}
}

fn un_into_sockaddr(addr: SockaddrUn) -> (ctypes::sockaddr, ctypes::socklen_t) {
debug!(" Sockaddr: {:?}", addr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The debug message should more clear, let it tell about which function it from and other more information.

size_of::<ctypes::sockaddr>() as _,
)
}

fn into_sockaddr(addr: SocketAddr) -> (ctypes::sockaddr, ctypes::socklen_t) {
debug!(" Sockaddr: {}", addr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this message too.

@lhw2002426 lhw2002426 force-pushed the dev branch 2 times, most recently from c295505 to 213d065 Compare December 1, 2024 12:00
@ken4647 ken4647 merged commit 4ab23d3 into syswonder:dev Dec 2, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants