/* * Constructs a _Tt_arg where the mode and type are known. * No valid data is yet known. * */ _Tt_arg:: _Tt_arg(Tt_mode m, _Tt_string &t) { constructor_common(); _mode = m; _type = t; }
_Tt_arg:: _Tt_arg(const char *t) { _Tt_string ts(t); constructor_common(); _type = ts; }
/* * Constructs a _Tt_arg where the mode and type are known. * No valid data is yet known. * */ _Tt_arg:: _Tt_arg(Tt_mode m, const char *t) { _Tt_string ts(t); constructor_common(); _mode = m; _type = ts; }
FileDescriptor::FileDescriptor (const std::string& fname, bool sync_) throw (gu::Exception) : value (open (fname.c_str(), OPEN_FLAGS, S_IRUSR | S_IWUSR)), name (fname), size (lseek (value, 0, SEEK_END)), sync (sync_) { constructor_common(); }
FileDescriptor::FileDescriptor (const std::string& fname, size_t length, bool allocate, bool sync_) throw (gu::Exception) : value (open (fname.c_str(), CREATE_FLAGS, S_IRUSR | S_IWUSR)), name (fname), size (length), sync (sync_) { constructor_common(); off_t const current_size(lseek (value, 0, SEEK_END)); if (current_size < size) { if (allocate) { // reserve space that hasn't been reserved prealloc (current_size); } else { write_byte (size - 1); // reserve size } } else if (current_size > size) { log_info << "Truncating '" << name << "' to " << size << " bytes."; if (ftruncate(value, size)) { gu_throw_error(errno) << "Failed to truncate '" << name << "' to " << size << " bytes."; } } else { log_info << "Reusing existing '" << name << "'."; } }
RingBuffer::RingBuffer (const std::string& name, ssize_t size, std::map<int64_t, const void*> & seqno2ptr) : fd_ (name, check_size(size)), mmap_ (fd_), open_ (true), preamble_ (static_cast<char*>(mmap_.ptr)), header_ (reinterpret_cast<int64_t*>(preamble_ + PREAMBLE_LEN)), start_ (reinterpret_cast<uint8_t*>(header_ + HEADER_LEN)), end_ (reinterpret_cast<uint8_t*>(preamble_ + mmap_.size)), first_ (start_), next_ (first_), size_cache_(end_ - start_ - sizeof(BufferHeader)), size_free_ (size_cache_), size_used_ (0), size_trail_(0), // mallocs_ (0), // reallocs_ (0), seqno2ptr_ (seqno2ptr) { constructor_common (); BH_clear (BH_cast(next_)); }
_Tt_arg:: _Tt_arg(const _Tt_string &t) { constructor_common(); _type = t; }
/* * Construct a _Tt_arg with everything zeroed out */ _Tt_arg:: _Tt_arg() { constructor_common(); }