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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user