localsocket: implement SOCK_SEQPACKET and a bunch of SCM_RIGHTS fixes

This commit is contained in:
Matheus
2026-06-04 23:19:01 -03:00
parent 03559bb6b2
commit 1a557b7a20
5 changed files with 212 additions and 65 deletions
+4 -1
View File
@@ -32,7 +32,10 @@ syscallret_t syscall_socket(context_t *, int domain, int type, int protocol) {
socktype = SOCKET_TYPE_UDP;
break;
case AF_LOCAL:
socktype = SOCKET_TYPE_LOCAL;
if (type == SOCK_STREAM)
socktype = SOCKET_TYPE_LOCAL;
if (type == SOCK_SEQPACKET)
socktype = SOCKET_TYPE_LOCAL_SEQPACKET;
}
if (socktype == -1) {
+5 -2
View File
@@ -22,7 +22,7 @@ syscallret_t syscall_socketpair(context_t *, int domain, int type, int protocol)
}
// we will only support pairs of local sockets
if (domain != AF_LOCAL || type != SOCK_STREAM) {
if (domain != AF_LOCAL || (type != SOCK_STREAM && type != SOCK_SEQPACKET)) {
ret.errno = EOPNOTSUPP;
return ret;
}
@@ -36,7 +36,10 @@ syscallret_t syscall_socketpair(context_t *, int domain, int type, int protocol)
socket_t *sock2 = NULL;
// create pair
ret.errno = localsock_pair(&sock1, &sock2);
if (type == SOCK_SEQPACKET)
ret.errno = localsock_pair_seqpacket(&sock1, &sock2);
else
ret.errno = localsock_pair(&sock1, &sock2);
if (ret.errno)
return ret;