Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fd-utils.cpp File Reference

File descriptor utility functions. More...

#include "config.hpp"
#include "utils/fd-utils.hpp"
#include "utils/exception.hpp"
#include "logger/logger.hpp"
#include <cerrno>
#include <cstring>
#include <chrono>
#include <unistd.h>
#include <fcntl.h>
#include <poll.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <boost/filesystem.hpp>

Namespaces

 utils
 

Macros

#define _GNU_SOURCE
 

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 ()
 
int utils::fdRecv (int socket, const unsigned int timeoutMS=5000)
 Receive fd via Unix Domain socket. More...
 
bool utils::fdSend (int socket, int fd, const unsigned int timeoutMS=5000)
 Send Socket 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...
 

Detailed Description

File descriptor utility functions.

Author
Jan Olszak (j.ols.nosp@m.zak@.nosp@m.samsu.nosp@m.ng.c.nosp@m.om)

Macro Definition Documentation

#define _GNU_SOURCE