µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
c-syscalls-aliases-standard.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_C_POSIX_SYSCALLS_ALIASES_STANDARD_H_
29#define CMSIS_PLUS_POSIX_IO_C_POSIX_SYSCALLS_ALIASES_STANDARD_H_
30
31// ----------------------------------------------------------------------------
32
33#ifdef __cplusplus
34extern "C"
35{
36#endif
37
38 // --------------------------------------------------------------------------
39
45 // For embedded environment that use POSIX system calls, redefine
46 // all functions without the '__posix_' prefix.
47 int __attribute__((weak, alias ("__posix_accept")))
48 accept (int socket, struct sockaddr* address, socklen_t* address_len);
49
50 int __attribute__((weak, alias ("__posix_bind")))
51 bind (int socket, const struct sockaddr* address, socklen_t address_len);
52
53 int __attribute__((weak, alias ("__posix_chdir")))
54 chdir (const char* path);
55
56 int __attribute__((weak, alias ("__posix_chmod")))
57 chmod (const char* path, mode_t mode);
58
59 int __attribute__((weak, alias ("__posix_chown")))
60 chown (const char* path, uid_t owner, gid_t group);
61
62 clock_t __attribute__((weak, alias ("__posix_clock")))
63 clock (void);
64
65 int __attribute__((weak, alias ("__posix_close")))
66 close (int fildes);
67
68 int __attribute__((weak, alias ("__posix_closedir")))
69 closedir (DIR* dirp);
70
71 int __attribute__((weak, alias ("__posix_connect")))
72 connect (int socket, const struct sockaddr* address, socklen_t address_len);
73
74 int __attribute__((weak, alias ("__posix_execve")))
75 execve (const char* path, char* const argv[], char* const envp[]);
76
77 int __attribute__((weak, alias ("__posix_fcntl")))
78 fcntl (int fildes, int cmd, ...);
79
80 pid_t __attribute__((weak, alias ("__posix_fork")))
81 fork (void);
82
83 int __attribute__((weak, alias ("__posix_fstat")))
84 fstat (int fildes, struct stat* buf);
85
86 int __attribute__((weak, alias ("__posix_fstatvfs")))
87 fstatvfs (int fildes, struct statvfs* buf);
88
89 int __attribute__((weak, alias ("__posix_ftruncate")))
90 ftruncate (int fildes, off_t length);
91
92 int __attribute__((weak, alias ("__posix_fsync")))
93 fsync (int fildes);
94
95 char*
96 __attribute__((weak, alias ("__posix_getcwd")))
97 getcwd (char* buf, size_t size);
98
99 int __attribute__((weak, alias ("__posix_getpeername")))
100 getpeername (int socket, struct sockaddr* address, socklen_t* address_len);
101
102 pid_t __attribute__((weak, alias ("__posix_getpid")))
103 getpid (void);
104
105 int __attribute__((weak, alias ("__posix_getsockname")))
106 getsockname (int socket, struct sockaddr* address, socklen_t* address_len);
107
108 int __attribute__((weak, alias ("__posix_getsockopt")))
109 getsockopt (int socket, int level, int option_name, void* option_value,
110 socklen_t* option_len);
111
112 int __attribute__((weak, alias ("__posix_gettimeofday")))
113 gettimeofday (struct timeval* ptimeval, void* ptimezone);
114
115 int __attribute__((weak, alias ("__posix_ioctl")))
116 ioctl (int fildes, int request, ...);
117
118 int __attribute__((weak, alias ("__posix_isatty")))
119 isatty (int fildes);
120
121 int __attribute__((weak, alias ("__posix_kill")))
122 kill (pid_t pid, int sig);
123
124 int __attribute__((weak, alias ("__posix_link")))
125 link (const char* existing, const char* _new);
126
127 int __attribute__((weak, alias ("__posix_listen")))
128 listen (int socket, int backlog);
129
130 off_t __attribute__((weak, alias ("__posix_lseek")))
131 lseek (int fildes, off_t offset, int whence);
132
133 int __attribute__((weak, alias ("__posix_mkdir")))
134 mkdir (const char* path, mode_t mode);
135
136 int __attribute__((weak, alias ("__posix_open")))
137 open (const char* path, int oflag, ...);
138
139 // /**
140 // * @brief Open directory.
141 // * @param dirname [in] Directory name.
142 // * @return Pointer to DIR object.
143 // */
144 DIR*
145 __attribute__((weak, alias ("__posix_opendir")))
146 opendir (const char* dirname);
147
148 int __attribute__((weak, alias ("__posix_raise")))
149 raise (int sig);
150
151 ssize_t __attribute__((weak, alias ("__posix_read")))
152 read (int fildes, void* buf, size_t nbyte);
153
154 struct dirent*
155 __attribute__((weak, alias ("__posix_readdir")))
156 readdir (DIR* dirp);
157
158 int __attribute__((weak, alias ("__posix_readdir_r")))
159 readdir_r (DIR* dirp, struct dirent* entry, struct dirent** result);
160
161 ssize_t __attribute__((weak, alias ("__posix_readlink")))
162 readlink (const char* path, char* buf, size_t bufsize);
163
164 ssize_t __attribute__((weak, alias ("__posix_recv")))
165 recv (int socket, void* buffer, size_t length, int flags);
166
167 ssize_t __attribute__((weak, alias ("__posix_recvfrom")))
168 recvfrom (int socket, void* buffer, size_t length, int flags,
169 struct sockaddr* address, socklen_t* address_len);
170
171 ssize_t __attribute__((weak, alias ("__posix_recvmsg")))
172 recvmsg (int socket, struct msghdr* message, int flags);
173
174 int __attribute__((weak, alias ("__posix_rename")))
175 rename (const char* oldfn, const char* newfn);
176
177 void __attribute__((weak, alias ("__posix_rewinddir")))
178 rewinddir (DIR* dirp);
179
180 int __attribute__((weak, alias ("__posix_rmdir")))
181 rmdir (const char* path);
182
183 int __attribute__((weak, alias ("__posix_select")))
184 select (int nfds, fd_set* readfds, fd_set* writefds, fd_set* errorfds,
185 struct timeval* timeout);
186
187 ssize_t __attribute__((weak, alias ("__posix_send")))
188 send (int socket, const void* buffer, size_t length, int flags);
189
190 ssize_t __attribute__((weak, alias ("__posix_sendmsg")))
191 sendmsg (int socket, const struct msghdr* message, int flags);
192
193 ssize_t __attribute__((weak, alias ("__posix_sendto")))
194 sendto (int socket, const void* message, size_t length, int flags,
195 const struct sockaddr* dest_addr, socklen_t dest_len);
196
197 int __attribute__((weak, alias ("__posix_setsockopt")))
198 setsockopt (int socket, int level, int option_name, const void* option_value,
199 socklen_t option_len);
200
201 int __attribute__((weak, alias ("__posix_shutdown")))
202 shutdown (int socket, int how);
203
204 int __attribute__((weak, alias ("__posix_sockatmark")))
206
207 int __attribute__((weak, alias ("__posix_socket")))
208 socket (int domain, int type, int protocol);
209
210#if 0
211 int __attribute__((weak, alias ("__posix_socketpair")))
212 socketpair (int domain, int type, int protocol, int socket_vector[2]);
213#endif
214
215 int __attribute__((weak, alias ("__posix_stat")))
216 stat (const char* path, struct stat* buf);
217
218#pragma GCC diagnostic push
219#pragma GCC diagnostic ignored "-Wshadow"
220
221 int __attribute__((weak, alias ("__posix_statvfs")))
222 statvfs (const char* path, struct statvfs* buf);
223
224#pragma GCC diagnostic pop
225
226 void __attribute__((weak, alias ("__posix_sync")))
227 sync (void);
228
229 int __attribute__((weak, alias ("__posix_symlink")))
230 symlink (const char* existing, const char* _new);
231
232 int __attribute__((weak, alias ("__posix_system")))
233 system (const char *command);
234
235 int __attribute__((weak, alias ("__posix_tcdrain")))
236 tcdrain (int fildes);
237
238 int __attribute__((weak, alias ("__posix_tcflush")))
239 tcflush (int fildes, int queue_selector);
240
241 int __attribute__((weak, alias ("__posix_tcgetattr")))
242 tcgetattr (int fildes, struct termios *termios_p);
243
244 int __attribute__((weak, alias ("__posix_tcsendbreak")))
245 tcsendbreak (int fildes, int duration);
246
247 int __attribute__((weak, alias ("__posix_tcsetattr")))
248 tcsetattr (int fildes, int optional_actions, const struct termios *termios_p);
249
250 clock_t __attribute__((weak, alias ("__posix_times")))
251 times (struct tms* buf);
252
253 int __attribute__((weak, alias ("__posix_truncate")))
254 truncate (const char* path, off_t length);
255
256 int __attribute__((weak, alias ("__posix_unlink")))
257 unlink (const char* name);
258
259 int __attribute__((weak, alias ("__posix_utime")))
260 utime (const char* path, const struct utimbuf* times);
261
262 pid_t __attribute__((weak, alias ("__posix_wait")))
263 wait (int* stat_loc);
264
265 ssize_t __attribute__((weak, alias ("__posix_write")))
266 write (int fildes, const void* buf, size_t nbyte);
267
268 ssize_t __attribute__((weak, alias ("__posix_writev")))
269 writev (int fildes, const struct iovec* iov, int iovcnt);
270
275// --------------------------------------------------------------------------
276#ifdef __cplusplus
277}
278#endif
279
280#endif /* CMSIS_PLUS_POSIX_IO_C_POSIX_SYSCALLS_ALIASES_STANDARD_H_ */
281
282// ----------------------------------------------------------------------------
int shutdown(int socket, int how)
int chdir(const char *path)
int rename(const char *oldfn, const char *newfn)
int system(const char *command)
int tcdrain(int fildes)
int raise(int sig)
ssize_t recv(int socket, void *buffer, size_t length, int flags)
int tcsendbreak(int fildes, int duration)
pid_t wait(int *stat_loc)
int chown(const char *path, uid_t owner, gid_t group)
int unlink(const char *name)
int ioctl(int fildes, int request,...)
int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
int accept(int socket, struct sockaddr *address, socklen_t *address_len)
int ftruncate(int fildes, off_t length)
off_t lseek(int fildes, off_t offset, int whence)
ssize_t recvmsg(int socket, struct msghdr *message, int flags)
ssize_t sendmsg(int socket, const struct msghdr *message, int flags)
int stat(const char *path, struct stat *buf)
int symlink(const char *existing, const char *_new)
int kill(pid_t pid, int sig)
int sockatmark(int socket)
int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len)
int mkdir(const char *path, mode_t mode)
int bind(int socket, const struct sockaddr *address, socklen_t address_len)
int open(const char *path, int oflag,...)
int fsync(int fildes)
int tcsetattr(int fildes, int optional_actions, const struct termios *termios_p)
int tcgetattr(int fildes, struct termios *termios_p)
int execve(const char *path, char *const argv[], char *const envp[])
int getpeername(int socket, struct sockaddr *address, socklen_t *address_len)
clock_t times(struct tms *buf)
ssize_t readlink(const char *path, char *buf, size_t bufsize)
int gettimeofday(struct timeval *ptimeval, void *ptimezone)
ssize_t send(int socket, const void *buffer, size_t length, int flags)
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout)
struct dirent * readdir(DIR *dirp)
int truncate(const char *path, off_t length)
int getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
ssize_t write(int fildes, const void *buf, size_t nbyte)
pid_t fork(void)
int close(int fildes)
int closedir(DIR *dirp)
ssize_t sendto(int socket, const void *message, size_t length, int flags, const struct sockaddr *dest_addr, socklen_t dest_len)
int listen(int socket, int backlog)
int rmdir(const char *path)
ssize_t writev(int fildes, const struct iovec *iov, int iovcnt)
ssize_t recvfrom(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len)
int chmod(const char *path, mode_t mode)
int fstat(int fildes, struct stat *buf)
void sync(void)
pid_t getpid(void)
char * getcwd(char *buf, size_t size)
int fcntl(int fildes, int cmd,...)
int fstatvfs(int fildes, struct statvfs *buf)
void rewinddir(DIR *dirp)
clock_t clock(void)
ssize_t read(int fildes, void *buf, size_t nbyte)
DIR * opendir(const char *dirname)
int isatty(int fildes)
int link(const char *existing, const char *_new)
int utime(const char *path, const struct utimbuf *times)
int tcflush(int fildes, int queue_selector)
int getsockname(int socket, struct sockaddr *address, socklen_t *address_len)
int connect(int socket, const struct sockaddr *address, socklen_t address_len)
int socket(int domain, int type, int protocol)
int socketpair(int domain, int type, int protocol, int socket_vector[2])
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_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_clock
#define __posix_gettimeofday
#define __posix_ioctl
#define __posix_setsockopt
#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_getpid
#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_fork
#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_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)