xapian-core  1.4.26
Public Member Functions | Private Member Functions | Private Attributes | List of all members
FDTracker Class Reference

#include <fdtracker.h>

+ Collaboration diagram for FDTracker:

Public Member Functions

 FDTracker ()
 
 ~FDTracker ()
 
void init ()
 
bool check ()
 
const std::string & get_message () const
 
 FDTracker (const FDTracker &)=delete
 
FDTrackeroperator= (const FDTracker &)=delete
 

Private Member Functions

void mark_fd (int fd)
 
bool check_fd (int fd) const
 

Private Attributes

std::vector< bool > fds
 Which fds are open. More...
 
void * dir_void
 The DIR* from opendir("/proc/self/fd") (or equivalent) cast to void*. More...
 
std::string message
 

Detailed Description

Definition at line 32 of file fdtracker.h.

Constructor & Destructor Documentation

◆ FDTracker() [1/2]

FDTracker::FDTracker ( )
inline

Definition at line 56 of file fdtracker.h.

References check(), init(), and ~FDTracker().

Referenced by get_message().

◆ ~FDTracker()

FDTracker::~FDTracker ( )

Definition at line 68 of file fdtracker.cc.

References closedir().

Referenced by FDTracker().

◆ FDTracker() [2/2]

FDTracker::FDTracker ( const FDTracker )
delete

Member Function Documentation

◆ check()

bool FDTracker::check ( )

◆ check_fd()

bool FDTracker::check_fd ( int  fd) const
private

Definition at line 63 of file fdtracker.cc.

◆ get_message()

const std::string& FDTracker::get_message ( ) const
inline

Definition at line 64 of file fdtracker.h.

References check(), FDTracker(), init(), message, and operator=().

Referenced by test_driver::runtest().

◆ init()

void FDTracker::init ( )

◆ mark_fd()

void FDTracker::mark_fd ( int  fd)
private

Definition at line 53 of file fdtracker.cc.

◆ operator=()

FDTracker& FDTracker::operator= ( const FDTracker )
delete

Referenced by get_message().

Member Data Documentation

◆ dir_void

void* FDTracker::dir_void
private

The DIR* from opendir("/proc/self/fd") (or equivalent) cast to void*.

We store this cast to void* here to minimise the header we have to include here.

Definition at line 47 of file fdtracker.h.

◆ fds

std::vector<bool> FDTracker::fds
private

Which fds are open.

The lowest unused fd is used whenever a new fd is needed so we can expect them to form a dense set and vector<bool> should be an efficient representation both in space and time.

Definition at line 40 of file fdtracker.h.

◆ message

std::string FDTracker::message
private

Definition at line 49 of file fdtracker.h.

Referenced by get_message().


The documentation for this class was generated from the following files: