For SIGEV_SIGNAL, the function zephyr_timer_wrapper() is the handler
between kernel and posix layer.
Here, for one-time timer, reload is equal to 0 and function returns.
As a consequence, handler function was never called.
Signed-off-by: Noemie Gillet <ngillet@sequans.com>
Several help prompts for non-user-selectable Kconfig options
included the phrase "select 'y' here", which does not make
any sense in this situation.
Adjust the help sections to use more appropriate language.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Move the implementation of zsock_select() to zvfs_select(). This
allows other types of file descriptors to also make use of
select() functionality even when the network subsystem is not
enabled.
Additionally, it partially removes a dependency cycle between
posix and networking by moving functionality into a mutual
dependency.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Move the implementation of zsock_poll to zvfs_poll. This allows
other types of file descriptors to also make use of poll()
functionality even when the network subsystem is not enabled.
Additionally, it partially removes a dependency cycle between
posix and networking by moving functionality into a mutual
dependency.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Add pread() and pwrite() implementations, which are nearly
identical to read() and write() but differ in that they do not
update the file-descriptor offset and instead read from a
specific file offset.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
The POSIX_DEVICE_IO Option Group requires a number of c89
functions mainly from stdio.h .
Namely,
clearerr(), fclose(), feof(), ferror(), fflush(), fetc(),
fgets(), fprintf(), fputc(), fputs(), fread(), freopen(),
fscanf(), fwrite(), getc(), getchar(), gets(), perror(),
printf(), putc(), putchar(), puts(), scanf(), setbuf(),
setvbuf(), ungetc(), vfprintf(), vfscanf(), vfprintf(), and
vscanf().
Additionally, symbols stdin, stdout, and stderr should be
provided.
These should be provided by any conformant C library
(not by the POSIX API).
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Based on Andy's talk at eoss 2024, use the sys/sem.h api instead
of the spinlock.h api to synchronize pooled elements since it
has minimal overhead like semaphores but also works from
userspace.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
We need to add _POSIX_C_SOURCE to this file as it uses POSIX values from
limits.h including IOV_MAX, CHILD_MAX and ARG_MAX.
Signed-off-by: Keith Packard <keithp@keithp.com>
options/fs.c and options/timer.c both use POSIX-only functions. To ensure
those symbols are visible from the underlying C library, define
_POSIX_C_SOURCE.
Signed-off-by: Keith Packard <keithp@keithp.com>
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Since Zephyr itself does not currently support processes, but
conformant applications should still be able to link, add stubs
for the remaining POSIX functions in the POSIX_SIGNALS Option
Group.
The POSIX_SIGNALS Option Group is required for PSE51, PSE52,
PSE53, PSE54, and likely many other POSIX Subprofiles.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Newlib requires an alias for the getpid() function. There was
a Kconfig already present for doing so, but the actual alias
was missing.
So this is technically a bugfix.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Implemented the following:
- `asctime_r()`
- `asctime()`
- `localtime()`
- `localtime_r()`
- `ctime()`
- `ctime_r()`
Specifically:
- the implementation of `localtime()` & `localtime_r()` simply
wraps around the gmtime() & gmtime_r() functions, the
results are always expressed as UTC.
- `ctime()` is equivalent to `asctime(localtime(clock))`, it
inherits the limitation of `localtime()` as well, which only
supports UTC results currently.
Added tests for these newly implemented functions.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
`readdir_r()` belongs to the following option group
POSIX_FILE_SYSTEM_R: Thread-Safe File System
Create a new Kconfig `CONFIG_POSIX_FILE_SYSTEM_R` to compile
it.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
Create stubs for getpwnam_r, getpwuid_r, getgrgid_r
& getgrnam_r.
These functions are in the _POSIX_THREAD_SAFE_FUNCTIONS
option group.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
A few previously deprecated Kconfig options have not yet been
present for 1 release cycle and can (theoretically) just be
removed, without deprecation (see next commit).
* GETENTROPY
* POSIX_CONFSTR
* POSIX_ENV
* POSIX_SYSLOG
For dependency information, please see
https://docs.zephyrproject.org/3.6.0/kconfig.html#kconfig-search
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
In `lib/posix/options/shm.c` we don't include stdio.h
header but use standard SEEK_xxx definitions (i.e. `SEEK_SET`)
which cause build issues (if the minimal libc is used).
Fix that.
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
This reverts commit 6f62292d42.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit 86b92934cc.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit 2d72966516.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit 93973e2ead.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit 49ac1912b2.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit 305ec62a6b.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit 581a0f56e6.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit 48dff5562c.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit 499a633976.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit b82b5b0734.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit be086f174c.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit b2243af32d.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit b18cad15b9.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
__z_clock_nanosleep function was getting current time in cycles, via
k_cycle_get_32(), to perform its time calculations. However, when calling
k_sleep() to actually sleep, times are measured in ticks.
This causes a problem when there's a big skew between the uptime
measured in cycles vs uptime measured in ticks: in some platforms, the
system clock maybe up for a long time already when Zephyr starts
counting ticks, for instance, while downloading an image via PXE. In
this case, the calculations done inside __z_clock_nanosleep end up
measuring a much bigger current time than expected, thus sleeping too
much, basically all the time since system clock initialization.
This patch fixes that by avoiding the cycle trip: stick to ticks,
instead. They start counting from Zephyr initialization instead, which
is the expected uptime.
Fixes#69608
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Implement the remaining functions from the POSIX_FD_MGMT Option
Group that are part of POSIX, and add the
CONFIG_REQUIRES_FULL_LIBC dependency to CONFIG_POSIX_FD_MGMT, to
pull in the remaining C89 functions.
The POSIX_FD_MGMT Option Group is required for PSE52, PSE53, and
PSE54 Subprofiling Option Groups.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Since Zephyr itself does not currently support processes, but
conformant applications should still be able to link, add stubs
for the remaining POSIX functions in the POSIX_SIGNALS Option
Group.
The POSIX_SIGNALS Option Group is required for PSE51, PSE52,
PSE53, PSE54, and likely many other POSIX Subprofiles.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Newlib requires an alias for the getpid() function. There was
a Kconfig already present for doing so, but the actual alias
was missing.
So this is technically a bugfix.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Several help prompts for non-user-selectable Kconfig options
included the phrase "select 'y' here", which does not make
any sense in this situation.
Adjust the help sections to use more appropriate language.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>