Base: Add man pages for recvfd(2) and sendfd(2) :^)
This commit is contained in:
parent
d4195672b7
commit
1a7ccc1569
Notes:
sideshowbarker
2024-07-19 05:24:08 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/1a7ccc15696
2 changed files with 67 additions and 0 deletions
33
Base/usr/share/man/man2/recvfd.md
Normal file
33
Base/usr/share/man/man2/recvfd.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
## Name
|
||||
|
||||
recvfd - receive a file descriptor from a local socket peer
|
||||
|
||||
## Synopsis
|
||||
|
||||
```**c++
|
||||
#include <sys/socket.h>
|
||||
|
||||
int recvfd(int sockfd);
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
Receive an open file descriptor from a local socket peer connected via `sockfd`. This is a non-blocking call that will fail if there is no file descriptor waiting in the socket's queue.
|
||||
|
||||
File descriptors are sent out-of-band and do not affect the regular data streams.
|
||||
|
||||
## Return value
|
||||
|
||||
If a file descriptor is successfully received, it is returned as a positive integer. Otherwise, -1 is returned and `errno` is set to indicate the error.
|
||||
|
||||
## Errors
|
||||
|
||||
* `EBADF`: `sockfd` is not an open file descriptor.
|
||||
* `ENOTSOCK`: `sockfd` does not refer to a socket.
|
||||
* `EAFNOSUPPORT`: `sockfd` does not refer to a local domain socket.
|
||||
* `EINVAL`: `sockfd` does not refer to a connected or accepted socket.
|
||||
* `EAGAIN`: There is no file descriptor queued on this socket.
|
||||
|
||||
## See also
|
||||
|
||||
* [`sendfd`(2)](sendfd.md)
|
34
Base/usr/share/man/man2/sendfd.md
Normal file
34
Base/usr/share/man/man2/sendfd.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
## Name
|
||||
|
||||
sendfd - send a file descriptor to a local socket peer
|
||||
|
||||
## Synopsis
|
||||
|
||||
```**c++
|
||||
#include <sys/socket.h>
|
||||
|
||||
int sendfd(int sockfd, int fd);
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
Send an open file descriptor to a local socket peer connected via `sockfd`. This is a non-blocking call that will fail if there are too many file descriptors already waiting to be received by the peer.
|
||||
|
||||
File descriptors are sent out-of-band and do not affect the regular data streams.
|
||||
|
||||
## Return value
|
||||
|
||||
If a file descriptor is successfully received, it is returned as a positive integer. Otherwise, -1 is returned and `errno` is set to indicate the error.
|
||||
|
||||
## Errors
|
||||
|
||||
* `EBADF`: `sockfd` or `fd` is not an open file descriptor.
|
||||
* `ENOTSOCK`: `sockfd` does not refer to a socket.
|
||||
* `EAFNOSUPPORT`: `sockfd` does not refer to a local domain socket.
|
||||
* `ENOTCONN`: `sockfd` refers to a socket which is not connected.
|
||||
* `EINVAL`: `sockfd` does not refer to a connected or accepted socket.
|
||||
* `EBUSY`: There are too many file descriptors already waiting to be received by the peer.
|
||||
|
||||
## See also
|
||||
|
||||
* [`recvfd`(2)](recvfd.md)
|
Loading…
Add table
Reference in a new issue