|
| | Fd () |
| |
| | Fd (Fd &)=delete |
| |
| | Fd (Fd &&) |
| |
| | ~Fd () |
| |
| Fd & | operator= (Fd &)=delete |
| |
| Fd & | operator= (Fd &&) |
| |
| int | Bind (const struct sockaddr *addr, socklen_t addrlen) |
| |
| int | Connect (const struct sockaddr *addr, socklen_t addrlen) |
| |
| int | ConnectWithTimeout (const struct sockaddr *addr, socklen_t addrlen, struct timeval *timeout) |
| |
| void | Close () |
| |
| bool | Chmod (mode_t mode) |
| |
| bool | CopyFrom (Fd &in, size_t length, Fd *stop=nullptr) |
| |
| bool | CopyAllFrom (Fd &in, Fd *stop=nullptr) |
| |
| bool | SendFile (Fd &in, off_t *offset, size_t count) |
| |
| int | UNMANAGED_Dup () |
| |
| int | UNMANAGED_Dup2 (int newfd) |
| |
| int | Fchdir () |
| |
| int | Fcntl (int command, int value) |
| |
| int | Fsync () |
| |
| Result< void > | Flock (int operation) |
| |
| int | GetErrno () const |
| |
| int | GetSockName (struct sockaddr *addr, socklen_t *addrlen) |
| |
| int | Ioctl (int request, void *val=nullptr) |
| |
| bool | IsOpen () const |
| |
| bool | IsSet (fd_set *in) const |
| |
| bool | IsRegular () const |
| |
| int | LinkAtCwd (const std::string &path) |
| |
| int | Listen (int backlog) |
| |
| off_t | LSeek (off_t offset, int whence) |
| |
| ssize_t | Recv (void *buf, size_t len, int flags) |
| |
| ssize_t | RecvMsg (struct msghdr *msg, int flags) |
| |
| Result< uint64_t > | Read (void *buf, uint64_t count) override |
| |
| Result< uint64_t > | PRead (void *buf, uint64_t count, uint64_t offset) const override |
| |
| ssize_t | Send (const void *buf, size_t len, int flags) |
| |
| ssize_t | SendMsg (const struct msghdr *msg, int flags) |
| |
| Result< uint64_t > | SeekSet (uint64_t) override |
| |
| Result< uint64_t > | SeekCur (int64_t) override |
| |
| Result< uint64_t > | SeekEnd (int64_t) override |
| |
| template<typename... Args> |
| ssize_t | SendFileDescriptors (const void *buf, size_t len, Args &&... sent_fds) |
| |
| int | Shutdown (int how) |
| |
| void | Set (fd_set *dest, int *max_index) const |
| |
| int | SetSockOpt (int level, int optname, const void *optval, socklen_t optlen) |
| |
| int | GetSockOpt (int level, int optname, void *optval, socklen_t *optlen) |
| |
| int | SetTerminalRaw () |
| |
| std::string | StrError () const |
| |
| ScopedMMap | MMap (void *addr, size_t length, int prot, int flags, off_t offset) |
| |
| Result< void > | Truncate (uint64_t length) override |
| |
| Result< uint64_t > | Write (const void *buf, uint64_t count) override |
| |
| Result< uint64_t > | PWrite (const void *buf, uint64_t count, uint64_t offset) override |
| |
| bool | IsATTY () |
| |
| int | Futimens (const struct timespec times[2]) |
| |
| int | InotifyAddWatch (const std::string &pathname, uint32_t mask) |
| |
| void | InotifyRmWatch (int watch) |
| |
| Result< void > | Visit (IoVisitor &) override |
| |
| Result< uint64_t > | Read (void *buf, uint64_t count) override=0 |
| |
| Result< uint64_t > | Write (const void *buf, uint64_t count) override=0 |
| |
| Result< uint64_t > | SeekSet (uint64_t offset) override=0 |
| |
| Result< uint64_t > | SeekCur (int64_t offset) override=0 |
| |
| Result< uint64_t > | SeekEnd (int64_t offset) override=0 |
| |
| Result< uint64_t > | PRead (void *buf, uint64_t count, uint64_t offset) const override=0 |
| |
| Result< uint64_t > | PWrite (const void *buf, uint64_t count, uint64_t offset) override=0 |
| |
| Result< void > | Truncate (uint64_t size) override |
| |
| Result< void > | Visit (IoVisitor &) override |
| |
| virtual Result< uint64_t > | PRead (void *buf, uint64_t count, uint64_t offset) const =0 |
| |
| virtual | ~Reader ()=default |
| |
| Result< void > | Visit (IoVisitor &) override |
| |
| virtual Result< uint64_t > | Read (void *buf, uint64_t count)=0 |
| |
| virtual | ~IoVisitable ()=default |
| |
| virtual Result< void > | Visit (IoVisitor &)=0 |
| |
| virtual | ~Seeker ()=default |
| |
| Result< void > | Visit (IoVisitor &) override |
| |
| virtual Result< uint64_t > | SeekSet (uint64_t offset)=0 |
| |
| virtual Result< uint64_t > | SeekCur (int64_t offset)=0 |
| |
| virtual Result< uint64_t > | SeekEnd (int64_t offset)=0 |
| |
| Result< void > | Visit (IoVisitor &) override |
| |
| virtual Result< uint64_t > | PWrite (const void *buf, uint64_t count, uint64_t offset)=0 |
| |
| virtual Result< void > | Truncate (uint64_t size) |
| |
| virtual | ~Writer ()=default |
| |
| Result< void > | Visit (IoVisitor &) override |
| |
| virtual Result< uint64_t > | Write (const void *buf, uint64_t count)=0 |
| |
|
| static Result< Fd > | Accept (const Fd &listener) |
| |
| static Result< Fd > | Creat (std::string_view path, mode_t mode) |
| |
| static Result< Fd > | Dup (int unmanaged_fd) |
| |
| static Result< Fd > | Fifo (std::string_view pathname, mode_t mode) |
| |
| static Result< Fd > | MemfdCreate (std::string_view name, unsigned int flags=0) |
| |
| static Result< std::pair< Fd, std::string > > | Mkostemp (std::string_view path, int flags=O_CLOEXEC) |
| |
| static Result< Fd > | Open (std::string_view pathname, int flags, mode_t mode=0) |
| |
| static Result< std::pair< Fd, Fd > > | Pipe () |
| |
| static Result< std::pair< Fd, Fd > > | SocketPair (int domain, int type, int protocol) |
| |
| static Result< Fd > | Socket (int domain, int socket_type, int protocol) |
| |
| static Result< Fd > | Socket6Client (std::string_view host, std::string_view interface, int port, int type, std::chrono::seconds timeout=std::chrono::seconds(0)) |
| |
| static Result< Fd > | SocketClient (std::string_view host, int port, int type, std::chrono::seconds timeout=std::chrono::seconds(0)) |
| |
| static Result< Fd > | SocketLocalClient (std::string_view name, bool is_abstract, int in_type) |
| |
| static Result< Fd > | SocketLocalClient (std::string_view name, bool is_abstract, int in_type, int timeout_seconds) |
| |
| static Result< Fd > | SocketLocalClient (int port, int type) |
| |
| static Result< Fd > | SocketLocalServer (std::string_view name, bool is_abstract, int in_type, mode_t mode) |
| |
| static Result< Fd > | SocketLocalServer (int port, int type) |
| |
| static void | Log (const char *message) |
| |
Tracks the lifetime of a file descriptor and provides methods to allow callers to use the file without knowledge of the underlying descriptor number.
Fds have two states: Open and Closed. They may start in either state.
Construction of Fds is limited to select classes to avoid escaping file descriptors.