Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert 73978 & 74096 due to regressions #75244

Merged
merged 18 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8180bb0
Revert "doc: posix: mark posis fd mgmt as supported"
aescolar Jul 1, 2024
7c4679e
Revert "posix: fd_mgmt: implement dup(), dup2(), fseeko(), and ftello()"
aescolar Jul 1, 2024
5d87d30
Revert "doc: posix: mark posix signals supported with undefined behav…
aescolar Jul 1, 2024
45e022b
Revert "tests: posix: headers: add checks for posix signals option gr…
aescolar Jul 1, 2024
3316951
Revert "posix: add stubs for signal.h functions that need process sup…
aescolar Jul 1, 2024
5f251dd
Revert "posix: procN: add missing alias for getpid()"
aescolar Jul 1, 2024
0e01cdf
Revert "posix: kconfig: remove select y from non-user-selectable help"
aescolar Jul 1, 2024
27690c8
Revert "doc: posix: mark posix device io as complete"
aescolar Jul 1, 2024
0e800d9
Revert "posix: device_io: use mode argument correctly in open()"
aescolar Jul 1, 2024
7edf237
Revert "posix: device_io: implement fileno()"
aescolar Jul 1, 2024
40d2871
Revert "posix: device_io: implement fdopen()"
aescolar Jul 1, 2024
75b4255
Revert "posix: device_io: implement pselect()"
aescolar Jul 1, 2024
8e85ac8
Revert "net: sockets: move select() implementation to zvfs"
aescolar Jul 1, 2024
d5023a6
Revert "net: sockets: move poll implementation to zvfs"
aescolar Jul 1, 2024
0797e98
Revert "posix: device_io: implement pread() and pwrite()"
aescolar Jul 1, 2024
355c126
Revert "posix: device_io: provide stdin, stdout, stderr variables"
aescolar Jul 1, 2024
e912dff
Revert "posix: device_io: require a full libc for c89 functions"
aescolar Jul 1, 2024
50c1bf5
Revert "fdtable: read, write, close: only execute methods if non-NULL"
aescolar Jul 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/services/portability/posix/aep/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ The *Minimal Realtime System Profile* (PSE51) includes all of the

:ref:`POSIX_C_LANG_JUMP <posix_option_group_c_lang_jump>`, yes,
:ref:`POSIX_C_LANG_SUPPORT <posix_option_group_c_lang_support>`, yes,
:ref:`POSIX_DEVICE_IO <posix_option_group_device_io>`,yes, :kconfig:option:`CONFIG_POSIX_DEVICE_IO`
:ref:`POSIX_SIGNALS <posix_option_group_signals>`, yes, :kconfig:option:`CONFIG_POSIX_SIGNALS` :ref:`†<posix_undefined_behaviour>`
:ref:`POSIX_DEVICE_IO <posix_option_group_device_io>`,, :kconfig:option:`CONFIG_POSIX_DEVICE_IO`
:ref:`POSIX_SIGNALS <posix_option_group_signals>`,, :kconfig:option:`CONFIG_POSIX_SIGNALS`
:ref:`POSIX_SINGLE_PROCESS <posix_option_group_single_process>`, yes, :kconfig:option:`CONFIG_POSIX_SINGLE_PROCESS`
:ref:`XSI_THREADS_EXT <posix_option_group_xsi_threads_ext>`, yes, :kconfig:option:`CONFIG_XSI_THREADS_EXT`

Expand Down Expand Up @@ -101,7 +101,7 @@ The *Realtime Controller System Profile* (PSE52) includes all features from PSE5
:widths: 50, 10, 50

:ref:`POSIX_C_LANG_MATH <posix_option_group_c_lang_math>`, yes,
:ref:`POSIX_FD_MGMT <posix_option_group_fd_mgmt>`, yes, :kconfig:option:`CONFIG_POSIX_FD_MGMT`
:ref:`POSIX_FD_MGMT <posix_option_group_fd_mgmt>`,, :kconfig:option:`CONFIG_POSIX_FD_MGMT`
:ref:`POSIX_FILE_SYSTEM <posix_option_group_file_system>`,, :kconfig:option:`CONFIG_POSIX_FILE_SYSTEM`

.. csv-table:: PSE52 Option Requirements
Expand Down
114 changes: 50 additions & 64 deletions doc/services/portability/posix/option_groups/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,45 +244,33 @@ POSIX_SIGNALS
Signal services are a basic mechanism within POSIX-based systems and are
required for error and event handling.

.. note::
As processes are not yet supported in Zephyr, the ISO C functions ``abort()``, ``signal()``,
and ``raise()``, as well as the other POSIX functions listed below, may exhibit undefined
behaviour. The POSIX functions ``kill()``, ``pause()``, ``sigaction()``, ``sigpending()``,
``sigsuspend()``, and ``sigwait()`` are implemented to ensure that conformant applications can
link, but they are expected to fail, setting errno to ``ENOSYS``
:ref:`†<posix_undefined_behaviour>`.

.. csv-table:: POSIX_SIGNALS
:header: API, Supported
:widths: 50,10

abort(),yes :ref:`†<posix_undefined_behaviour>`
alarm(),yes :ref:`†<posix_undefined_behaviour>`
kill(),yes :ref:`†<posix_undefined_behaviour>`
pause(),yes :ref:`†<posix_undefined_behaviour>`
raise(),yes :ref:`†<posix_undefined_behaviour>`
sigaction(),yes :ref:`†<posix_undefined_behaviour>`
abort(),yes
alarm(),
kill(),
pause(),
raise(),
sigaction(),
sigaddset(),yes
sigdelset(),yes
sigemptyset(),yes
sigfillset(),yes
sigismember(),yes
signal(),yes :ref:`†<posix_undefined_behaviour>`
sigpending(),yes :ref:`†<posix_undefined_behaviour>`
signal(),
sigpending(),
sigprocmask(),yes
sigsuspend(),yes :ref:`†<posix_undefined_behaviour>`
sigwait(),yes :ref:`†<posix_undefined_behaviour>`
sigsuspend(),
sigwait(),
strsignal(),yes

.. _posix_option_group_device_io:

POSIX_DEVICE_IO
===============

.. note::
When using Newlib, Picolibc, or other C libraries conforming to the ISO C Standard, the
C89 components of the ``POSIX_DEVICE_IO`` Option Group are considered supported.

.. csv-table:: POSIX_DEVICE_IO
:header: API, Supported
:widths: 50,10
Expand All @@ -293,48 +281,48 @@ POSIX_DEVICE_IO
FD_ZERO(),yes
clearerr(),yes
close(),yes
fclose(),yes
fdopen(), yes
feof(),yes
ferror(),yes
fflush(),yes
fgetc(),yes
fgets(),yes
fileno(), yes
fopen(),yes
fclose(),
fdopen(),
feof(),
ferror(),
fflush(),
fgetc(),
fgets(),
fileno(),
fopen(),
fprintf(),yes
fputc(),yes
fputs(),yes
fread(),yes
freopen(),yes
fscanf(),yes
fread(),
freopen(),
fscanf(),
fwrite(),yes
getc(),yes
getchar(),yes
gets(),yes
getc(),
getchar(),
gets(),
open(),yes
perror(),yes
poll(),yes
printf(),yes
pread(),yes
pselect(),yes
pread(),
pselect(),
putc(),yes
putchar(),yes
puts(),yes
pwrite(),yes
pwrite(),
read(),yes
scanf(),yes
scanf(),
select(),yes
setbuf(),yes
setvbuf(),yes
stderr,yes
stdin,yes
stdout,yes
ungetc(),yes
setbuf(),
setvbuf(),
stderr,
stdin,
stdout,
ungetc(),
vfprintf(),yes
vfscanf(),yes
vfscanf(),
vprintf(),yes
vscanf(),yes
vscanf(),
write(),yes

.. _posix_option_group_barriers:
Expand Down Expand Up @@ -546,26 +534,24 @@ POSIX_TIMERS
POSIX_FD_MGMT
=============

.. note::
When using Newlib, Picolibc, or other C libraries conforming to the ISO C Standard, the
C89 components of the ``POSIX_FD_MGMT`` Option Group are considered supported.
This table lists service support status in Zephyr for `POSIX_FD_MGMT`:

.. csv-table:: POSIX_FD_MGMT
:header: API, Supported
:widths: 50,10

dup(), yes
dup2(), yes
fcntl(), yes
fgetpos(), yes
fseek(), yes
fseeko(), yes
fsetpos(), yes
ftell(), yes
ftello(), yes
ftruncate(), yes
lseek(), yes
rewind(), yes
dup(),
dup2(),
fcntl(),
fgetpos(),
fseek(),
fseeko(),
fsetpos(),
ftell(),
ftello(),
ftruncate(),yes
lseek(),
rewind(),

.. _posix_option_group_file_locking:

Expand Down
5 changes: 1 addition & 4 deletions include/zephyr/net/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,7 @@ static inline int zsock_ioctl_wrapper(int sock, unsigned long request, ...)
* it may conflict with generic POSIX ``poll()`` function).
* @endrst
*/
static inline int zsock_poll(struct zsock_pollfd *fds, int nfds, int timeout)
{
return zvfs_poll(fds, nfds, timeout);
}
__syscall int zsock_poll(struct zsock_pollfd *fds, int nfds, int timeout);

/**
* @brief Get various socket options
Expand Down
8 changes: 5 additions & 3 deletions include/zephyr/net/socket_poll.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#ifndef ZEPHYR_INCLUDE_NET_SOCKET_POLL_H_
#define ZEPHYR_INCLUDE_NET_SOCKET_POLL_H_

#include <zephyr/sys/fdtable.h>

/* Setting for pollfd to avoid circular inclusion */

/**
Expand All @@ -27,7 +25,11 @@ extern "C" {
*
* An array of these descriptors is passed as an argument to poll().
*/
#define zsock_pollfd zvfs_pollfd
struct zsock_pollfd {
int fd; /**< Socket descriptor */
short events; /**< Requested events */
short revents; /**< Returned events */
};

#ifdef __cplusplus
}
Expand Down
45 changes: 14 additions & 31 deletions include/zephyr/net/socket_select.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,17 @@
* @{
*/

#include <time.h>

#include <zephyr/toolchain.h>
#include <zephyr/net/socket_types.h>
#include <zephyr/sys/fdtable.h>

#ifdef __cplusplus
extern "C" {
#endif

/** Socket file descriptor set. */
typedef struct zvfs_fd_set zsock_fd_set;
typedef struct zsock_fd_set {
uint32_t bitset[(CONFIG_ZVFS_OPEN_MAX + 31) / 32];
} zsock_fd_set;

/**
* @brief Legacy function to poll multiple sockets for events
Expand All @@ -48,19 +47,13 @@ typedef struct zvfs_fd_set zsock_fd_set;
* it may conflict with generic POSIX ``select()`` function).
* @endrst
*/
static inline int zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds,
zsock_fd_set *exceptfds, struct zsock_timeval *timeout)
{
struct timespec to = {
.tv_sec = (timeout == NULL) ? 0 : timeout->tv_sec,
.tv_nsec = (long)((timeout == NULL) ? 0 : timeout->tv_usec * NSEC_PER_USEC)};

return zvfs_select(nfds, (struct zvfs_fd_set *)readfds, (struct zvfs_fd_set *)writefds,
(struct zvfs_fd_set *)exceptfds, (timeout == NULL) ? NULL : &to, NULL);
}
__syscall int zsock_select(int nfds, zsock_fd_set *readfds,
zsock_fd_set *writefds,
zsock_fd_set *exceptfds,
struct zsock_timeval *timeout);

/** Number of file descriptors which can be added to zsock_fd_set */
#define ZSOCK_FD_SETSIZE ZVFS_FD_SETSIZE
#define ZSOCK_FD_SETSIZE (sizeof(((zsock_fd_set *)0)->bitset) * 8)

/**
* @brief Initialize (clear) fd_set
Expand All @@ -74,10 +67,7 @@ static inline int zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *wr
* if :kconfig:option:`CONFIG_POSIX_API` is defined.
* @endrst
*/
static inline void ZSOCK_FD_ZERO(zsock_fd_set *set)
{
ZVFS_FD_ZERO(set);
}
void ZSOCK_FD_ZERO(zsock_fd_set *set);

/**
* @brief Check whether socket is a member of fd_set
Expand All @@ -91,10 +81,7 @@ static inline void ZSOCK_FD_ZERO(zsock_fd_set *set)
* if :kconfig:option:`CONFIG_POSIX_API` is defined.
* @endrst
*/
static inline int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set)
{
return ZVFS_FD_ISSET(fd, set);
}
int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set);

/**
* @brief Remove socket from fd_set
Expand All @@ -108,10 +95,7 @@ static inline int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set)
* if :kconfig:option:`CONFIG_POSIX_API` is defined.
* @endrst
*/
static inline void ZSOCK_FD_CLR(int fd, zsock_fd_set *set)
{
ZVFS_FD_CLR(fd, set);
}
void ZSOCK_FD_CLR(int fd, zsock_fd_set *set);

/**
* @brief Add socket to fd_set
Expand All @@ -125,10 +109,7 @@ static inline void ZSOCK_FD_CLR(int fd, zsock_fd_set *set)
* if :kconfig:option:`CONFIG_POSIX_API` is defined.
* @endrst
*/
static inline void ZSOCK_FD_SET(int fd, zsock_fd_set *set)
{
ZVFS_FD_SET(fd, set);
}
void ZSOCK_FD_SET(int fd, zsock_fd_set *set);

/** @cond INTERNAL_HIDDEN */

Expand Down Expand Up @@ -172,6 +153,8 @@ static inline void FD_SET(int fd, zsock_fd_set *set)
}
#endif

#include <zephyr/syscalls/socket_select.h>

/**
* @}
*/
Expand Down
9 changes: 3 additions & 6 deletions include/zephyr/posix/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
#define ZEPHYR_POSIX_FCNTL_H_

#ifdef CONFIG_PICOLIBC
#define O_CREAT 0x0040
#define O_TRUNC 0x0200
#define O_APPEND 0x0400
#define O_CREAT 0x0040
#else
#define O_APPEND 0x0008
#define O_CREAT 0x0200
#define O_TRUNC 0x0400
#define O_CREAT 0x0200
#endif

#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
Expand All @@ -23,6 +19,7 @@
#define O_WRONLY 01
#define O_RDWR 02

#define O_APPEND 0x0400
#define O_EXCL 0x0800
#define O_NONBLOCK 0x4000

Expand Down
Loading
Loading