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