1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

Kernel+LibC: Add sys$recvfd() and sys$sendfd() for fd passing

These new syscalls allow you to send and receive file descriptors over
a local domain socket. This will enable various privilege separation
techniques and other good stuff. :^)
This commit is contained in:
Andreas Kling 2020-06-24 22:57:37 +02:00
parent cd02144a06
commit d4195672b7
7 changed files with 127 additions and 2 deletions

View file

@ -119,4 +119,16 @@ int getpeername(int sockfd, struct sockaddr* addr, socklen_t* addrlen)
int rc = syscall(SC_getpeername, &params);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int sendfd(int sockfd, int fd)
{
int rc = syscall(SC_sendfd, sockfd, fd);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int recvfd(int sockfd)
{
int rc = syscall(SC_recvfd, sockfd);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
}