13#if defined(OS_USE_OS_APP_CONFIG_H)
14#include <cmsis-plus/os-app-config.h>
29#pragma clang diagnostic ignored "-Wc++98-compat"
45#if defined(OS_TRACE_POSIX_IO_DEVICE)
46 trace::printf (
"device::%s(\"%s\")=%p\n", __func__, name_,
this);
52#if defined(OS_TRACE_POSIX_IO_DEVICE)
56 registry_links_.unlink ();
68 va_start(args, oflag);
69 int ret =
vopen (path, oflag, args);
78#if defined(OS_TRACE_POSIX_IO_DEVICE)
79 trace::printf (
"device::%s(\"%s\") @%p\n", __func__, path ? path :
"",
86 if (
impl ().open_count_ == 0)
103 ++(
impl ().open_count_);
105#if defined(OS_TRACE_POSIX_IO_DEVICE)
107 path ? path :
"",
this, ret);
116#if defined(OS_TRACE_POSIX_IO_DEVICE)
123 if (
impl ().open_count_ == 1)
128 if (
impl ().open_count_ > 0)
131 --(
impl ().open_count_);
142 va_start(args, request);
143 int ret =
vioctl (request, args);
149#pragma GCC diagnostic push
150#if defined(__clang__)
151#elif defined(__GNUC__)
152#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
157#if defined(OS_TRACE_POSIX_IO_DEVICE)
158 trace::printf (
"device::%s(%d) @%p\n", __func__, request,
this);
161 if (
impl ().open_count_ == 0)
171#pragma GCC diagnostic pop
176#if defined(OS_TRACE_POSIX_IO_DEVICE)
180 if (
impl ().open_count_ == 0)
194 assert(
name !=
nullptr);
195 assert(name_ !=
nullptr);
197 return (std::strcmp (
name, name_) == 0);
204#if defined(OS_TRACE_POSIX_IO_DEVICE)
211#if defined(OS_TRACE_POSIX_IO_DEVICE)
221 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.