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