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
No related merge requests found
...@@ -292,7 +292,7 @@ impl PalSocket for Sys { ...@@ -292,7 +292,7 @@ impl PalSocket for Sys {
} }
unsafe fn socket(domain: c_int, mut kind: c_int, protocol: c_int) -> c_int { 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; errno = syscall::EAFNOSUPPORT;
return -1; return -1;
} }
...@@ -313,9 +313,10 @@ impl PalSocket for Sys { ...@@ -313,9 +313,10 @@ impl PalSocket for Sys {
// The tcp: and udp: schemes allow using no path, // The tcp: and udp: schemes allow using no path,
// and later specifying one using `dup`. // and later specifying one using `dup`.
match kind { match (domain, kind) {
SOCK_STREAM => e(syscall::open("tcp:", flags)) as c_int, (AF_INET, SOCK_STREAM) => e(syscall::open("tcp:", flags)) as c_int,
SOCK_DGRAM => e(syscall::open("udp:", 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; errno = syscall::EPROTONOSUPPORT;
-1 -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