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