µ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 Liviu Ionescu.
5 *
6 * Permission is hereby granted, free of charge, to any person
7 * obtaining a copy of this software and associated documentation
8 * files (the "Software"), to deal in the Software without
9 * restriction, including without limitation the rights to use,
10 * copy, modify, merge, publish, distribute, sublicense, and/or
11 * sell copies of the Software, and to permit persons to whom
12 * the Software is furnished to do so, subject to the following
13 * conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */
27
28#ifndef CMSIS_PLUS_POSIX_IO_TYPES_H_
29#define CMSIS_PLUS_POSIX_IO_TYPES_H_
30
31// ----------------------------------------------------------------------------
32
33#include <sys/types.h>
34#include <sys/select.h>
35
39
40// ----------------------------------------------------------------------------
41
42#ifdef __cplusplus
43
44// ----------------------------------------------------------------------------
45
46#pragma GCC diagnostic push
47
48#if defined(__clang__)
49#pragma clang diagnostic ignored "-Wc++98-compat"
50#endif
51
52// ----------------------------------------------------------------------------
53
54namespace os
55{
56 namespace posix
57 {
58
59 using file_descriptor_t = int;
60
62
63 } /* namespace posix */
64} /* namespace os */
65
66
67#pragma GCC diagnostic pop
68
69#endif /* __cplusplus */
70
71#ifdef __cplusplus
72extern "C"
73{
74#endif
75
76 // The standard POSIX IO functions. Prototypes are from:
77 // http://pubs.opengroup.org/onlinepubs/9699919799/nframe.html
78
79 // The socket definitions are from:
80 // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
81
82 int __attribute__((weak))
83 __posix_accept (int socket, struct sockaddr* address, socklen_t* address_len);
84
85 int __attribute__((weak))
86 __posix_bind (int socket, const struct sockaddr* address,
87 socklen_t address_len);
88
89 int __attribute__((weak))
90 __posix_chdir (const char* path);
91
92 int __attribute__((weak))
93 __posix_chmod (const char* path, mode_t mode);
94
95 int __attribute__((weak))
96 __posix_chown (const char* path, uid_t owner, gid_t group);
97
98 clock_t __attribute__((weak))
99 __posix_clock (void);
100
101 int __attribute__((weak))
102 __posix_close (int fildes);
103
104 int __attribute__((weak))
105 __posix_closedir (DIR* dirp);
106
107 int __attribute__((weak))
108 __posix_connect (int socket, const struct sockaddr* address,
109 socklen_t address_len);
110
111 int __attribute__((weak))
112 __posix_execve (const char* path, char* const argv[], char* const envp[]);
113
114 int __attribute__((weak))
115 __posix_fcntl (int fildes, int cmd, ...);
116
117 pid_t __attribute__((weak))
118 __posix_fork (void);
119
120 int __attribute__((weak))
121 __posix_fstat (int fildes, struct stat* buf);
122
123 int __attribute__((weak))
124 __posix_fstatvfs (int fildes, struct statvfs* buf);
125
126 int __attribute__((weak))
127 __posix_ftruncate (int fildes, off_t length);
128
129 int __attribute__((weak))
130 __posix_fsync (int fildes);
131
132 char*
133 __attribute__((weak))
134 __posix_getcwd (char* buf, size_t size);
135
136 int __attribute__((weak))
137 __posix_getpeername (int socket, struct sockaddr* address,
138 socklen_t* address_len);
139
140 pid_t __attribute__((weak))
141 __posix_getpid (void);
142
143 int __attribute__((weak))
144 __posix_getsockname (int socket, struct sockaddr* address,
145 socklen_t* address_len);
146
147 int __attribute__((weak))
148 __posix_getsockopt (int socket, int level, int option_name,
149 void* option_value, socklen_t* option_len);
150
151 int __attribute__((weak))
152 __posix_gettimeofday (struct timeval* ptimeval, void* ptimezone);
153
154 int __attribute__((weak))
155 __posix_ioctl (int fildes, int request, ...);
156
169 int __attribute__((weak))
170 __posix_isatty (int fildes);
171
172 int __attribute__((weak))
173 __posix_kill (pid_t pid, int sig);
174
175 int __attribute__((weak))
176 __posix_link (const char* existing, const char* _new);
177
178 int __attribute__((weak))
179 __posix_listen (int socket, int backlog);
180
181 off_t __attribute__((weak))
182 __posix_lseek (int fildes, off_t offset, int whence);
183
184 int __attribute__((weak))
185 __posix_mkdir (const char* path, mode_t mode);
186
202 int __attribute__((weak))
203 __posix_open (const char* path, int oflag, ...);
204
205 DIR*
206 __attribute__((weak))
207 __posix_opendir (const char* dirname);
208
209 int __attribute__((weak))
210 __posix_raise (int sig);
211
212 ssize_t __attribute__((weak))
213 __posix_read (int fildes, void* buf, size_t nbyte);
214
215 struct dirent*
216 __attribute__((weak))
217 __posix_readdir (DIR* dirp);
218
219 int __attribute__((weak))
220 __posix_readdir_r (DIR* dirp, struct dirent* entry, struct dirent** result);
221
222 ssize_t __attribute__((weak))
223 __posix_readlink (const char* path, char* buf, size_t bufsize);
224
225 ssize_t __attribute__((weak))
226 __posix_recv (int socket, void* buffer, size_t length, int flags);
227
228 ssize_t __attribute__((weak))
229 __posix_recvfrom (int socket, void* buffer, size_t length, int flags,
230 struct sockaddr* address, socklen_t* address_len);
231
232 ssize_t __attribute__((weak))
233 __posix_recvmsg (int socket, struct msghdr* message, int flags);
234
235 int __attribute__((weak))
236 __posix_rename (const char* oldfn, const char* newfn);
237
238 void __attribute__((weak))
239 __posix_rewinddir (DIR* dirp);
240
241 int __attribute__((weak))
242 __posix_rmdir (const char* path);
243
244 int __attribute__((weak))
245 __posix_select (int nfds, fd_set* readfds, fd_set* writefds, fd_set* errorfds,
246 struct timeval* timeout);
247
248 ssize_t __attribute__((weak))
249 __posix_send (int socket, const void* buffer, size_t length, int flags);
250
251 ssize_t __attribute__((weak))
252 __posix_sendmsg (int socket, const struct msghdr* message, int flags);
253
254 ssize_t __attribute__((weak))
255 __posix_sendto (int socket, const void* message, size_t length, int flags,
256 const struct sockaddr* dest_addr, socklen_t dest_len);
257
258 int __attribute__((weak))
259 __posix_setsockopt (int socket, int level, int option_name,
260 const void* option_value, socklen_t option_len);
261
262 int __attribute__((weak))
263 __posix_shutdown (int socket, int how);
264
265 int __attribute__((weak))
267
268 int __attribute__((weak))
269 __posix_socket (int domain, int type, int protocol);
270
271 int __attribute__((weak))
272 __posix_socketpair (int domain, int type, int protocol, int socket_vector[2]);
273
274 int __attribute__((weak))
275 __posix_stat (const char* path, struct stat* buf);
276
277 int __attribute__((weak))
278 __posix_statvfs (const char* path, struct statvfs* buf);
279
280 void __attribute__((weak))
281 __posix_sync (void);
282
283 int __attribute__((weak))
284 __posix_symlink (const char* existing, const char* _new);
285
286 int __attribute__((weak))
287 __posix_system (const char *command);
288
289 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcdrain.html
290 int __attribute__((weak))
291 __posix_tcdrain (int fildes);
292
293 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcflush.html
294 int __attribute__((weak))
295 __posix_tcflush (int fildes, int queue_selector);
296
297 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcgetattr.html
298 int __attribute__((weak))
299 __posix_tcgetattr (int fildes, struct termios *termios_p);
300
301 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcsendbreak.html
302 int __attribute__((weak))
303 __posix_tcsendbreak (int fildes, int duration);
304
305 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcsetattr.html
306 int __attribute__((weak))
307 __posix_tcsetattr (int fildes, int optional_actions,
308 const struct termios *termios_p);
309
310 clock_t __attribute__((weak))
311 __posix_times (struct tms* buf);
312
313 int __attribute__((weak))
314 __posix_truncate (const char* path, off_t length);
315
316 int __attribute__((weak))
317 __posix_unlink (const char* name);
318
319 int __attribute__((weak))
320 __posix_utime (const char* path, const struct utimbuf* times);
321
322 pid_t __attribute__((weak))
323 __posix_wait (int* stat_loc);
324
325 ssize_t __attribute__((weak))
326 __posix_write (int fildes, const void* buf, size_t nbyte);
327
328 ssize_t __attribute__((weak))
329 __posix_writev (int fildes, const struct iovec* iov, int iovcnt);
330
331 // --------------------------------------------------------------------------
332
333 void
334 os_startup_initialize_args (int* p_argc, char*** p_argv);
335
336#ifdef __cplusplus
337}
338#endif
339
340// ----------------------------------------------------------------------------
341
342#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:59
constexpr file_descriptor_t no_file_descriptor
Definition types.h:61
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:72
Definition uio.h:56
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)
void os_startup_initialize_args(int *p_argc, char ***p_argv)
Definition startup.cpp:419
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)