42 mEmerg <<
"IO::~IO: " << (
void *) (
this) <<
" is not closed at destruction";
52 dInfo2<io> <<
"io_read(" << (
void *)
this <<
", " << buf <<
", " << count <<
")";
56 mos_warn(
"%p is already closed", (
void *)
this);
62 mInfo << (
void *)
this <<
" is not readable\n";
71 dInfo2<io> <<
"io_pread(" << (
void *)
this <<
", " << buf <<
", " << count <<
", " << offset <<
")";
75 mos_warn(
"%p is already closed", (
void *)
this);
81 mInfo << (
void *)
this <<
" is not readable\n";
87 mInfo << (
void *)
this <<
" is not seekable\n";
93 const size_t ret =
read(buf, count);
100 dInfo2<io> <<
"io_write(" << (
void *)
this <<
", " << buf <<
", " << count <<
")";
104 mos_warn(
"%p is already closed", (
void *)
this);
110 mInfo << (
void *)
this <<
" is not writable";
119 dInfo2<io> <<
"io_seek(" << (
void *)
this <<
", " << offset <<
", " << whence <<
")";
123 mos_warn(
"%p is already closed", (
void *)
this);
129 mInfo << (
void *)
this <<
" is not seekable";
133 return on_seek(offset, whence);
146 mos_warn(
"%p is already closed", (
void *) io);
152 mInfo << (
void *) io <<
" is not mmapable";
162 if (!may_mmap_writeable)
174 dInfo2<io> <<
"io_mmap(" << (
void *)
this <<
", " << (
void *) vmap <<
", " << offset <<
")";
181 if (!this->
on_mmap(vmap, offset))
185 mos_panic(
"vmap->on_fault is NULL, possibly buggy io->ops->mmap() implementation");
193 dInfo2<io> <<
"io_unmap(" << (
void *)
this <<
", " << (
void *) vmap <<
", " << (
void *) unmapped <<
")";
196 mos_warn(
"%p is already closed", (
void *)
this);
214 mos_warn(
"vmap->io->ops->unmap() failed");
224 MOS_UNREACHABLE_X(
"IO %p is readable but does not implement on_read", (
void *)
this);
230 MOS_UNREACHABLE_X(
"IO %p is writable but does not implement on_write", (
void *)
this);
236 MOS_UNREACHABLE_X(
"IO %p is mappable but does not implement on_mmap", (
void *)
this);
247 MOS_UNREACHABLE_X(
"IO %p is seekable but does not implement on_seek", (
void *)
this);
#define MOS_UNREACHABLE_X(msg,...)
#define mos_warn(fmt,...)
static NullIO io_null_impl
mos::string to_string(const void *value)
mos::basic_string< char > string
#define mos_panic(fmt,...)
virtual size_t pread(void *buf, size_t count, off_t offset) final
virtual mos::string name() const
virtual size_t read(void *buf, size_t count) final
virtual bool VerifyMMapPermissions(VMFlags flags, bool is_private) final
bool unmap(vmap_t *vmap, bool *unmapped)
IO(IOFlags flags, io_type_t type)
virtual bool on_munmap(vmap_t *, bool *)
virtual size_t on_write(const void *, size_t)
virtual off_t tell() final
virtual off_t seek(off_t, io_seek_whence_t) final
bool map(vmap_t *vmap, off_t offset)
virtual size_t on_read(void *, size_t)
virtual size_t write(const void *buf, size_t count) final
virtual off_t on_seek(off_t, io_seek_whence_t)
virtual bool on_mmap(vmap_t *, off_t)
size_t on_write(const void *, size_t) override
void on_closed() override
size_t on_read(void *, size_t) override
vmfault_handler_t on_fault