The size of the JSON_TOK_ENCODED_OBJ type was not defined, which
caused errors when generating an array.
Signed-off-by: Robin-Charles Guihéneuf <robin-charles@hotmail.fr>
Passing a USB-MIDI device in a ump stream responder configuration,
as obtained from the device tree with DEVICE_DT_GET(), was wrongly
casting is from const struct device* to void*, hence removing the const
pointer attribute.
This incorrectness introduces some compilation issue. Let's therefore
make the device pointer constant in ump_stream_responder_cfg, and
add a macro to make the proper typecast consistently. Finally, adapt the
corresponding samples to use that new macro.
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
Add a new top-level, transport independent library to respond to UMP Stream
Discovery messages. This allows MIDI2.0 clients to discover UMP endpoints
hosted on Zephyr over the UMP protocol.
The endpoint specification can be gathered from the device tree, so that
the same information used to generate USB descriptors in usb-midi2.0
can be delivered over UMP Stream.
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
Enable support for ACPI_RESOURCE_TYPE_ADDRESS64 in acpi_device_mmio_get
to fetch 64bit address from resource of an ACPI device.
Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
Retrieve the current leaf state by calling `smf_get_current_leaf_state`
and the state which is currently-executing by calling
`smf_get_current_executing_state`.
Signed-off-by: Siwei Yang <yswysc@gmail.com>
1. Fix an off-by-one error in `signo_fits()` (a utility function inside
signal.c
2. Adjust expectations for C libraries that do not provide a sigset_t
large enough to support `SIGRTMIN` or `SIGRAMAX`.
This fixes an issue in CI that appeared when run under ARC.
```shell
west build -p auto -b qemu_arc/qemu_arc_hs -t run tests/posix/signals
```
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
There is only one flag, NET_BUF_EXTERNAL_DATA, used when net_buf was
allocated with external data. The flag is checked in net_buf_clone() and
net_buf_destroy(). net_buf with external buffer can be used for
receiving and transmitting. net_buf_reset() is convenient way
to reset net_buf with external data before it is re-enqueued again.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
smf_set_state() excludes ancestor/descendant relations before calling
get_lca_of(). The function now walks from source->parent and returns
the first ancestor that contains dest. The 'ancestor == dest' case
was unreachable and is removed.
No functional change intended.
Ref: RFC #95952
Signed-off-by: Vlad Kulikov <vlad_kulikov_c@pm.me>
To avoid conflicts between the C library's `time.h` and signal.h use an
"override" header (when necessary) for C libraries that do not themselves
provide POSIX definitions in `time.h` or `signal.h`.
V2
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Since the timespec_normalize() function is not branchless, and since it
can also generate a fair bit of code, make the function non-inline and
place it in timeutil.c instead.
This should save some code space on most systems.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Moved the Open AMP code from lib/ to subsys/ipc/ to better
organize IPC-related components.
Updated build and config files to reflect the new location.
Adjusted path in MAINTAINERS.yml.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
To avoid conflicts between the C library's `time.h` and signal.h use an
"override" header (when necessary) for C libraries that do not themselves
provide POSIX definitions in `time.h` or `signal.h`.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Convert `gethostname()` from a static inline wrapper to a normal function
with regular linkage.
This change was prompted mainly as housekeeping for #95811, but a
secondary reason was to make this a linkable symbol so that the API works
at a binary level as well (which could be provided by the toolchain as
well).
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Downstream toolchains may already define these macros, add guard to
prevent macro redefined errors.
Signed-off-by: Al Semjonovs <asemjonovs@google.com>
In case STA + AP mode is enabled, then adjust the defaults to accomodate
the second interface.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
When building with high optimization level, the compiler thinks
duration may be used initialized and warns as much.
Let's initialize this variable always to ensure it does not happen
and with it pacify the compiler.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The builtin functions __atomic_compare_exchange_* are missing when
CONFIG_ATOMIC_OPERATIONS_C is set. Add them and verify they build/work
as expected.
Signed-off-by: Yuval Peress <peress@google.com>
Newlib does not seem to define a number of mandatory POSIX limits
(e.g. minimum values).
Include Zephyr's POSIX definitions in an override of Newlib's limits.h
(when the appropriate application conformance macro is provided).
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Rather than duplicating limit logic in several places, de-duplicate it
and centralize preprocessor checks in posix_limits.h .
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Migrate support from crc library to new crc subsystem
Add hardware acclerator backend for crc subsystem
Signed-off-by: Duy Vo <duy.vo.xc@bp.renesas.com>
pwd.c and grp.c both had incorrect preprocessor guards around the stubs
that they were implementing. Functions were surrounded by
```cpp
ifdef CONFIG_POSIX_THREAD_SAFE_FUNCTIONS
..
endif /* CONFIG_POSIX_THREAD_SAFE_FUNCTIONS */
```
Which is not at all accurate, since that subprofiling option group is
`(CONFIG_)POSIX_SYSTEM_DATABASE_R` (which is a PR that is in-draft).
Remove the guards, since they are invalid anyway, and at most an
application will link properly. We don't really need the guards anyway,
since conditional compilation will be used to link the files into the
build.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Change utf8_count_chars return type to int and drop thesys/types.h, this
way the function does not depend on posix types.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This moves the declaration of the utf8 utils defined in lib/utils/utf8.c
in their own header. Main reason to do this is that the current setup
requried adding an include for sys/types.h in util.h, which can result
in a build falure due to a circular header depdenecy when using:
CONFIG_POSIX_API=y
CONFIG_NEWLIB_LIBC=y
_GNU_SOURCE
the loop and error are:
- include/sys/types.h:50: <- this is a NEWLIB one
- include/zephyr/posix/sys/select.h:9:
- include/zephyr/posix/posix_types.h:30:
- include/zephyr/kernel.h:17:
- include/zephyr/kernel_includes.h:25:
- include/zephyr/sys/atomic.h:18:
include/zephyr/sys/util.h:705:1:
error: unknown type name 'ssize_t'
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
When bitarray is limited to a single 32 bit word then bitmask_find_gap
can be used which is much faster than bit by bit search which is
used in bitarray spanning across multiple 32 bit words. Tests shows
that allocation and freeing is 2-3 times faster.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Add function which finds contiguous number of bits which are not set
in the 32 bit mask.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Updated minimal libc to use the type "bool" which was introduced in C23
instead of defining it as a macro.
Link: https://en.cppreference.com/w/c/header/stdbool
Signed-off-by: Daniel Hajjar <daniel.hajjar16@gmail.com>
Since it's possible that rounding up might not always be the right thing
to do in every situation, in order to allow the application to make more
informed decisions, we created a modified timespec_to_timeout() that also
returns the remainder (or difference) between the requested time to
convert and resulting k_timeout_t. The difference is expressed as a
timespec object.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
System designers may want to change the behavior of assert_print, such as
storing the message off into retained RAM and instantly rebooting. Adding
__weak allows customatization
Signed-off-by: Clay Wynn <cwynn@meta.com>
Rather than keeping limits defined in a common way, controllable with one
Kconfig, move posix definitions out of the standard common libc header
`<limits.h>` into `<zephyr/posix/posix_limits.h>`, not controlled with
Kconfig. Additionally, include `<zephyr/posix/posix_limits.h>` wherever
an in-tree C library includes a custom `<limits.h>`.
Note: the only reason any of the `<limits.h>` files exist, is to define
the POSIX limit PATH_MAX without declaring `_POSIX_C_SOURCE`, which would
be necessary according to the standard, and each of the custom `<limits.h>`
files is nearly identical in this regard.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
In order to reduce conflicts with limits defined in external C libraries,
move Zephyr's POSIX limits from posix_features.h to limits.h in the
common C library sources.
In order to give the implementation better control over where POSIX
limit definitions originate, use `#include_next <limits.h>` to pull in
the corresponding header of the C library, and provide a non-user
configurable option `CONFIG_TC_PROVIDES_POSIX_LIMIT_DEFS` that may be set
in order to ensure that the C library version of POSIX limits are used.
Note: this may mean that runtime invariant values are inconsistent with
parts that are actually in use within Zephyr, so applications are
encouraged to use `sysconf()` with external C libraries that implement
parts of the POSIX standard to query system configuration values at
runtime.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Set CONFIG_LIBC_ALLOW_LESS_THAN_64BIT_TIME to default 'y' for
ARCMWDT_LIBC toolchain.
The ARCMWDT_LIBC uses a 32-bit time_t
which fails the 64-bit time_t validation introduced to prevent Y2038
issues. This change eliminates the need to manually configure this
option for every ARCMWDT test while maintaining the validation
for other toolchains that support 64-bit time_t.
Signed-off-by: Mohamed Moawad <moawad@synopsys.com>
ARC MWDT C library does not have an implementation of the strnlen
function, so we have a wrapper over standard-compliant strnlen_s.
However, there is no declaration of the wrapper, so add one.
Signed-off-by: Ilya Tagunov <Ilya.Tagunov@synopsys.com>
Unreferencing a buffer that has already been freed should trigger an
assertion as it indicates a critical logic error and potential security
concern.
Signed-off-by: Jordan Yates <jordan@embeint.com>
There is no need for a custom assert macro that is only used once, or
conditional compilation of the assert macro based on `__ASSERT_ON`. If
assertions are disabled the compiler should simply discard the code.
Signed-off-by: Jordan Yates <jordan@embeint.com>
The LIBC_ALLOW_LESS_THAN_64BIT_TIME option disables a compile-time check
ensuring that time_t can hold 64-bit values. This check can prevent
accidental builds on targets with 32-bit time_t and the consequent 2038
issues.
This option is enabled when using the native C library as i386 glibc
uses 32-bit time_t.
A new file, validate_libc.c, is added to lib/libc to contain this and any
future libc tests. The check for CONFIG_EXTERNAL_LIBC is moved to
libc/CMakeLists.txt to ensure that this new file is always compiled.
Signed-off-by: Keith Packard <keithp@keithp.com>
Since an implementation may omit definitions of runtime invariant values
in limits.h if the corresponding value is equal to or greater than the
minimum, is unspecified, and must be queried at runtime [1], do not rely
on PAGE_SIZE being declared in limits.h .
[1]
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/limits.h.html
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
to be able to choose c++23 dialect
deprecates c++2b, but we should keep the option c++2b for legacy
Signed-off-by: Adrian Bieri <adrian.bieri@loepfe.com>
The ISO C function time() is not specified to set the global
errno variable, so remove that in case there are side-effects.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Added support for mixed array types in JSON by introducing a new type -
json_mixed_arr_descr. Added APIs for mixed array type parsing and
encoding.
Signed-off-by: Sanjay Vallimanalan <sanjay@linumiz.com>