13#if defined(OS_USE_OS_APP_CONFIG_H)
14#include <cmsis-plus/os-app-config.h>
34#pragma clang diagnostic ignored "-Wc++98-compat"
50 open (
const char* path,
int oflag, ...)
54 va_start(args, oflag);
55 io*
const ret =
vopen (path, oflag, args);
67 vopen (
const char* path,
int oflag, std::va_list args)
69#if defined(OS_TRACE_POSIX_IO_IO)
70 trace::printf (
"io::%s(\"%s\")\n", __func__, path ? path :
"");
95 int oret =
static_cast<device*
> (
io)->
vopen (path, oflag, args);
107 auto adjusted_path = path;
121 io = fs->vopen (adjusted_path, oflag, args);
133#if defined(OS_TRACE_POSIX_IO_IO)
144 type_ (static_cast<
type_t>(t))
146#if defined(OS_TRACE_POSIX_IO_IO)
155#if defined(OS_TRACE_POSIX_IO_IO)
167#if defined(OS_TRACE_POSIX_IO_IO)
171 if (!
impl ().do_is_opened ())
192#if defined(OS_TRACE_POSIX_IO_IO)
205#if defined(OS_TRACE_POSIX_IO_IO)
220#if defined(OS_TRACE_POSIX_IO_IO)
221 trace::printf (
"io::%s(0x0%X, %u) @%p\n", __func__, buf, nbyte,
this);
230 if (!
impl ().do_is_opened ())
236 if (!
impl ().do_is_connected ())
258 impl ().offset_ += ret;
261#if defined(OS_TRACE_POSIX_IO_IO)
262 trace::printf (
"io::%s(0x0%X, %u) @%p n=%d\n", __func__, buf, nbyte,
this,
271#if defined(OS_TRACE_POSIX_IO_IO)
272 trace::printf (
"io::%s(0x0%X, %u) @%p\n", __func__, buf, nbyte,
this);
281 if (!
impl ().do_is_opened ())
287 if (!
impl ().do_is_connected ())
311 impl ().offset_ += ret;
314#if defined(OS_TRACE_POSIX_IO_IO)
315 trace::printf (
"io::%s(0x0%X, %u) @%p n=%d\n", __func__, buf, nbyte,
this,
324#if defined(OS_TRACE_POSIX_IO_IO)
325 trace::printf (
"io::%s(0x0%X, %d) @%p\n", __func__, iov, iovcnt,
this);
340 if (!
impl ().do_is_opened ())
346 if (!
impl ().do_is_connected ())
358 impl ().offset_ += ret;
369 int ret =
vfcntl (cmd, args);
375#pragma GCC diagnostic push
376#if defined(__clang__)
377#elif defined(__GNUC__)
378#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
383#if defined(OS_TRACE_POSIX_IO_IO)
387 if (!
impl ().do_is_opened ())
393 if (!
impl ().do_is_connected ())
404#pragma GCC diagnostic pop
419#if defined(OS_TRACE_POSIX_IO_IO)
429 if (!
impl ().do_is_opened ())
435 if (!
impl ().do_is_connected ())
450#if defined(OS_TRACE_POSIX_IO_IO)
451 trace::printf (
"io::%s(%d, %d) @%p\n", __func__, offset, whence,
this);
454 if (!
impl ().do_is_opened ())
470#if defined(OS_TRACE_POSIX_IO_IO)
477#if defined(OS_TRACE_POSIX_IO_IO)
488#pragma GCC diagnostic push
489#if defined(__clang__)
490#pragma clang diagnostic ignored "-Wunused-parameter"
491#elif defined(__GNUC__)
492#pragma GCC diagnostic ignored "-Wunused-parameter"
493#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
507 const iovec* p = iov;
508 for (
int i = 0; i < iovcnt; ++i, ++p)
541#pragma GCC diagnostic pop
static value_type * identify_device(const char *path)
static int deallocate(file_descriptor_t fildes)
static int allocate(class io *io)
static file_system * identify_mounted(const char **path1, const char **path2=nullptr)
virtual bool do_is_connected(void)
virtual int do_close(void)=0
virtual ssize_t do_writev(const iovec *iov, int iovcnt)
virtual int do_vfcntl(int cmd, std::va_list args)
virtual int do_isatty(void)
virtual ssize_t do_write(const void *buf, std::size_t nbyte)=0
virtual void do_deallocate(void)
virtual ssize_t do_read(void *buf, std::size_t nbyte)=0
virtual int do_fstat(struct stat *buf)
virtual off_t do_lseek(off_t offset, int whence)=0
virtual ssize_t writev(const iovec *iov, int iovcnt)
file_descriptor_t file_descriptor(void) const
io(io_impl &impl, type t)
virtual off_t lseek(off_t offset, int whence)
io * alloc_file_descriptor(void)
io_impl & impl(void) const
virtual int fstat(struct stat *buf)
virtual ssize_t write(const void *buf, std::size_t nbyte)
void clear_file_descriptor(void)
virtual ssize_t read(void *buf, std::size_t nbyte)
virtual int vfcntl(int cmd, std::va_list args)
int printf(const char *format,...)
Write a formatted string to the trace device.
io * open(const char *path, int oflag,...)
io * vopen(const char *path, int oflag, std::va_list args)
int stat(const char *path, struct stat *buf)
constexpr file_descriptor_t no_file_descriptor