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