µ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-posix.cpp
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#if !defined(OS_USE_SEMIHOSTING_SYSCALLS)
29
30#include <cmsis-plus/rtos/os.h>
41
43
45
46#include <cstdarg>
47#include <cerrno>
48
49// ----------------------------------------------------------------------------
50
51#if defined(__clang__)
52#pragma clang diagnostic ignored "-Wc++98-compat"
53#endif
54
55// ----------------------------------------------------------------------------
56
57// Notes: Function prefix.
58//
59// To facilitate testing on POSIX platforms, and also to allow
60// integration on custom platforms, all function names are prefixed
61// with '__posix_'.
62// For embedded environments it is possible to also add aliases to the
63// standard, non-prefixed names, by adding the following preprocessor
64// definition: OS_INCLUDE_STANDARD_POSIX_FUNCTIONS
65
66// Notes: Reentrancy and 'errno'.
67//
68// The standard headers define errno as '*(__errno())';
69// If you use a multi-threaded environment, be sure you
70// redefine __errno() to return a thread specific pointer.
71
72// ----------------------------------------------------------------------------
73
74extern "C"
75{
76 void
78}
79
80// ----------------------------------------------------------------------------
81// ---- POSIX IO functions ----------------------------------------------------
82
83using namespace os;
84
85// ----------------------------------------------------------------------------
86
96int
97__posix_open (const char* path, int oflag, ...)
98{
99 va_list args;
100 va_start(args, oflag);
101 auto* const io = posix::vopen (path, oflag, args);
102 va_end(args);
103
104 if (io == nullptr)
105 {
106 // Return POSIX style error indicator.
107 return -1;
108 }
109
110 // Return non-negative POSIX file descriptor.
111 return io->file_descriptor ();
112}
113
114int
115__posix_close (int fildes)
116{
117 // The flow is identical for all POSIX functions: identify the C++
118 // object and call the corresponding C++ method.
119 auto* const io = posix::file_descriptors_manager::io (fildes);
120 if (io == nullptr)
121 {
122 errno = EBADF;
123 return -1;
124 }
125 return io->close ();
126}
127
128// ----------------------------------------------------------------------------
129
130ssize_t
131__posix_read (int fildes, void* buf, size_t nbyte)
132{
133 auto* const io = posix::file_descriptors_manager::io (fildes);
134 if (io == nullptr)
135 {
136 // STDIN
137 if (fildes == 0)
138 {
139 return 0; // Default empty input (EOF).
140 }
141 errno = EBADF;
142 return -1;
143 }
144 return io->read (buf, nbyte);
145}
146
147ssize_t
148__posix_write (int fildes, const void* buf, size_t nbyte)
149{
150 auto* const io = posix::file_descriptors_manager::io (fildes);
151 if (io == nullptr)
152 {
153 // STDOUT & STDERR
154 if (fildes == 1 || fildes == 2)
155 {
156 return trace_write (buf, nbyte); // Default output on trace.
157 }
158 errno = EBADF;
159 return -1;
160 }
161 return io->write (buf, nbyte);
162}
163
164ssize_t
165__posix_writev (int fildes, const struct iovec* iov, int iovcnt)
166{
167 auto* const io = posix::file_descriptors_manager::io (fildes);
168 if (io == nullptr)
169 {
170 errno = EBADF;
171 return -1;
172 }
173 return io->writev (iov, iovcnt);
174}
175
176int
177__posix_ioctl (int fildes, int request, ...)
178{
179 auto* const io = posix::file_descriptors_manager::io (fildes);
180 if (io == nullptr)
181 {
182 errno = EBADF;
183 return -1;
184 }
185
186 // Works only on STREAMS (CherDevices, in this implementation)
187 if ((io->get_type () & posix::io::type::char_device) == 0)
188 {
189 errno = ENOTTY; // Not a stream.
190 return -1;
191 }
192
193 va_list args;
194 va_start(args, request);
195 int ret = (static_cast<posix::char_device*> (io))->vioctl (request, args);
196 va_end(args);
197
198 return ret;
199}
200
201off_t
202__posix_lseek (int fildes, off_t offset, int whence)
203{
204 auto* const io = posix::file_descriptors_manager::io (fildes);
205 if (io == nullptr)
206 {
207 errno = EBADF; // Fildes is not an open file descriptor.
208 return -1;
209 }
210
211 // Works only on files (Does not work on sockets, pipes or FIFOs...)
212 if ((io->get_type () & posix::io::type::file) == 0)
213 {
214 errno = ESPIPE; // Not a file.
215 return -1;
216 }
217
218 return (static_cast<posix::file*> (io))->lseek (offset, whence);
219}
220
226int
227__posix_isatty (int fildes)
228{
229 auto* const io = posix::file_descriptors_manager::io (fildes);
230 if (io == nullptr)
231 {
232 if (fildes <= 2)
233 {
234 return true; // Default TTY for STDIN/OUT/ERR.
235 }
236 errno = EBADF;
237 return -1;
238 }
239 return io->isatty ();
240}
241
242int
243__posix_tcdrain (int fildes)
244{
245 auto* const io = posix::file_descriptors_manager::io (fildes);
246 if (io == nullptr)
247 {
248 errno = EBADF; // Fildes is not an open file descriptor.
249 return -1;
250 }
251
252 // Works only on tty...)
253 if ((io->get_type () & posix::io::type::tty) == 0)
254 {
255 errno = ESPIPE; // Not a tty.
256 return -1;
257 }
258
259 return (static_cast<posix::tty*> (io))->tcdrain ();
260}
261
262int
263__posix_tcgetattr (int fildes, struct termios *termios_p)
264{
265 auto* const io = posix::file_descriptors_manager::io (fildes);
266 if (io == nullptr)
267 {
268 errno = EBADF; // Fildes is not an open file descriptor.
269 return -1;
270 }
271
272 // Works only on tty...)
273 if ((io->get_type () & posix::io::type::tty) == 0)
274 {
275 errno = ESPIPE; // Not a tty.
276 return -1;
277 }
278
279 return (static_cast<posix::tty*> (io))->tcgetattr (termios_p);
280}
281
282int
283__posix_tcsetattr (int fildes, int optional_actions,
284 const struct termios *termios_p)
285{
286 auto* const io = posix::file_descriptors_manager::io (fildes);
287 if (io == nullptr)
288 {
289 errno = EBADF; // Fildes is not an open file descriptor.
290 return -1;
291 }
292
293 // Works only on tty...)
294 if ((io->get_type () & posix::io::type::tty) == 0)
295 {
296 errno = ESPIPE; // Not a tty.
297 return -1;
298 }
299
300 return (static_cast<posix::tty*> (io))->tcsetattr (optional_actions,
301 termios_p);
302}
303
304int
305__posix_tcflush (int fildes, int queue_selector)
306{
307 auto* const io = posix::file_descriptors_manager::io (fildes);
308 if (io == nullptr)
309 {
310 errno = EBADF; // Fildes is not an open file descriptor.
311 return -1;
312 }
313
314 // Works only on tty...)
315 if ((io->get_type () & posix::io::type::tty) == 0)
316 {
317 errno = ESPIPE; // Not a tty.
318 return -1;
319 }
320
321 return (static_cast<posix::tty*> (io))->tcflush (queue_selector);
322}
323
324int
325__posix_tcsendbreak (int fildes, int duration)
326{
327 auto* const io = posix::file_descriptors_manager::io (fildes);
328 if (io == nullptr)
329 {
330 errno = EBADF; // Fildes is not an open file descriptor.
331 return -1;
332 }
333
334 // Works only on tty...)
335 if ((io->get_type () & posix::io::type::tty) == 0)
336 {
337 errno = ESPIPE; // Not a tty.
338 return -1;
339 }
340
341 return (static_cast<posix::tty*> (io))->tcsendbreak (duration);
342}
343
344int
345__posix_fcntl (int fildes, int cmd, ...)
346{
347 auto* const io = posix::file_descriptors_manager::io (fildes);
348 if (io == nullptr)
349 {
350 errno = EBADF;
351 return -1;
352 }
353
354 va_list args;
355 va_start(args, cmd);
356 int ret = io->vfcntl (cmd, args);
357 va_end(args);
358
359 return ret;
360}
361
362int
363__posix_fstat (int fildes, struct stat* buf)
364{
365 auto* const io = posix::file_descriptors_manager::io (fildes);
366 if (io == nullptr)
367 {
368 errno = EBADF;
369 return -1;
370 }
371 return io->fstat (buf);
372}
373
374int
375__posix_fstatvfs (int fildes, struct statvfs* buf)
376{
377 auto* const io = posix::file_descriptors_manager::io (fildes);
378 if (io == nullptr)
379 {
380 errno = EBADF;
381 return -1;
382 }
383
384 // Works only on files (Does not work on sockets, pipes or FIFOs...)
385 if ((io->get_type () & posix::io::type::file) == 0)
386 {
387 errno = EINVAL; // Not a file.
388 return -1;
389 }
390
391 return (static_cast<posix::file*> (io))->fstatvfs (buf);
392}
393
394int
395__posix_ftruncate (int fildes, off_t length)
396{
397 auto* const io = posix::file_descriptors_manager::io (fildes);
398 if (io == nullptr)
399 {
400 errno = EBADF;
401 return -1;
402 }
403
404 // Works only on files (Does not work on sockets, pipes or FIFOs...)
405 if ((io->get_type () & posix::io::type::file) == 0)
406 {
407 errno = EINVAL; // Not a file.
408 return -1;
409 }
410
411 return (static_cast<posix::file*> (io))->ftruncate (length);
412}
413
414int
415__posix_fsync (int fildes)
416{
417 auto* const io = posix::file_descriptors_manager::io (fildes);
418 if (io == nullptr)
419 {
420 errno = EBADF;
421 return -1;
422 }
423
424 // Works only on files (Does not work on sockets, pipes or FIFOs...)
425 if ((io->get_type () & posix::io::type::file) == 0)
426 {
427 errno = EINVAL; // Not a file.
428 return -1;
429 }
430
431 return (static_cast<posix::file*> (io))->fsync ();
432}
433
434// ----------------------------------------------------------------------------
435// ----- POSIX file functions -----
436
437int
438__posix_chmod (const char* path, mode_t mode)
439{
440 return posix::chmod (path, mode);
441}
442
443int
444__posix_stat (const char* path, struct stat* buf)
445{
446 return posix::stat (path, buf);
447}
448
449int
450__posix_truncate (const char* path, off_t length)
451{
452 return posix::truncate (path, length);
453}
454
455int
456__posix_rename (const char* existing, const char* _new)
457{
458 return posix::rename (existing, _new);
459}
460
461int
462__posix_unlink (const char* path)
463{
464 return posix::unlink (path);
465}
466
467int
468__posix_utime (const char* path, const struct utimbuf* times)
469{
470 return posix::utime (path, times);
471}
472
473int
474__posix_statvfs (const char* path, struct statvfs* buf)
475{
476 return posix::statvfs (path, buf);
477}
478
479// ----------------------------------------------------------------------------
480// ----- POSIX file_system functions -----
481
482int
483__posix_mkdir (const char* path, mode_t mode)
484{
485 return posix::mkdir (path, mode);
486}
487
488int
489__posix_rmdir (const char* path)
490{
491 return posix::rmdir (path);
492}
493
494void
496{
497 return posix::sync ();
498}
499
500// ----------------------------------------------------------------------------
501// ----- Directories functions -----
502
503DIR*
504__posix_opendir (const char* dirpath)
505{
506 return reinterpret_cast<DIR*> (posix::opendir (dirpath));
507}
508
509struct dirent*
511{
512 auto* const dir = reinterpret_cast<posix::directory*> (dirp);
513 if (dir == nullptr)
514 {
515 errno = ENOENT;
516 return nullptr;
517 }
518 return dir->read ();
519}
520
521#if 0
522int
523__posix_readdir_r (DIR* dirp, struct dirent* entry, struct dirent** result)
524 {
525 errno = ENOSYS; // Not implemented
526 return ((ssize_t) -1);
527 }
528#endif
529
530void
532{
533 auto* const dir = reinterpret_cast<posix::directory*> (dirp);
534 if (dir == nullptr)
535 {
536 errno = ENOENT;
537 return;
538 }
539 return dir->rewind ();
540}
541
542int
544{
545 auto* const dir = reinterpret_cast<posix::directory*> (dirp);
546 if (dir == nullptr)
547 {
548 errno = ENOENT;
549 return -1;
550 }
551 return dir->close ();
552}
553
554// ----------------------------------------------------------------------------
555// Socket functions
556
557#pragma GCC diagnostic push
558#pragma GCC diagnostic ignored "-Wunused-parameter"
559
560// socket() and socketpair() are the fuctions creating sockets.
561// The other are socket specific functions.
562
563// In addition, the following IO functions should work on sockets:
564// close(), read(), write(), writev(), ioctl(), fcntl(), select().
565
566int
567__posix_socket (int domain, int type, int protocol)
568{
569 auto* const sock = posix::socket (domain, type, protocol);
570 if (sock == nullptr)
571 {
572 errno = EBADF;
573 return -1;
574 }
575 return sock->file_descriptor ();
576}
577
578#if 0
579int
580__posix_socketpair (int domain, int type, int protocol, int socket_vector[2])
581 {
582 errno = ENOSYS; // Not implemented
583 return -1;
584 }
585#endif
586
587int
588__posix_accept (int socket, struct sockaddr* address, socklen_t* address_len)
589{
591 if (io == nullptr)
592 {
593 errno = EBADF;
594 return -1;
595 }
596 auto* const new_socket = io->accept (address, address_len);
597 return new_socket->file_descriptor ();
598}
599
600int
601__posix_bind (int socket, const struct sockaddr* address, socklen_t address_len)
602{
604 if (io == nullptr)
605 {
606 errno = EBADF;
607 return -1;
608 }
609 return io->bind (address, address_len);
610}
611
612int
613__posix_connect (int socket, const struct sockaddr* address,
614 socklen_t address_len)
615{
617 if (io == nullptr)
618 {
619 errno = EBADF;
620 return -1;
621 }
622 return io->connect (address, address_len);
623}
624
625int
626__posix_getpeername (int socket, struct sockaddr* address,
627 socklen_t* address_len)
628{
630 if (io == nullptr)
631 {
632 errno = EBADF;
633 return -1;
634 }
635 return io->getpeername (address, address_len);
636}
637
638int
639__posix_getsockname (int socket, struct sockaddr* address,
640 socklen_t* address_len)
641{
643 if (io == nullptr)
644 {
645 errno = EBADF;
646 return -1;
647 }
648 return io->getsockname (address, address_len);
649}
650
651int
652__posix_getsockopt (int socket, int level, int option_name, void* option_value,
653 socklen_t* option_len)
654{
656 if (io == nullptr)
657 {
658 errno = EBADF;
659 return -1;
660 }
661 return io->getsockopt (level, option_name, option_value, option_len);
662}
663
664int
665__posix_listen (int socket, int backlog)
666{
668 if (io == nullptr)
669 {
670 errno = EBADF;
671 return -1;
672 }
673 return io->listen (backlog);
674}
675
676ssize_t
677__posix_recv (int socket, void* buffer, size_t length, int flags)
678{
680 if (io == nullptr)
681 {
682 errno = EBADF;
683 return -1;
684 }
685 return io->recv (buffer, length, flags);
686}
687
688ssize_t
689__posix_recvfrom (int socket, void* buffer, size_t length, int flags,
690 struct sockaddr* address, socklen_t* address_len)
691{
693 if (io == nullptr)
694 {
695 errno = EBADF;
696 return -1;
697 }
698 return io->recvfrom (buffer, length, flags, address, address_len);
699}
700
701ssize_t
702__posix_recvmsg (int socket, struct msghdr* message, int flags)
703{
705 if (io == nullptr)
706 {
707 errno = EBADF;
708 return -1;
709 }
710 return io->recvmsg (message, flags);
711}
712
713ssize_t
714__posix_send (int socket, const void* buffer, size_t length, int flags)
715{
717 if (io == nullptr)
718 {
719 errno = EBADF;
720 return -1;
721 }
722 return io->send (buffer, length, flags);
723}
724
725ssize_t
726__posix_sendmsg (int socket, const struct msghdr* message, int flags)
727{
729 if (io == nullptr)
730 {
731 errno = EBADF;
732 return -1;
733 }
734 return io->sendmsg (message, flags);
735}
736
737ssize_t
738__posix_sendto (int socket, const void* message, size_t length, int flags,
739 const struct sockaddr* dest_addr, socklen_t dest_len)
740{
742 if (io == nullptr)
743 {
744 errno = EBADF;
745 return -1;
746 }
747 return io->sendto (message, length, flags, dest_addr, dest_len);
748}
749
750int
751__posix_setsockopt (int socket, int level, int option_name,
752 const void* option_value, socklen_t option_len)
753{
755 if (io == nullptr)
756 {
757 errno = EBADF;
758 return -1;
759 }
760 return io->setsockopt (level, option_name, option_value, option_len);
761}
762
763int
765{
767 if (io == nullptr)
768 {
769 errno = EBADF;
770 return -1;
771 }
772 return io->shutdown (how);
773}
774
775int
777{
779 if (io == nullptr)
780 {
781 errno = EBADF;
782 return -1;
783 }
784 return io->sockatmark ();
785}
786
787#pragma GCC diagnostic pop
788
789// ----------------------------------------------------------------------------
790
791// These functions are defined here to avoid linker errors in free
792// standing applications. They might be called in some error cases
793// from library code.
794//
795// If you detect other functions needed, just let us know
796// and we'll add them.
797
798// ----------------------------------------------------------------------------
799
800#pragma GCC diagnostic push
801#pragma GCC diagnostic ignored "-Wunused-parameter"
802
803// ----------------------------------------------------------------------------
804// Not yet implemented.
805
806int __attribute__((weak))
807__posix_readdir_r (DIR* dirp, struct dirent* entry, struct dirent** result)
808{
809 errno = ENOSYS; // Not implemented
810 return -1;
811}
812
813int __attribute__((weak))
814__posix_socketpair (int domain, int type, int protocol, int socket_vector[2])
815{
816 errno = ENOSYS; // Not implemented
817 return -1;
818}
819
820int
821__posix_gettimeofday (struct timeval* ptimeval, void* ptimezone)
822{
823 ptimeval->tv_sec = static_cast<time_t> (os::rtos::rtclock.now ());
824 ptimeval->tv_usec = 0;
825
826 return 0;
827}
828
829int
830__posix_select (int nfds, fd_set* readfds, fd_set* writefds, fd_set* errorfds,
831 struct timeval* timeout)
832{
833 errno = ENOSYS; // Not implemented
834 return -1;
835}
836
837clock_t
838__posix_times (struct tms* buf)
839{
840 errno = ENOSYS; // Not implemented
841 return static_cast<clock_t> (-1);
842}
843
844int
845__posix_chdir (const char* path)
846{
847 errno = ENOSYS; // Not implemented
848 return -1;
849}
850
851char*
852__posix_getcwd (char* buf, size_t size)
853{
854 errno = ENOSYS; // Not implemented
855 return nullptr;
856}
857
858// ----------------------------------------------------------------------------
859// Unavailable in non-Unix embedded environments.
860
861clock_t
863{
864 errno = ENOSYS; // Not implemented
865 return static_cast<clock_t> (-1);
866}
867
868int
869__posix_execve (const char* path, char* const argv[], char* const envp[])
870{
871 errno = ENOSYS; // Not implemented
872 return -1;
873}
874
875pid_t
877{
878 errno = ENOSYS; // Not implemented
879 return static_cast<pid_t> (-1);
880}
881
882pid_t
884{
885 errno = ENOSYS; // Not implemented
886 return static_cast<pid_t> (-1);
887}
888
889int
890__posix_kill (pid_t pid, int sig)
891{
892 errno = ENOSYS; // Not implemented
893 return -1;
894}
895
896int
898{
899 errno = ENOSYS; // Not implemented
900 return -1;
901}
902
903int
904__posix_system (const char *command)
905{
906 errno = ENOSYS; // Not implemented
907 return -1;
908}
909
910pid_t
911__posix_wait (int* stat_loc)
912{
913 errno = ENOSYS; // Not implemented
914 return static_cast<pid_t> (-1);
915}
916
917int
918__posix_chown (const char* path, uid_t owner, gid_t group)
919{
920 errno = ENOSYS; // Not implemented
921 return -1;
922}
923
924int
925__posix_link (const char* existing, const char* _new)
926{
927 errno = ENOSYS; // Not implemented
928 return -1;
929}
930
931int
932__posix_symlink (const char* existing, const char* _new)
933{
934 errno = ENOSYS; // Not implemented
935 return -1;
936}
937
938ssize_t
939__posix_readlink (const char* path, char* buf, size_t bufsize)
940{
941 errno = ENOSYS; // Not implemented
942 return static_cast<ssize_t> (-1);
943}
944
945#pragma GCC diagnostic pop
946
947// `initialise_monitor_handles()` is a newlib libgloss function used to prepare
948// the stdio files when using semihosting. Better keep the name the same.
949
950void
952{
953 // Default STDIN, STDOUT, STDERR not required, the __posix_write()
954 // implementation defaults STDOUT/ERR to trace_write().
955}
956
957// ----------------------------------------------------------------------------
958
959#if defined(__ARM_EABI__) && (__STDC_HOSTED__ != 0)
960
961// The aliases must be in the same compilation unit as the names
962// they alias.
963
964#if defined(OS_INCLUDE_NEWLIB_POSIX_FUNCTIONS)
965
966// For special embedded environment that use POSIX system calls
967// with the newlib reentrant code, redefine
968// some functions with _name(), others directly with name().
969
971
972#else
973
974// For regular embedded environment that use POSIX system calls,
975// redefine **all** functions without the '__posix_' prefix.
976
978
979#endif
980
981#endif /* defined(__ARM_EABI__) && (__STDC_HOSTED__ != 0) */
982
983#endif /* !defined(OS_USE_SEMIHOSTING_SYSCALLS) */
984
985// ----------------------------------------------------------------------------
986
int __posix_tcgetattr(int fildes, struct termios *termios_p)
int __posix_statvfs(const char *path, struct statvfs *buf)
void __posix_sync(void)
pid_t __posix_getpid(void)
pid_t __posix_fork(void)
clock_t __posix_clock(void)
int __posix_tcflush(int fildes, int queue_selector)
int __posix_fstatvfs(int fildes, struct statvfs *buf)
int __posix_tcdrain(int fildes)
void initialise_monitor_handles(void)
int __posix_tcsetattr(int fildes, int optional_actions, const struct termios *termios_p)
int __posix_tcsendbreak(int fildes, int duration)
Char device class.
Definition char-device.h:69
Directory class.
Definition directory.h:81
virtual int close(void)
Definition directory.cpp:97
virtual struct dirent * read(void)
Definition directory.cpp:63
virtual void rewind(void)
Definition directory.cpp:81
static class socket * socket(int fildes)
File class.
Definition file.h:75
Network socket.
virtual timestamp_t now(void) override
Tell the current time adjusted for epoch.
int stat(const char *path, struct stat *buf)
clock_t times(struct tms *buf)
int socket(int domain, int type, int protocol)
int unlink(const char *path)
io * vopen(const char *path, int oflag, std::va_list args)
Definition io.cpp:78
int utime(const char *path, const struct utimbuf *times)
int rmdir(const char *path)
int statvfs(const char *path, struct statvfs *buf)
int rename(const char *existing, const char *_new)
int stat(const char *path, struct stat *buf)
int chmod(const char *path, mode_t mode)
int truncate(const char *path, off_t length)
void sync(void)
directory * opendir(const char *dirname)
Open directory.
int mkdir(const char *path, mode_t mode)
clock_rtc rtclock
The real time clock object instance.
System namespace.
Single file µOS++ RTOS definitions.
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_stat
#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_gettimeofday
#define __posix_ioctl
#define __posix_setsockopt
#define __posix_socketpair
#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_accept
#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_execve
#define __posix_sendmsg
Definition dirent.h:72
Definition uio.h:56
ssize_t trace_write(const void *buf, size_t nbyte)