40#pragma clang diagnostic ignored "-Wc++98-compat"
56#if defined(OS_TRACE_POSIX_IO_DEVICE)
57 trace::printf (
"device::%s(\"%s\")=%p\n", __func__, name_,
this);
63#if defined(OS_TRACE_POSIX_IO_DEVICE)
67 registry_links_.unlink ();
79 va_start(args, oflag);
80 int ret =
vopen (path, oflag, args);
89#if defined(OS_TRACE_POSIX_IO_DEVICE)
90 trace::printf (
"device::%s(\"%s\") @%p\n", __func__, path ? path :
"",
97 if (
impl ().open_count_ == 0)
114 ++(
impl ().open_count_);
116#if defined(OS_TRACE_POSIX_IO_DEVICE)
118 path ? path :
"",
this, ret);
127#if defined(OS_TRACE_POSIX_IO_DEVICE)
134 if (
impl ().open_count_ == 1)
139 if (
impl ().open_count_ > 0)
142 --(
impl ().open_count_);
153 va_start(args, request);
154 int ret =
vioctl (request, args);
163#if defined(OS_TRACE_POSIX_IO_DEVICE)
164 trace::printf (
"device::%s(%d) @%p\n", __func__, request,
this);
167 if (
impl ().open_count_ == 0)
181#if defined(OS_TRACE_POSIX_IO_DEVICE)
185 if (
impl ().open_count_ == 0)
199 assert(
name !=
nullptr);
200 assert(name_ !=
nullptr);
202 return (std::strcmp (
name, name_) == 0);
209#if defined(OS_TRACE_POSIX_IO_DEVICE)
216#if defined(OS_TRACE_POSIX_IO_DEVICE)
226 return (open_count_ > 0);
virtual int do_vioctl(int request, std::va_list args)=0
virtual ~device_impl() override
virtual bool do_is_opened(void) override
virtual void do_sync(void)=0
virtual int do_vopen(const char *path, int oflag, std::va_list args)=0
device(device_impl &impl, type t, const char *name)
device_impl & impl(void) const
virtual int close(void) override
virtual bool match_name(const char *name) const
int vopen(const char *path, int oflag, std::va_list args)
virtual int vioctl(int request, std::va_list args)
int ioctl(int request,...)
virtual ~device() override
int open(const char *path=nullptr, int oflag=0,...)
const char * name(void) const
file_descriptor_t file_descriptor(void) const
io * alloc_file_descriptor(void)
int printf(const char *format,...)
Write a formatted string to the trace device.