Support querying POSIX string configuration values (similar to sysconf()). confstr() is required by the POSIX_SINGLE_PROCESS Option Group as detailed in Section E.1 of IEEE-1003.1-2017 and has been part of the specification since POSIX-2. The POSIX_SINGLE_PROCESS Option Group is required for PSE51, PSE52, PSE53, and PSE54 conformance, and is otherwise mandatory for any POSIX conforming system as per Section A.2.1.3 of IEEE-1003-1.2017. With this, we have complete support for the POSIX_SINGLE_PROCESS Option Group. Signed-off-by: Christopher Friedt <cfriedt@meta.com>
21 lines
299 B
C
21 lines
299 B
C
/*
|
|
* Copyright (c) 2024, Meta
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <zephyr/posix/unistd.h>
|
|
|
|
size_t confstr(int name, char *buf, size_t len)
|
|
{
|
|
if (name < 0 || name > _CS_V6_ENV) {
|
|
errno = EINVAL;
|
|
return 0;
|
|
}
|
|
|
|
if (buf != NULL && len > 0) {
|
|
buf[0] = '\0';
|
|
}
|
|
|
|
return 1;
|
|
}
|