File descriptor utility functions. More...
#include <string>
#include <cstddef>
#include <sys/types.h>
Go to the source code of this file.
Namespaces | |
utils | |
Functions | |
int | utils::open (const std::string &path, int flags, mode_t mode=-1) |
Open a file. More... | |
void | utils::close (int fd) |
Close the file descriptor. More... | |
void | utils::shutdown (int fd) |
Shut down part of a full-duplex connection. More... | |
int | utils::ioctl (int fd, unsigned long request, void *argp) |
Operation on a special file. More... | |
int | utils::dup2 (int olfFD, int newFD, bool closeOnExec=false) |
Duplicate one file desciptor onto another. More... | |
void | utils::write (int fd, const void *bufferPtr, const size_t size, int timeoutMS=5000) |
Write to a file descriptor, throw on error. More... | |
void | utils::read (int fd, void *bufferPtr, const size_t size, int timeoutMS=5000) |
Read from a file descriptor, throw on error. More... | |
unsigned int | utils::getMaxFDNumber () |
void | utils::setMaxFDNumber (unsigned int limit) |
Set the software and hardware limit of file descriptors for this process. More... | |
unsigned int | utils::getFDNumber () |
bool | utils::fdSend (int socket, int fd, const unsigned int timeoutMS=5000) |
Send Socket via Unix Domain socket. More... | |
int | utils::fdRecv (int socket, const unsigned int timeoutMS=5000) |
Receive fd via Unix Domain socket. More... | |
void | utils::setCloseOnExec (int fd, bool closeOnExec) |
Set or remove CLOEXEC on a file descriptor. More... | |
void | utils::setNonBlocking (int fd, bool nonBlocking) |
Set or remove NONBLOCK on a file descriptor. More... | |
File descriptor utility functions.