35 #include <sys/types.h> 44 const string & filename,
45 string & changes_name)
47 changes_name = changeset_dir;
49 changes_name += filename;
50 int changes_fd =
posixy_open(changes_name.c_str(), O_WRONLY | O_CREAT | O_TRUNC |
O_CLOEXEC, 0666);
52 string message(
"Couldn't open changeset to write: ");
53 message += changes_name;
62 if (changes_fd != -1) {
63 io_write(changes_fd, buf.data(), bytes);
void io_write(int fd, const char *p, size_t n)
Write n bytes from block pointed to by p to file descriptor fd.
Provides wrappers with POSIXy semantics.
include <sys/stat.h> with portability enhancements
Hierarchy of classes which Xapian can throw as exceptions.
int create_changeset_file(const string &changeset_dir, const string &filename, string &changes_name)
Create a new changeset file, and return an open fd for writing to it.
Utility functions for replication implementations.
Wrappers for low-level POSIX I/O routines.
<unistd.h>, but with compat.
DatabaseError indicates some sort of database related error.
include <fcntl.h>, but working around broken platforms.
void write_and_clear_changes(int changes_fd, string &buf, size_t bytes)
Write some changes from a buffer, and then drop them from the buffer.