44 #if defined HAVE_PREAD && defined PREAD_PROTOTYPE    47 #if defined HAVE_PWRITE && defined PWRITE_PROTOTYPE    57     if (errno != ENOENT) {
    71     if (anew) flags |= O_CREAT | O_TRUNC;
    72     int fd = 
::open(fname, flags, 0666);
    79 #ifdef F_DUPFD_CLOEXEC    83     if (fd < 0 && errno == EINVAL)
    90             (void)fcntl(fd, F_SETFD, FD_CLOEXEC);
    93     int save_errno = errno;
    99         memset(toclose, 0, 
sizeof(toclose));
   105         int save_errno = errno;
   113             (void)fcntl(fd, F_SETFD, FD_CLOEXEC);
   123 io_read(
int fd, 
char * p, 
size_t n, 
size_t min)
   127         ssize_t c = read(fd, p, n);
   130                 if (total >= min) 
break;
   133             if (errno == EINTR) 
continue;
   148         ssize_t c = write(fd, p, n);
   150             if (errno == EINTR) 
continue;
   168 #ifdef HAVE_POSIX_FADVISE   175     return posix_fadvise(fd, o, n, POSIX_FADV_WILLNEED) == 0;
   188         ssize_t c = pread(fd, p, n, o);
   190         if (
usual(c == ssize_t(n)))
   198             if (errno == EINTR) 
continue;
   206     if (
rare(lseek(fd, o, SEEK_SET) < 0))
   209         ssize_t c = read(fd, p, n);
   211         if (
usual(c == ssize_t(n)))
   218             if (errno == EINTR) 
continue;
   236         ssize_t c = pwrite(fd, p, n, o);
   238         if (
usual(c == ssize_t(n)))
   243             if (errno == EINTR) 
continue;
   251     if (
rare(lseek(fd, o, SEEK_SET) < 0))
   254         ssize_t c = write(fd, p, n);
   256         if (
usual(c == ssize_t(n)))
   261             if (errno == EINTR) 
continue;
   286     if (
posixy_rename(tmp_file.c_str(), real_file.c_str()) < 0) {
   288         if (errno == EXDEV && --retries > 0) 
goto retry;
   295         int saved_errno = errno;
   296         if (unlink(tmp_file.c_str()) == 0 || errno != ENOENT) {
 
Define the XAPIAN_NORETURN macro. 
 
void io_write(int fd, const char *p, size_t n)
Write n bytes from block pointed to by p to file descriptor fd. 
 
bool io_unlink(const std::string &filename)
Delete a file. 
 
void io_read_block(int fd, char *p, size_t n, off_t b, off_t o)
Read block b size n bytes into buffer p from file descriptor fd, offset o. 
 
Provides wrappers with POSIXy semantics. 
 
#define posixy_rename(F, T)
 
int io_open_block_wr(const char *fname, bool anew)
Open a block-based file for writing. 
 
WritableDatabase open()
Construct a WritableDatabase object for a new, empty InMemory database. 
 
bool io_readahead_block(int, size_t, off_t, off_t=0)
Readahead block b size n bytes from file descriptor fd. 
 
Convert types to std::string. 
 
static void throw_block_error(const char *s, off_t b, int e=0)
 
Hierarchy of classes which Xapian can throw as exceptions. 
 
void io_write_block(int fd, const char *p, size_t n, off_t b, off_t o)
Write block b size n bytes from buffer p to file descriptor fd, offset o. 
 
string str(int value)
Convert int to std::string. 
 
bool io_tmp_rename(const std::string &tmp_file, const std::string &real_file)
Rename a temporary file to its final position. 
 
size_t io_read(int fd, char *p, size_t n, size_t min)
Read n bytes (or until EOF) into block pointed to by p from file descriptor fd. 
 
DatabaseCorruptError indicates database corruption was detected. 
 
Wrappers for low-level POSIX I/O routines. 
 
<unistd.h>, but with compat. 
 
Various assertion macros. 
 
DatabaseError indicates some sort of database related error.