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