25 #ifdef XAPIAN_TESTSUITE_TRACK_FDS 47 #if defined __linux__ || defined __CYGWIN__ 48 # define FD_DIRECTORY "/proc/self/fd" 50 # define FD_DIRECTORY "/dev/fd" 57 if (
size_t(fd) >= fds.size())
58 fds.resize((fd &~ 31) + 32);
66 return size_t(fd) < fds.size() && fds[fd];
72 DIR * dir =
static_cast<DIR*
>(dir_void);
83 dir_void =
static_cast<void*
>(dir);
101 if (name[0] <
'0' || name[0] >
'9')
112 DIR * dir =
static_cast<DIR*
>(dir_void);
113 if (!dir)
return true;
131 if (name[0] <
'0' || name[0] >
'9')
141 proc_symlink +=
name;
146 int res = readlink(proc_symlink.c_str(), buf,
sizeof(buf));
148 memcmp(buf,
"/dev/urandom",
CONST_STRLEN(
"/dev/urandom")) == 0) {
159 message.append(buf, res);
169 #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