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