25 #ifdef XAPIAN_TESTSUITE_TRACK_FDS 46 #if defined __linux__ || defined __CYGWIN__ 47 # define FD_DIRECTORY "/proc/self/fd" 49 # define FD_DIRECTORY "/dev/fd" 56 if (
size_t(fd) >= fds.size())
57 fds.resize((fd &~ 31) + 32);
65 return size_t(fd) < fds.size() && fds[fd];
71 DIR * dir =
static_cast<DIR*
>(dir_void);
82 dir_void =
static_cast<void*
>(dir);
100 if (name[0] <
'0' || name[0] >
'9')
111 DIR * dir =
static_cast<DIR*
>(dir_void);
112 if (!dir)
return true;
130 if (name[0] <
'0' || name[0] >
'9')
140 proc_symlink +=
name;
145 int res = readlink(proc_symlink.c_str(), buf,
sizeof(buf));
147 memcmp(buf,
"/dev/urandom",
CONST_STRLEN(
"/dev/urandom")) == 0) {
158 message.append(buf, res);
168 #endif // XAPIAN_TESTSUITE_TRACK_FDS
Track leaked file descriptors.
Convert errno value to std::string, thread-safe if possible.
struct dirent * readdir(DIR *)
include <dirent.h>, with alternative implementation for windows.
Convert types to std::string.
DIR * opendir(const char *)
void errno_to_string(int e, string &s)
string str(int value)
Convert int to std::string.
#define CONST_STRLEN(S)
Returns the length of a string constant.
Various handy helpers which std::string really should provide.
<unistd.h>, but with compat.
bool check_fd(int fd) const