diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html index d20f05c179b..134a46dbcd7 100644 --- a/Documentation/NuttxUserGuide.html +++ b/Documentation/NuttxUserGuide.html @@ -42,8 +42,10 @@ into several paragraphs that describe different groups of OS interfaces:
Function Prototype:
@@ -2018,7 +2019,427 @@ VxWorks provides the following comparable interface:
-2.7 Signal Interfaces
+2.7 Clocks and Timers
+
+ Function Prototype: +
++ #include <time.h> + int clock_settime(clockid_t clockid, const struct timespec *tp); ++
+ Description: +
++ Input Parameters: +
+parm. + Returned Values: +
++ If successful, the clock_settime() function will return zero (OK). + Otherwise, an non-zero error number will be returned to indicate the error: +
+Exxx.+ Function Prototype: +
++ #include <time.h> + int clock_gettime(clockid_t clockid, struct timespec *tp); ++
+ Description: +
++ Input Parameters: +
+parm. + Returned Values: +
++ If successful, the clock_gettime() function will return zero (OK). + Otherwise, an non-zero error number will be returned to indicate the error: +
+Exxx.+ Function Prototype: +
++ #include <time.h> + int clock_getres(clockid_t clockid, struct timespec *res); ++
+ Description: +
++ Input Parameters: +
+parm. + Returned Values: +
++ If successful, the clock_getres() function will return zero (OK). + Otherwise, an non-zero error number will be returned to indicate the error: +
+Exxx.+ Function Prototype: +
++ #include <time.h> + time_t mktime(struct tm *tp); ++
+ Description: +
++ Input Parameters: +
+parm. + Returned Values: +
++ If successful, the mktime() function will return zero (OK). + Otherwise, an non-zero error number will be returned to indicate the error: +
+Exxx.+ Function Prototype: +
++ #include <time.h> + struct tm *gmtime_r(const time_t *clock, struct tm *result); ++
+ Description: +
++ Input Parameters: +
+parm. + Returned Values: +
++ If successful, the gmtime_r() function will return zero (OK). + Otherwise, an non-zero error number will be returned to indicate the error: +
+Exxx.+ #include <time.h> + #define localtime_r(c,r) gmtime_r(c,r) ++ +
+ Function Prototype: +
++ #include <time.h> + int timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid); ++
+ Description:
+ The timer_create() function creates per-thread timer using the specified
+ clock, clock_id, as the timing base.
+ The timer_create() function returns, in
+ the location referenced by timerid, a timer ID of type timer_t used to identify
+ the timer in timer requests.
+ This timer ID is unique until the timer is deleted.
+ The particular clock, clock_id, is defined in <time.h>.
+ The timer whose ID is returned will be in a disarmed state upon return from
+ timer_create().
+
+ The evp argument, if non-NULL, points to a sigevent structure.
+ This structure is allocated by the called and defines the asynchronous notification to occur.
+ If the evp argument is NULL, the effect is as if the evp argument pointed to
+ a sigevent structure with the sigev_notify member having the value SIGEV_SIGNAL,
+ the sigev_signo having a default signal number, and the sigev_value member
+ having the value of the timer ID.
+
+ Each implementation defines a set of clocks that can be used as timing bases
+ for per-thread timers. All implementations shall support a clock_id of
+ CLOCK_REALTIME.
+
+ Input Parameters: +
+clockid. Specifies the clock to use as the timing base.evp. Refers to a user allocated sigevent structure that defines the
+ asynchronous notification. evp may be NULL (see above).timerid. The pre-thread timer created by the call to timer_create().+ Returned Values: +
+
+ If the call succeeds, timer_create() will return 0 (OK) and update the
+ location referenced by timerid to a timer_t, which can be passed to the
+ other per-thread timer calls. If an error occurs, the function will return
+ a value of -1 (ERROR) and set errno to indicate the error.
+
EAGAIN. The system lacks sufficient signal queuing resources to honor the
+ request.EAGAIN. The calling process has already created all of the timers it is
+ allowed by this implementation.EINVAL. The specified clock ID is not defined.ENOTSUP. The implementation does not support the creation of a timer attached
+ to the CPU-time clock that is specified by clock_id and associated with a
+ thread different thread invoking timer_create().+ Function Prototype: +
++ #include <time.h> + int timer_delete(timer_t timerid); ++
+ Description:
+ The timer_delete() function deletes the specified timer, timerid, previously
+ created by the timer_create() function.
+ If the timer is armed when timer_delete() is called, the timer will be automatically disarmed before
+ removal.
+ The disposition of pending signals for the deleted timer is unspecified.
+
+ Input Parameters: +
+timerid.
+ The pre-thread timer, previously created by the call to timer_create(), to be deleted.+ Returned Values: +
++ If successful, the timer_delete() function will return zero (OK). + Otherwise, the function will return a value of -1 (ERROR) and set errno to indicate the error: +
+EINVAL. The timer specified timerid is not valid.+ Function Prototype: +
++ #include <time.h> + int timer_settime(timer_t timerid, int flags, const struct itimerspec *value, + struct itimerspec *ovalue); ++
+ Description:
+ The timer_settime() function sets the time until the next expiration of the
+ timer specified by timerid from the it_value member of the value argument
+ and arm the timer if the it_value member of value is non-zero. If the
+ specified timer was already armed when timer_settime() is called, this call
+ will reset the time until next expiration to the value specified. If the
+ it_value member of value is zero, the timer will be disarmed. The effect
+ of disarming or resetting a timer with pending expiration notifications is
+ unspecified.
+
+ If the flag TIMER_ABSTIME is not set in the argument flags, timer_settime()
+ will behave as if the time until next expiration is set to be equal to the
+ interval specified by the it_value member of value. That is, the timer will
+ expire in it_value nanoseconds from when the call is made. If the flag
+ TIMER_ABSTIME is set in the argument flags, timer_settime() will behave as
+ if the time until next expiration is set to be equal to the difference between
+ the absolute time specified by the it_value member of value and the current
+ value of the clock associated with timerid. That is, the timer will expire
+ when the clock reaches the value specified by the it_value member of value.
+ If the specified time has already passed, the function will succeed and the
+ expiration notification will be made.
+
+ The reload value of the timer will be set to the value specified by the
+ it_interval member of value. When a timer is armed with a non-zero
+ it_interval, a periodic (or repetitive) timer is specified.
+
+ Time values that are between two consecutive non-negative integer multiples + of the resolution of the specified timer will be rounded up to the larger + multiple of the resolution. Quantization error will not cause the timer to + expire earlier than the rounded time value. +
+
+ If the argument ovalue is not NULL, the timer_settime() function will store,
+ in the location referenced by ovalue, a value representing the previous
+ amount of time before the timer would have expired, or zero if the timer was
+ disarmed, together with the previous timer reload value. Timers will not
+ expire before their scheduled time.
+
+ Input Parameters: +
+timerid. The pre-thread timer, previously created by the call to timer_create(), to be be set.flags. Specifie characteristics of the timer (see above)value. Specifies the timer value to setovalue. A location in which to return the time remaining from the previous timer setting.+ Returned Values: +
++ If the timer_gettime() succeeds, a value of 0 (OK) will be returned. + If an error occurs, the value -1 (ERROR) will be returned, and errno set to indicate the error. +
+EINVAL. The timerid argument does not correspond to an ID returned by timer_create() but not yet deleted by timer_delete().EINVAL. A value structure specified a nanosecond value less than zero or greater than or equal to 1000 million,
+ and the it_value member of that structure did not specify zero seconds and nanoseconds.+ Function Prototype: +
++ #include <time.h> + int timer_gettime(timer_t timerid, struct itimerspec *value); ++
+ Description:
+ The timer_gettime() function will store the amount of time until the
+ specified timer, timerid, expires and the reload value of the timer into the
+ space pointed to by the value argument. The it_value member of this structure
+ will contain the amount of time before the timer expires, or zero if the timer
+ is disarmed. This value is returned as the interval until timer expiration,
+ even if the timer was armed with absolute time. The it_interval member of
+ value will contain the reload value last set by timer_settime().
+
+ Input Parameters: +
+timerid. Specifies pre-thread timer, previously created by the call to
+ timer_create(), whose remaining count will be returned.+ Returned Values: +
++ If successful, the timer_gettime() function will return zero (OK). + Otherwise, an non-zero error number will be returned to indicate the error: +
+EINVAL.
+ The timerid argument does not correspond to an ID returned by
+ timer_create() but not yet deleted by timer_delete().+ Function Prototype: +
++ #include <time.h> + int timer_getoverrun(timer_t timerid); ++
+ Description:
+ Only a single signal will be queued to the process for a given timer at any
+ point in time. When a timer for which a signal is still pending expires, no
+ signal will be queued, and a timer overrun will occur. When a timer
+ expiration signal is delivered to or accepted by a process, if the
+ implementation supports the Realtime Signals Extension, the
+ timer_getoverrun() function will return the timer expiration overrun count for
+ the specified timer. The overrun count returned contains the number of extra
+ timer expirations that occurred between the time the signal was generated
+ (queued) and when it was delivered or accepted, up to but not including an
+ implementation-defined maximum of DELAYTIMER_MAX. If the number of such
+ extra expirations is greater than or equal to DELAYTIMER_MAX, then the
+ overrun count will be set to DELAYTIMER_MAX. The value returned by
+ timer_getoverrun() will apply to the most recent expiration signal delivery
+ or acceptance for the timer. If no expiration signal has been delivered
+ for the timer, or if the Realtime Signals Extension is not supported, the
+ return value of timer_getoverrun() is unspecified.
+
+ Input Parameters: +
+timerid. Specifies pre-thread timer, previously created by the call to
+ timer_create(), whose overrun count will be returned.
+ Returned Values:
+ If the timer_getoverrun() function succeeds, it will return the timer
+ expiration overrun count as explained above. timer_getoverrun() will fail if:
+
EINVAL.
+ The timerid argument does not correspond to an ID returned by
+ timer_create() but not yet deleted by timer_delete().+POSIX Compatibility: Comparable to the POSIX +interface of the same name. + +
NuttX provides signal interfaces for tasks. Signals are used to @@ -2044,22 +2465,22 @@ VxWorks provides the following comparable interface: The following signal handling interfaces are provided by NuttX:
Function Prototype: @@ -2089,7 +2510,7 @@ by set such that all signals are excluded. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype: @@ -2119,7 +2540,7 @@ by set such that all signals are included. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype: @@ -2150,7 +2571,7 @@ signo to the signal set specified by set. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype: @@ -2181,7 +2602,7 @@ by signo from the signal set specified by set. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype: @@ -2214,7 +2635,7 @@ by signo is a member of the set specified by set. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype: @@ -2287,7 +2708,7 @@ not handled (SIG_DFL, SIG_IGN). (all treated like SA_SIGINFO). -
Function Prototype: @@ -2337,7 +2758,7 @@ pointed to by the set input parameter. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype: @@ -2375,7 +2796,7 @@ is delivered more than once." POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype: @@ -2423,7 +2844,7 @@ function or to terminate the task." Only delivery of the signal is required in the present implementation (even if the signal is ignored). -
Function Prototype: @@ -2455,7 +2876,7 @@ with a NULL timeout parameter. (see below). POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype: @@ -2521,7 +2942,7 @@ that the unblocked signal be caught; the task will be resumed even if the unblocked signal is ignored. -
Function Prototype: @@ -2578,7 +2999,7 @@ There is no null signal in the present implementation; a zero signal will be sent. -
Function Prototype: @@ -2633,53 +3054,53 @@ be sent.
Function Prototype:
@@ -2700,19 +3121,19 @@ for all of the individual attributes used by the implementation.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_attr_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name.
-
Function Prototype:
@@ -2732,19 +3153,19 @@ An attributes object can be deleted when it is no longer needed.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_attr_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name.
-
Function Prototype:
@@ -2763,19 +3184,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_attr_setschedpolicy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -2794,19 +3215,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_attr_getschedpolicy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -2826,19 +3247,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_attr_getschedpolicy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -2858,19 +3279,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_attr_getschedparam() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -2890,19 +3311,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_attr_setinheritsched() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name.
-
Function Prototype:
@@ -2922,19 +3343,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_attr_getinheritsched() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -2953,19 +3374,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_attr_setstacksize() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -2984,19 +3405,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_attr_getstacksize() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3023,19 +3444,19 @@ specify details about the kind of thread being created.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_create() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3056,19 +3477,19 @@ return value and completion status will not be requested.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_detach() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3088,19 +3509,19 @@ A thread may terminate it's own execution.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_exit() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3156,7 +3577,7 @@ the time when cancelation is re-enabled.
Function Prototype:
@@ -3198,7 +3619,7 @@ No thread could be found corresponding to that specified by the given thread ID. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3217,19 +3638,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_setcancelstate() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3250,19 +3671,19 @@ the return value of the thread.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_join() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3283,19 +3704,19 @@ made available.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_yield() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3315,19 +3736,19 @@ A thread may obtain a copy of its own thread handle.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_self() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3347,19 +3768,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_getschedparam() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3379,19 +3800,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_setschedparam() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3446,7 +3867,7 @@ interface of the same name.
Function Prototype:
@@ -3496,7 +3917,7 @@ interface of the same name. destructor function. -
Function Prototype:
@@ -3537,7 +3958,7 @@ interface of the same name. destructor function. -
Function Prototype:
@@ -3569,7 +3990,7 @@ this function does nothing in the present implementation. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3588,19 +4009,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_mutexattr_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Protoype:
@@ -3619,19 +4040,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_mutexattr_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3651,19 +4072,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_mutexattr_getpshared() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3683,19 +4104,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_mutexattr_setpshared() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3715,19 +4136,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_mutex_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3746,19 +4167,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_mutex_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3777,19 +4198,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_mutex_lock() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3808,19 +4229,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_mutex_trylock() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3839,19 +4260,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_mutex_unlock() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3870,19 +4291,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_condattr_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3901,19 +4322,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_condattr_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3932,19 +4353,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_cond_init() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3963,19 +4384,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_cond_destroy() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -3994,19 +4415,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_cond_broadcast() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -4025,19 +4446,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_cond_signal() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -4056,19 +4477,19 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_cond_wait() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. POSIX Compatibility: Comparable to the POSIX interface of the same name. -
Function Prototype:
@@ -4088,12 +4509,12 @@ interface of the same name.
Returned Values:
-If successful, the xxx() function will return +If successful, the pthread_cond_timedwait() function will return zero (OK). Otherwise, an error number will be returned to indicate the error:
Exxx. @@ -4303,14 +4724,101 @@ notify a task when a message is available on a queue. have to do some redesign.
+
+ The NuttX filesystem is very simple; it does not involve any block drivers or
+ particular filesystem (like FAT or EXT2 etc.).
+ The NuttX filesystem simply supports a set a filesystem APIs
+ (open(), close(), read(), write, etc.)
+ and a registration mechanism that allows devices drivers to a associated with nodes
+ in a file-system-like name space.
+
+ #include <fcntl.h> + int open(const char *path, int oflag, ...); ++ +
+ #include <unistd.h> + int close(int fd); + int dup(int fildes); + int dup2(int fildes1, int fildes2); + off_t lseek(int fd, off_t offset, int whence); + int read(int fd, void *buf, unsigned int nbytes); + int unlink(const char *path); + int write(int fd, const void *buf, unsigned int nbytes); ++ +
+ #include <dirent.h> + int closedir(DIR *dirp); + FAR DIR *opendir(const char *path); + FAR struct dirent *readdir(FAR DIR *dirp); + int readdir_r(FAR DIR *dirp, FAR struct dirent *entry, FAR struct dirent **result); + void rewinddir(FAR DIR *dirp); + void seekdir(FAR DIR *dirp, int loc); + int telldir(FAR DIR *dirp); ++ +
+ #include <stdio.h> + int fclose(FILE *stream); + int fflush(FILE *stream); + int feof(FILE *stream); + int ferror(FILE *stream); + int fgetc(FILE *stream); + char *fgets(char *s, int n, FILE *stream); + FILE *fopen(const char *path, const char *type); + int fprintf(FILE *stream, const char *format, ...); + int fputc(int c, FILE *stream); + int fputs(const char *s, FILE *stream); + size_t fread(void *ptr, size_t size, size_t n_items, FILE *stream); + int fseek(FILE *stream, long int offset, int whence); + size_t fwrite(const void *ptr, size_t size, size_t n_items, FILE *stream); + char *gets(char *s); + + int printf(const char *format, ...); + int puts(const char *s); + int rename(const char *source, const char *target); + int sprintf(char *dest, const char *format, ...); + int ungetc(int c, FILE *stream); + int vprintf(const char *s, va_list ap); + int vfprintf(FILE *stream, const char *s, va_list ap); + int vsprintf(char *buf, const char *s, va_list ap); + + int chdir(const char *path); + FILE *fdopen(int fd, const char *type); + int fstat(int fd, FAR struct stat *buf); + char *getcwd(FAR char *buf, size_t size); + int ioctl(int fd, int req, unsigned long arg); + int mkdir(const char *path, mode_t mode); + int rmdir(const char *path); + int stat(const char *path, FAR struct stat *buf); + int statfs(const char *path, FAR struct statfs *buf); ++