mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:37:35 +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:
parent
cd02144a06
commit
d4195672b7
7 changed files with 127 additions and 2 deletions
|
@ -119,4 +119,16 @@ int getpeername(int sockfd, struct sockaddr* addr, socklen_t* addrlen)
|
|||
int rc = syscall(SC_getpeername, ¶ms);
|
||||
__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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue