Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion doc/services/portability/posix/conformance/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ POSIX System Interfaces
_XOPEN_CRYPT, -1,
:ref:`_XOPEN_REALTIME <posix_option_group_xsi_realtime>`, 700, :kconfig:option:`CONFIG_XSI_REALTIME`
_XOPEN_REALTIME_THREADS, -1,
:ref:`_XOPEN_STREAMS<posix_option_xopen_streams>`, 200809L, :kconfig:option:`CONFIG_XOPEN_STREAMS`
:ref:`_XOPEN_STREAMS<posix_option_xopen_streams>`, 200809L, :kconfig:option:`CONFIG_XSI_STREAMS`
_XOPEN_UNIX, -1,


Expand Down
2 changes: 1 addition & 1 deletion doc/services/portability/posix/option_groups/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ implemented in Zephyr but are provided so that conformant applications can still
Unimplemented functions in this option group will fail, setting ``errno`` to ``ENOSYS``
:ref:`†<posix_undefined_behaviour>`.

Enable this option with :kconfig:option:`CONFIG_XOPEN_STREAMS`.
Enable this option with :kconfig:option:`CONFIG_XSI_STREAMS`.

.. csv-table:: _XOPEN_STREAMS
:header: API, Supported
Expand Down
2 changes: 1 addition & 1 deletion drivers/modem/ublox-sara-r4.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LOG_MODULE_REGISTER(modem_ublox_sara_r4, CONFIG_MODEM_LOG_LEVEL);
#include <zephyr/drivers/gpio.h>
#include <zephyr/device.h>
#include <zephyr/init.h>
#include <zephyr/posix/fcntl.h>
#include <fcntl.h>

#include <zephyr/net/net_if.h>
#include <zephyr/net/net_offload.h>
Expand Down
4 changes: 0 additions & 4 deletions drivers/net/nsos_fcntl.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
/*
* When building for Zephyr, use Zephyr specific fcntl definitions.
*/
#ifdef __ZEPHYR__
#include <zephyr/posix/fcntl.h>
#else
#include <fcntl.h>
#endif

#include "nsi_errno.h"
#include "nsos_fcntl.h"
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/nsos_sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ LOG_MODULE_REGISTER(nsos_sockets);
#include <zephyr/net/net_ip.h>
#include <zephyr/net/offloaded_netdev.h>
#include <zephyr/net/socket_offload.h>
#include <zephyr/posix/fcntl.h>
#include <fcntl.h>
#include <zephyr/sys/fdtable.h>
#include <zephyr/sys/dlist.h>

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ LOG_MODULE_REGISTER(net_ppp, LOG_LEVEL);
#include <zephyr/sys/crc.h>
#include <zephyr/drivers/uart.h>
#include <zephyr/random/random.h>
#include <zephyr/posix/net/if_arp.h>
#include <net/if_arp.h>
#include <zephyr/net/ethernet.h>
#include <zephyr/net/capture.h>

Expand Down
2 changes: 1 addition & 1 deletion drivers/wifi/simplelink/simplelink_sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LOG_MODULE_DECLARE(LOG_MODULE_NAME);

#include <stdlib.h>
#include <limits.h>
#include <zephyr/posix/fcntl.h>
#include <fcntl.h>

#include <zephyr/kernel.h>
/* Define sockaddr, etc, before simplelink.h */
Expand Down
10 changes: 5 additions & 5 deletions include/zephyr/net/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -1280,19 +1280,19 @@ struct socket_op_vtable {
*/
#if defined(CONFIG_POSIX_API)
#if !defined(ZEPHYR_INCLUDE_POSIX_ARPA_INET_H_)
#include <zephyr/posix/arpa/inet.h>
#include <arpa/inet.h>
#endif
#if !defined(ZEPHYR_INCLUDE_POSIX_NETDB_H_)
#include <zephyr/posix/netdb.h>
#include <netdb.h>
#endif
#if !defined(ZEPHYR_INCLUDE_POSIX_UNISTD_H_)
#include <zephyr/posix/unistd.h>
#include <unistd.h>
#endif
#if !defined(ZEPHYR_INCLUDE_POSIX_POLL_H_)
#include <zephyr/posix/poll.h>
#include <poll.h>
#endif
#if !defined(ZEPHYR_INCLUDE_POSIX_SYS_SOCKET_H_)
#include <zephyr/posix/sys/socket.h>
#include <sys/socket.h>
#endif
#endif /* CONFIG_POSIX_API */

Expand Down
41 changes: 39 additions & 2 deletions include/zephyr/posix/aio.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,60 @@
#ifndef ZEPHYR_INCLUDE_ZEPHYR_POSIX_AIO_H_
#define ZEPHYR_INCLUDE_ZEPHYR_POSIX_AIO_H_

/* size_t must be defined by the libc stddef.h */
#include <stddef.h>
#include <stdint.h>
#include <signal.h>
#include <sys/types.h>
#include <time.h>

#include <zephyr/toolchain.h>

#ifdef __cplusplus
extern "C" {
#endif

#if !defined(_OFF_T_DECLARED) && !defined(__off_t_defined)
typedef long off_t;
#define _OFF_T_DECLARED
#define __off_t_defined
#endif

#ifndef __SIZE_TYPE__
#define __SIZE_TYPE__ unsigned long
#endif

#if !defined(_SSIZE_T_DECLARED) && !defined(__ssize_t_defined)
#define unsigned signed /* parasoft-suppress MISRAC2012-RULE_20_4-a MISRAC2012-RULE_20_4-b */
typedef __SIZE_TYPE__ ssize_t;
#undef unsigned
#define _SSIZE_T_DECLARED
#define __ssize_t_defined
#endif

/* time_t must be defined by the libc time.h */
#include <time.h>

#if __STDC_VERSION__ >= 201112L
/* struct timespec must be defined in the libc time.h */
#else
#if !defined(_TIMESPEC_DECLARED) && !defined(__timespec_defined)
struct timespec {
time_t tv_sec;
long tv_nsec;
};
#define _TIMESPEC_DECLARED
#define __timespec_defined
#endif
#endif

struct aiocb {
int aio_fildes;
off_t aio_offset;
volatile void *aio_buf;
size_t aio_nbytes;
int aio_reqprio;
#if defined(_POSIX_REALTIME_SIGNALS) || defined(__DOXYGEN__)
struct sigevent aio_sigevent;
#endif /* defined(_POSIX_REALTIME_SIGNALS) || defined(__DOXYGEN__) */
int aio_lio_opcode;
};

Expand Down
4 changes: 2 additions & 2 deletions include/zephyr/posix/arpa/inet.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#include <stddef.h>

#include <zephyr/posix/netinet/in.h>
#include <zephyr/posix/sys/socket.h>
#include <netinet/in.h>
#include <sys/socket.h>

#include <zephyr/net/socket.h>

Expand Down
18 changes: 17 additions & 1 deletion include/zephyr/posix/dirent.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,29 @@
#ifndef ZEPHYR_INCLUDE_POSIX_DIRENT_H_
#define ZEPHYR_INCLUDE_POSIX_DIRENT_H_

#include <zephyr/posix/sys/dirent.h>
#include <limits.h>

#include <zephyr/toolchain.h>

#ifdef __cplusplus
extern "C" {
#endif

#if !defined(NAME_MAX) && defined(_XOPEN_SOURCE)
#define NAME_MAX _XOPEN_NAME_MAX
#endif

#if !defined(NAME_MAX) && defined(_POSIX_C_SOURCE)
#define NAME_MAX _POSIX_NAME_MAX
#endif

typedef void DIR;

struct dirent {
unsigned int d_ino;
char d_name[NAME_MAX + 1];
};

#if (_POSIX_C_SOURCE >= 200809L) || (_XOPEN_SOURCE >= 700)
int alphasort(const struct dirent **d1, const struct dirent **d2);
#endif
Expand Down
64 changes: 18 additions & 46 deletions include/zephyr/posix/fnmatch.h
Original file line number Diff line number Diff line change
@@ -1,59 +1,31 @@
/* SPDX-License-Identifier: BSD-3-Clause */

/* $NetBSD: fnmatch.h,v 1.12.50.1 2011/02/08 16:18:55 bouyer Exp $ */

/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
/*
* Copyright The Zephyr Project Contributors
*
* @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef _FNMATCH_H_
#define _FNMATCH_H_

#define FNM_NOMATCH 1 /* Match failed. */
#define FNM_NOSYS 2 /* Function not implemented. */
#define FNM_NORES 3 /* Out of resources */

#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
#define FNM_PERIOD 0x04 /* Period must be matched by period. */
#define FNM_CASEFOLD 0x08 /* Pattern is matched case-insensitive */
#define FNM_LEADING_DIR 0x10 /* Ignore /<tail> after Imatch. */
#ifndef ZEPHYR_INCLUDE_POSIX_FNMATCH_H_
#define ZEPHYR_INCLUDE_POSIX_FNMATCH_H_

#ifdef __cplusplus
extern "C" {
#endif

int fnmatch(const char *, const char *, int);
#define FNM_NOMATCH 1
#define FNM_NOESCAPE 0x01
#define FNM_PATHNAME 0x02
#define FNM_PERIOD 0x04
#if defined(__GNU_SOURCE)
#define FNM_LEADING_DIR 0x08
#endif
#define FNM_CASEFOLD 0x10
#define FNM_EXTMATCH 0x20
#define FNM_IGNORECASE FNM_CASEFOLD

int fnmatch(const char *pattern, const char *string, int flags);

#ifdef __cplusplus
}
#endif

#endif /* !_FNMATCH_H_ */
#endif /* ZEPHYR_INCLUDE_POSIX_FNMATCH_H_ */
2 changes: 1 addition & 1 deletion include/zephyr/posix/grp.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
extern "C" {
#endif

#include <zephyr/posix/sys/stat.h>
#include <sys/stat.h>

/**
* @brief Group structure
Expand Down
5 changes: 0 additions & 5 deletions include/zephyr/posix/mqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
#include <time.h>
#include <signal.h>

#include <zephyr/kernel.h>
#include <zephyr/posix/fcntl.h>
#include <zephyr/posix/sys/stat.h>
#include <zephyr/posix/posix_types.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
Loading
Loading