µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
char-device.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ distribution.
3 * (https://github.com/micro-os-plus)
4 * Copyright (c) 2015-2023 Liviu Ionescu. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software
7 * for any purpose is hereby granted, under the terms of the MIT license.
8 *
9 * If a copy of the license was not distributed with this file, it can
10 * be obtained from https://opensource.org/licenses/mit/.
11 */
12
13#if defined(OS_USE_OS_APP_CONFIG_H)
14#include <cmsis-plus/os-app-config.h>
15#endif
16
19
20#include <cstring>
21#include <cassert>
22#include <cerrno>
23
24// ----------------------------------------------------------------------------
25
26#if defined(__clang__)
27#pragma clang diagnostic ignored "-Wc++98-compat"
28#endif
29
30// ----------------------------------------------------------------------------
31
32namespace os
33{
34 namespace posix
35 {
36 // ========================================================================
37
38 char_device::char_device (char_device_impl& impl, const char* name) :
39 device
41 {
42#if defined(OS_TRACE_POSIX_IO_CHAR_DEVICE)
43 trace::printf ("char_device::%s(\"%s\")=@%p\n", __func__, name_, this);
44#endif
45
47 }
48
50 {
51#if defined(OS_TRACE_POSIX_IO_CHAR_DEVICE)
52 trace::printf ("char_device::%s() @%p %s\n", __func__, this, name_);
53#endif
54
55 registry_links_.unlink ();
56
57 name_ = nullptr;
58 }
59
60 // ========================================================================
61
63 {
64#if defined(OS_TRACE_POSIX_IO_CHAR_DEVICE)
65 trace::printf ("char_device_impl::%s()=@%p\n", __func__, this);
66#endif
67 }
68
70 {
71#if defined(OS_TRACE_POSIX_IO_CHAR_DEVICE)
72 trace::printf ("char_device_impl::%s() @%p\n", __func__, this);
73#endif
74 }
75
76#pragma GCC diagnostic push
77#if defined(__clang__)
78#pragma clang diagnostic ignored "-Wunused-parameter"
79#elif defined(__GNUC__)
80#pragma GCC diagnostic ignored "-Wunused-parameter"
81#endif
82
83 off_t
84 char_device_impl::do_lseek (off_t offset, int whence)
85 {
86 errno = ENOSYS; // Not implemented
87 return -1;
88 }
89
90#pragma GCC diagnostic pop
91
92 void
94 {
95 errno = ENOSYS; // Not implemented
96 }
97
98 // ==========================================================================
99 } /* namespace posix */
100} /* namespace os */
101
102// ----------------------------------------------------------------------------
virtual off_t do_lseek(off_t offset, int whence) override
virtual ~char_device_impl() override
virtual void do_sync(void) override
char_device_impl & impl(void) const
virtual ~char_device() override
static void link(value_type *device)
Base device class.
Definition device.h:68
const char * name(void) const
Definition device.h:307
int printf(const char *format,...)
Write a formatted string to the trace device.
Definition trace.cpp:60
System namespace.