Skip to content
Snippets Groups Projects
Commit 12f6ffd1 authored by Tiago's avatar Tiago Committed by Tiago Lam
Browse files

platform/redox: Support AF_UNIX in socket.

To add support for UNIX sockets (AF_UNIX), of SOCK_STREAM type, the
"chan:" scheme is used, which will be supportedby the ipcd running in
userspace.

Later commits add similar AF_UNIX support for the rest of the methods in
impl PalSocket.
parent 2bc667f7
No related branches found
No related tags found
1 merge request!255Support AF_UNIX sockets
......@@ -292,7 +292,7 @@ impl PalSocket for Sys {
}
unsafe fn socket(domain: c_int, mut kind: c_int, protocol: c_int) -> c_int {
if domain != AF_INET {
if domain != AF_INET && domain != AF_UNIX {
errno = syscall::EAFNOSUPPORT;
return -1;
}
......@@ -313,9 +313,10 @@ impl PalSocket for Sys {
// The tcp: and udp: schemes allow using no path,
// and later specifying one using `dup`.
match kind {
SOCK_STREAM => e(syscall::open("tcp:", flags)) as c_int,
SOCK_DGRAM => e(syscall::open("udp:", flags)) as c_int,
match (domain, kind) {
(AF_INET, SOCK_STREAM) => e(syscall::open("tcp:", flags)) as c_int,
(AF_INET, SOCK_DGRAM) => e(syscall::open("udp:", flags)) as c_int,
(AF_UNIX, SOCK_STREAM) => e(syscall::open("chan:", flags | O_CREAT)) as c_int,
_ => {
errno = syscall::EPROTONOSUPPORT;
-1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment