µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
types.h
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#ifndef CMSIS_PLUS_POSIX_IO_TYPES_H_
14#define CMSIS_PLUS_POSIX_IO_TYPES_H_
15
16// ----------------------------------------------------------------------------
17
18#include <sys/types.h>
19#include <sys/select.h>
20
24
25// ----------------------------------------------------------------------------
26
27#ifdef __cplusplus
28
29// ----------------------------------------------------------------------------
30
31#pragma GCC diagnostic push
32#if defined(__clang__)
33#pragma clang diagnostic ignored "-Wc++98-compat"
34#endif
35
36// ----------------------------------------------------------------------------
37
38namespace os
39{
40 namespace posix
41 {
42
43 using file_descriptor_t = int;
44
46
47 } /* namespace posix */
48} /* namespace os */
49
50
51#pragma GCC diagnostic pop
52
53#endif /* __cplusplus */
54
55#pragma GCC diagnostic push
56#if defined(__clang__)
57#pragma clang diagnostic ignored "-Wreserved-identifier"
58#endif
59
60#ifdef __cplusplus
61extern "C"
62{
63#endif
64
65 // The standard POSIX IO functions. Prototypes are from:
66 // http://pubs.opengroup.org/onlinepubs/9699919799/nframe.html
67
68 // The socket definitions are from:
69 // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
70
71 int __attribute__((weak))
72 __posix_accept (int socket, struct sockaddr* address, socklen_t* address_len);
73
74 int __attribute__((weak))
75 __posix_bind (int socket, const struct sockaddr* address,
76 socklen_t address_len);
77
78 int __attribute__((weak))
79 __posix_chdir (const char* path);
80
81 int __attribute__((weak))
82 __posix_chmod (const char* path, mode_t mode);
83
84 int __attribute__((weak))
85 __posix_chown (const char* path, uid_t owner, gid_t group);
86
87 clock_t __attribute__((weak))
88 __posix_clock (void);
89
90 int __attribute__((weak))
91 __posix_close (int fildes);
92
93 int __attribute__((weak))
94 __posix_closedir (DIR* dirp);
95
96 int __attribute__((weak))
97 __posix_connect (int socket, const struct sockaddr* address,
98 socklen_t address_len);
99
100 int __attribute__((weak))
101 __posix_execve (const char* path, char* const argv[], char* const envp[]);
102
103 int __attribute__((weak))
104 __posix_fcntl (int fildes, int cmd, ...);
105
106 pid_t __attribute__((weak))
107 __posix_fork (void);
108
109 int __attribute__((weak))
110 __posix_fstat (int fildes, struct stat* buf);
111
112 int __attribute__((weak))
113 __posix_fstatvfs (int fildes, struct statvfs* buf);
114
115 int __attribute__((weak))
116 __posix_ftruncate (int fildes, off_t length);
117
118 int __attribute__((weak))
119 __posix_fsync (int fildes);
120
121 char*
122 __attribute__((weak))
123 __posix_getcwd (char* buf, size_t size);
124
125 int __attribute__((weak))
126 __posix_getpeername (int socket, struct sockaddr* address,
127 socklen_t* address_len);
128
129 pid_t __attribute__((weak))
130 __posix_getpid (void);
131
132 int __attribute__((weak))
133 __posix_getsockname (int socket, struct sockaddr* address,
134 socklen_t* address_len);
135
136 int __attribute__((weak))
137 __posix_getsockopt (int socket, int level, int option_name,
138 void* option_value, socklen_t* option_len);
139
140 int __attribute__((weak))
141 __posix_gettimeofday (struct timeval* ptimeval, void* ptimezone);
142
143 int __attribute__((weak))
144 __posix_ioctl (int fildes, int request, ...);
145
158 int __attribute__((weak))
159 __posix_isatty (int fildes);
160
161 int __attribute__((weak))
162 __posix_kill (pid_t pid, int sig);
163
164 int __attribute__((weak))
165 __posix_link (const char* existing, const char* _new);
166
167 int __attribute__((weak))
168 __posix_listen (int socket, int backlog);
169
170 off_t __attribute__((weak))
171 __posix_lseek (int fildes, off_t offset, int whence);
172
173 int __attribute__((weak))
174 __posix_mkdir (const char* path, mode_t mode);
175
191 int __attribute__((weak))
192 __posix_open (const char* path, int oflag, ...);
193
194 DIR*
195 __attribute__((weak))
196 __posix_opendir (const char* dirname);
197
198 int __attribute__((weak))
199 __posix_raise (int sig);
200
201 ssize_t __attribute__((weak))
202 __posix_read (int fildes, void* buf, size_t nbyte);
203
204 struct dirent*
205 __attribute__((weak))
206 __posix_readdir (DIR* dirp);
207
208 int __attribute__((weak))
209 __posix_readdir_r (DIR* dirp, struct dirent* entry, struct dirent** result);
210
211 ssize_t __attribute__((weak))
212 __posix_readlink (const char* path, char* buf, size_t bufsize);
213
214 ssize_t __attribute__((weak))
215 __posix_recv (int socket, void* buffer, size_t length, int flags);
216
217 ssize_t __attribute__((weak))
218 __posix_recvfrom (int socket, void* buffer, size_t length, int flags,
219 struct sockaddr* address, socklen_t* address_len);
220
221 ssize_t __attribute__((weak))
222 __posix_recvmsg (int socket, struct msghdr* message, int flags);
223
224 int __attribute__((weak))
225 __posix_rename (const char* oldfn, const char* newfn);
226
227 void __attribute__((weak))
228 __posix_rewinddir (DIR* dirp);
229
230 int __attribute__((weak))
231 __posix_rmdir (const char* path);
232
233 int __attribute__((weak))
234 __posix_select (int nfds, fd_set* readfds, fd_set* writefds, fd_set* errorfds,
235 struct timeval* timeout);
236
237 ssize_t __attribute__((weak))
238 __posix_send (int socket, const void* buffer, size_t length, int flags);
239
240 ssize_t __attribute__((weak))
241 __posix_sendmsg (int socket, const struct msghdr* message, int flags);
242
243 ssize_t __attribute__((weak))
244 __posix_sendto (int socket, const void* message, size_t length, int flags,
245 const struct sockaddr* dest_addr, socklen_t dest_len);
246
247 int __attribute__((weak))
248 __posix_setsockopt (int socket, int level, int option_name,
249 const void* option_value, socklen_t option_len);
250
251 int __attribute__((weak))
252 __posix_shutdown (int socket, int how);
253
254 int __attribute__((weak))
256
257 int __attribute__((weak))
258 __posix_socket (int domain, int type, int protocol);
259
260 int __attribute__((weak))
261 __posix_socketpair (int domain, int type, int protocol, int socket_vector[2]);
262
263 int __attribute__((weak))
264 __posix_stat (const char* path, struct stat* buf);
265
266 int __attribute__((weak))
267 __posix_statvfs (const char* path, struct statvfs* buf);
268
269 void __attribute__((weak))
270 __posix_sync (void);
271
272 int __attribute__((weak))
273 __posix_symlink (const char* existing, const char* _new);
274
275 int __attribute__((weak))
276 __posix_system (const char *command);
277
278 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcdrain.html
279 int __attribute__((weak))
280 __posix_tcdrain (int fildes);
281
282 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcflush.html
283 int __attribute__((weak))
284 __posix_tcflush (int fildes, int queue_selector);
285
286 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcgetattr.html
287 int __attribute__((weak))
288 __posix_tcgetattr (int fildes, struct termios *termios_p);
289
290 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcsendbreak.html
291 int __attribute__((weak))
292 __posix_tcsendbreak (int fildes, int duration);
293
294 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcsetattr.html
295 int __attribute__((weak))
296 __posix_tcsetattr (int fildes, int optional_actions,
297 const struct termios *termios_p);
298
299 clock_t __attribute__((weak))
300 __posix_times (struct tms* buf);
301
302 int __attribute__((weak))
303 __posix_truncate (const char* path, off_t length);
304
305 int __attribute__((weak))
306 __posix_unlink (const char* name);
307
308 int __attribute__((weak))
309 __posix_utime (const char* path, const struct utimbuf* times);
310
311 pid_t __attribute__((weak))
312 __posix_wait (int* stat_loc);
313
314 ssize_t __attribute__((weak))
315 __posix_write (int fildes, const void* buf, size_t nbyte);
316
317 ssize_t __attribute__((weak))
318 __posix_writev (int fildes, const struct iovec* iov, int iovcnt);
319
320 // --------------------------------------------------------------------------
321
322 // os-hooks.h
323 // void
324 // os_startup_initialize_args (int* p_argc, char*** p_argv);
325
326#ifdef __cplusplus
327}
328#endif
329
330#pragma GCC diagnostic push
331
332// ----------------------------------------------------------------------------
333
334#endif /* CMSIS_PLUS_POSIX_IO_TYPES_H_ */
int stat(const char *path, struct stat *buf)
clock_t times(struct tms *buf)
int socket(int domain, int type, int protocol)
int file_descriptor_t
Definition types.h:43
constexpr file_descriptor_t no_file_descriptor
Definition types.h:45
System namespace.
uint32_t socklen_t
#define __posix_select
#define __posix_sockatmark
#define __posix_wait
#define __posix_getsockopt
#define __posix_rewinddir
#define __posix_kill
#define __posix_lseek
#define __posix_chmod
#define __posix_chown
#define __posix_raise
#define __posix_shutdown
#define __posix_readlink
#define __posix_writev
#define __posix_truncate
#define __posix_fstat
#define __posix_stat
#define __posix_recvfrom
#define __posix_getcwd
#define __posix_readdir_r
#define __posix_close
#define __posix_recv
#define __posix_link
#define __posix_read
#define __posix_fcntl
#define __posix_sendto
#define __posix_symlink
#define __posix_getsockname
#define __posix_gettimeofday
#define __posix_ioctl
#define __posix_setsockopt
#define __posix_socketpair
#define __posix_send
#define __posix_rmdir
#define __posix_times
#define __posix_readdir
#define __posix_closedir
#define __posix_write
#define __posix_listen
#define __posix_open
#define __posix_mkdir
#define __posix_rename
#define __posix_socket
#define __posix_isatty
#define __posix_unlink
#define __posix_recvmsg
#define __posix_ftruncate
#define __posix_accept
#define __posix_utime
#define __posix_bind
#define __posix_opendir
#define __posix_fsync
#define __posix_connect
#define __posix_getpeername
#define __posix_system
#define __posix_chdir
#define __posix_execve
#define __posix_sendmsg
Definition dirent.h:57
Definition uio.h:41
int __posix_tcgetattr(int fildes, struct termios *termios_p)
int __posix_statvfs(const char *path, struct statvfs *buf)
void __posix_sync(void)
pid_t __posix_getpid(void)
pid_t __posix_fork(void)
clock_t __posix_clock(void)
int __posix_tcflush(int fildes, int queue_selector)
int __posix_fstatvfs(int fildes, struct statvfs *buf)
int __posix_tcdrain(int fildes)
int __posix_tcsetattr(int fildes, int optional_actions, const struct termios *termios_p)
int __posix_tcsendbreak(int fildes, int duration)