posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
POSIX_C_LANG_SUPPORT_R
Implementation completeness: 100.0%100IMPLLine coverage: 97.2%97COVLinux compatibility tests: passing🐧

POSIX C Language Support (reentrant) option group. More...

Functions

int rand_r (unsigned int *seed)
 Generate a pseudo-random number (reentrant).
 
void qsort_r (void *base, size_t nmemb, size_t size, int(*compar)(const void *a, const void *b, void *arg), void *arg)
 Sort an array with a comparison function that takes a context argument.
 
char * strtok_r (char *str, const char *sep, char **state)
 Tokenize a string into tokens (reentrant).
 
char * asctime_r (const struct tm *ZRESTRICT tm, char *ZRESTRICT buf)
 Convert broken-down time to a string (thread-safe version of asctime()).
 
char * ctime_r (const time_t *clock, char *buf)
 Convert a time_t to a string (thread-safe version of ctime()).
 
struct tm * gmtime_r (const time_t *ZRESTRICT timer, struct tm *ZRESTRICT result)
 Convert a time_t to UTC broken-down time (thread-safe version of gmtime()).
 
struct tm * localtime_r (const time_t *ZRESTRICT timer, struct tm *ZRESTRICT result)
 Convert a time_t to local broken-down time (thread-safe version of localtime()).
 

Detailed Description

POSIX C Language Support (reentrant) option group.

Function Documentation

◆ asctime_r()

char * asctime_r ( const struct tm *ZRESTRICT  tm,
char *ZRESTRICT  buf 
)
asctime_r line coverage: 80.0%80Linux compatibility tests: passing🐧

Convert broken-down time to a string (thread-safe version of asctime()).

Parameters
tmBroken-down time.
bufCaller-supplied buffer of at least 26 bytes.
Returns
buf on success, or NULL on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/asctime_r.html

◆ ctime_r()

char * ctime_r ( const time_t *  clock,
char *  buf 
)
ctime_r line coverage: 100.0%100Linux compatibility tests: passing🐧

Convert a time_t to a string (thread-safe version of ctime()).

Parameters
clockPointer to a time_t value.
bufCaller-supplied buffer of at least 26 bytes.
Returns
buf on success, or NULL on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime_r.html

◆ gmtime_r()

struct tm * gmtime_r ( const time_t *ZRESTRICT  timer,
struct tm *ZRESTRICT  result 
)
Linux compatibility tests: passing🐧

Convert a time_t to UTC broken-down time (thread-safe version of gmtime()).

Parameters
timerPointer to the time_t value.
resultCaller-supplied storage for the result.
Returns
result on success, or NULL on failure.

◆ localtime_r()

struct tm * localtime_r ( const time_t *ZRESTRICT  timer,
struct tm *ZRESTRICT  result 
)
localtime_r line coverage: 100.0%100Linux compatibility tests: passing🐧

Convert a time_t to local broken-down time (thread-safe version of localtime()).

Parameters
timerPointer to the time_t value.
resultCaller-supplied storage for the result.
Returns
result on success, or NULL on failure.

◆ qsort_r()

void qsort_r ( void *  base,
size_t  nmemb,
size_t  size,
int(*)(const void *a, const void *b, void *arg)  compar,
void *  arg 
)
qsort_r line coverage: 100.0%100Linux compatibility tests: passing🐧

Sort an array with a comparison function that takes a context argument.

Parameters
basePointer to the start of the array.
nmembNumber of elements in the array.
sizeSize of each element in bytes.
comparComparison function; receives a caller-supplied arg.
argContext pointer passed to compar.
See also
https://pubs.opengroup.org/onlinepubs/9799922210/functions/qsort_r.html

◆ rand_r()

int rand_r ( unsigned int *  seed)
rand_r line coverage: 100.0%100Linux compatibility tests: passing🐧

Generate a pseudo-random number (reentrant).

Updates seed and returns the next value in the same sequence as rand() after srand(seed).

Parameters
seedPointer to the seed value; updated on return.
Returns
A pseudo-random integer in the range [0, RAND_MAX].
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/rand_r.html

◆ strtok_r()

char * strtok_r ( char *  str,
const char *  sep,
char **  state 
)
strtok_r line coverage: 100.0%100Linux compatibility tests: passing🐧

Tokenize a string into tokens (reentrant).

Parameters
strFirst call passes the string; subsequent calls pass NULL.
sepDelimiter characters.
stateCaller-provided state for reentrant tokenization.
Returns
Pointer to the next token, or NULL when no more tokens remain.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok_r.html