posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
posix_stdlib.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 The Zephyr Contributors
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
19#ifndef ZEPHYR_INCLUDE_POSIX_POSIX_STDLIB_H_
20#define ZEPHYR_INCLUDE_POSIX_POSIX_STDLIB_H_
21
22#include <stddef.h> /* NULL, size_t */
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/* TODO: additional POSIX signatures here */
29
30#if defined(_BSD_SOURCE) || defined(__DOXYGEN__)
40int getenv_r(const char *name, char *buf, size_t len);
41#endif
42
43#if defined(_POSIX_C_SOURCE) || defined(__DOXYGEN__)
56int getsubopt(char **optionp, char *const *keylistp, char **valuep);
57#endif
58
59#if defined(_XOPEN_SOURCE) || defined(__DOXYGEN__)
72int putenv(char *string);
73#endif
74
75#if defined(_POSIX_C_SOURCE) || defined(__DOXYGEN__)
85int setenv(const char *envname, const char *envval, int overwrite);
86
94int unsetenv(const char *name);
95
96#if (_POSIX_C_SOURCE < 202405L) || defined(__DOXYGEN__)
108int rand_r(unsigned int *seed);
109#endif /* (_POSIX_C_SOURCE < 202405L) || defined(__DOXYGEN__) */
110
111#if (_POSIX_C_SOURCE >= 202405L) || defined(__DOXYGEN__)
123void qsort_r(void *base, size_t nmemb, size_t size,
124 int (*compar)(const void *a, const void *b, void *arg), void *arg);
125#endif /* (_POSIX_C_SOURCE >= 202405L) || defined(__DOXYGEN__) */
126
127#endif /* defined(_POSIX_C_SOURCE) || defined(__DOXYGEN__) */
128
129#ifdef __cplusplus
130}
131#endif
132
133#endif /* ZEPHYR_INCLUDE_POSIX_POSIX_STDLIB_H_ */
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.
int getsubopt(char **optionp, char *const *keylistp, char **valuep)
Parse sub-options from a command-line argument string.
int unsetenv(const char *name)
Remove an environment variable.
int setenv(const char *envname, const char *envval, int overwrite)
Set the value of an environment variable.
int putenv(char *string)
Add or change an environment variable (XSI extension).
int getenv_r(const char *name, char *buf, size_t len)
Get an environment variable into a caller-supplied buffer (BSD extension).