Skip to content

Commit dbedaa5

Browse files
committed
posix: remove usage of CONFIG_POSIX_API
Remove usage of CONFIG_POSIX_API. Signed-off-by: Chris Friedt <[email protected]>
1 parent 76db485 commit dbedaa5

File tree

132 files changed

+249
-227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+249
-227
lines changed

include/zephyr/net/socket.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ __syscall void *zsock_get_context_object(int sock);
374374
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html
375375
* for normative description.
376376
* This function is also exposed as `socket()`
377-
* if @kconfig{CONFIG_POSIX_API} is defined.
377+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
378378
*
379379
* If CONFIG_USERSPACE is enabled, the caller will be granted access to the
380380
* context object associated with the returned file descriptor.
@@ -391,7 +391,7 @@ __syscall int zsock_socket(int family, int type, int proto);
391391
* https://pubs.opengroup.org/onlinepubs/009695399/functions/socketpair.html
392392
* for normative description.
393393
* This function is also exposed as `socketpair()`
394-
* if @kconfig{CONFIG_POSIX_API} is defined.
394+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
395395
*/
396396
__syscall int zsock_socketpair(int family, int type, int proto, int *sv);
397397

@@ -401,7 +401,7 @@ __syscall int zsock_socketpair(int family, int type, int proto, int *sv);
401401
* @details
402402
* Close a network socket.
403403
* This function is also exposed as `close()`
404-
* if @kconfig{CONFIG_POSIX_API} is defined (in which case it
404+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined (in which case it
405405
* may conflict with generic POSIX `close()` function).
406406
*/
407407
__syscall int zsock_close(int sock);
@@ -415,7 +415,7 @@ __syscall int zsock_close(int sock);
415415
* for normative description, but currently this function has no effect in
416416
* Zephyr and provided solely for compatibility with existing code.
417417
* This function is also exposed as `shutdown()`
418-
* if @kconfig{CONFIG_POSIX_API} is defined.
418+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
419419
*/
420420
__syscall int zsock_shutdown(int sock, int how);
421421

@@ -427,7 +427,7 @@ __syscall int zsock_shutdown(int sock, int how);
427427
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html
428428
* for normative description.
429429
* This function is also exposed as `bind()`
430-
* if @kconfig{CONFIG_POSIX_API} is defined.
430+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
431431
*/
432432
__syscall int zsock_bind(int sock, const struct sockaddr *addr,
433433
socklen_t addrlen);
@@ -440,7 +440,7 @@ __syscall int zsock_bind(int sock, const struct sockaddr *addr,
440440
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html
441441
* for normative description.
442442
* This function is also exposed as `connect()`
443-
* if @kconfig{CONFIG_POSIX_API} is defined.
443+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
444444
*/
445445
__syscall int zsock_connect(int sock, const struct sockaddr *addr,
446446
socklen_t addrlen);
@@ -453,7 +453,7 @@ __syscall int zsock_connect(int sock, const struct sockaddr *addr,
453453
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html
454454
* for normative description.
455455
* This function is also exposed as `listen()`
456-
* if @kconfig{CONFIG_POSIX_API} is defined.
456+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
457457
*/
458458
__syscall int zsock_listen(int sock, int backlog);
459459

@@ -465,7 +465,7 @@ __syscall int zsock_listen(int sock, int backlog);
465465
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html
466466
* for normative description.
467467
* This function is also exposed as `accept()`
468-
* if @kconfig{CONFIG_POSIX_API} is defined.
468+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
469469
*/
470470
__syscall int zsock_accept(int sock, struct sockaddr *addr, socklen_t *addrlen);
471471

@@ -477,7 +477,7 @@ __syscall int zsock_accept(int sock, struct sockaddr *addr, socklen_t *addrlen);
477477
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html
478478
* for normative description.
479479
* This function is also exposed as `sendto()`
480-
* if @kconfig{CONFIG_POSIX_API} is defined.
480+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
481481
*/
482482
__syscall ssize_t zsock_sendto(int sock, const void *buf, size_t len,
483483
int flags, const struct sockaddr *dest_addr,
@@ -491,7 +491,7 @@ __syscall ssize_t zsock_sendto(int sock, const void *buf, size_t len,
491491
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html
492492
* for normative description.
493493
* This function is also exposed as `send()`
494-
* if @kconfig{CONFIG_POSIX_API} is defined.
494+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
495495
*/
496496
static inline ssize_t zsock_send(int sock, const void *buf, size_t len,
497497
int flags)
@@ -507,7 +507,7 @@ static inline ssize_t zsock_send(int sock, const void *buf, size_t len,
507507
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html
508508
* for normative description.
509509
* This function is also exposed as `sendmsg()`
510-
* if @kconfig{CONFIG_POSIX_API} is defined.
510+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
511511
*/
512512
__syscall ssize_t zsock_sendmsg(int sock, const struct msghdr *msg,
513513
int flags);
@@ -520,7 +520,7 @@ __syscall ssize_t zsock_sendmsg(int sock, const struct msghdr *msg,
520520
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html
521521
* for normative description.
522522
* This function is also exposed as `recvfrom()`
523-
* if @kconfig{CONFIG_POSIX_API} is defined.
523+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
524524
*/
525525
__syscall ssize_t zsock_recvfrom(int sock, void *buf, size_t max_len,
526526
int flags, struct sockaddr *src_addr,
@@ -534,7 +534,7 @@ __syscall ssize_t zsock_recvfrom(int sock, void *buf, size_t max_len,
534534
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html
535535
* for normative description.
536536
* This function is also exposed as `recvmsg()`
537-
* if @kconfig{CONFIG_POSIX_API} is defined.
537+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
538538
*/
539539
__syscall ssize_t zsock_recvmsg(int sock, struct msghdr *msg, int flags);
540540

@@ -546,7 +546,7 @@ __syscall ssize_t zsock_recvmsg(int sock, struct msghdr *msg, int flags);
546546
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html
547547
* for normative description.
548548
* This function is also exposed as `recv()`
549-
* if @kconfig{CONFIG_POSIX_API} is defined.
549+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
550550
*/
551551
static inline ssize_t zsock_recv(int sock, void *buf, size_t max_len,
552552
int flags)
@@ -561,7 +561,7 @@ static inline ssize_t zsock_recv(int sock, void *buf, size_t max_len,
561561
* This functions allow to (only) configure a socket for blocking or
562562
* non-blocking operation (O_NONBLOCK).
563563
* This function is also exposed as `fcntl()`
564-
* if @kconfig{CONFIG_POSIX_API} is defined (in which case
564+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined (in which case
565565
* it may conflict with generic POSIX `fcntl()` function).
566566
*/
567567
__syscall int zsock_fcntl_impl(int sock, int cmd, int flags);
@@ -599,7 +599,7 @@ static inline int zsock_fcntl_wrapper(int sock, int cmd, ...)
599599
* `ZFD_IOCTL_FIONREAD`, to set non-blocking mode, and query the number of
600600
* bytes available to read, respectively.
601601
* This function is also exposed as `ioctl()`
602-
* if @kconfig{CONFIG_POSIX_API} is defined (in which case
602+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined (in which case
603603
* it may conflict with generic POSIX `ioctl()` function).
604604
*/
605605
__syscall int zsock_ioctl_impl(int sock, unsigned long request, va_list ap);
@@ -630,7 +630,7 @@ static inline int zsock_ioctl_wrapper(int sock, unsigned long request, ...)
630630
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html
631631
* for normative description.
632632
* This function is also exposed as `poll()`
633-
* if @kconfig{CONFIG_POSIX_API} is defined (in which case
633+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined (in which case
634634
* it may conflict with generic POSIX `poll()` function).
635635
*/
636636
static inline int zsock_poll(struct zsock_pollfd *fds, int nfds, int timeout)
@@ -649,7 +649,7 @@ static inline int zsock_poll(struct zsock_pollfd *fds, int nfds, int timeout)
649649
* available in Linux (some options are dummy and provided to ease porting
650650
* of existing code).
651651
* This function is also exposed as `getsockopt()`
652-
* if @kconfig{CONFIG_POSIX_API} is defined.
652+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
653653
*/
654654
__syscall int zsock_getsockopt(int sock, int level, int optname,
655655
void *optval, socklen_t *optlen);
@@ -665,7 +665,7 @@ __syscall int zsock_getsockopt(int sock, int level, int optname,
665665
* available in Linux (some options are dummy and provided to ease porting
666666
* of existing code).
667667
* This function is also exposed as `setsockopt()`
668-
* if @kconfig{CONFIG_POSIX_API} is defined.
668+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
669669
*/
670670
__syscall int zsock_setsockopt(int sock, int level, int optname,
671671
const void *optval, socklen_t optlen);
@@ -678,7 +678,7 @@ __syscall int zsock_setsockopt(int sock, int level, int optname,
678678
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html
679679
* for normative description.
680680
* This function is also exposed as `getpeername()`
681-
* if @kconfig{CONFIG_POSIX_API} is defined.
681+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
682682
*/
683683
__syscall int zsock_getpeername(int sock, struct sockaddr *addr,
684684
socklen_t *addrlen);
@@ -691,7 +691,7 @@ __syscall int zsock_getpeername(int sock, struct sockaddr *addr,
691691
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html
692692
* for normative description.
693693
* This function is also exposed as `getsockname()`
694-
* if @kconfig{CONFIG_POSIX_API} is defined.
694+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
695695
*/
696696
__syscall int zsock_getsockname(int sock, struct sockaddr *addr,
697697
socklen_t *addrlen);
@@ -704,7 +704,7 @@ __syscall int zsock_getsockname(int sock, struct sockaddr *addr,
704704
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html
705705
* for normative description.
706706
* This function is also exposed as `gethostname()`
707-
* if @kconfig{CONFIG_POSIX_API} is defined.
707+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
708708
*/
709709
__syscall int zsock_gethostname(char *buf, size_t len);
710710

@@ -716,7 +716,7 @@ __syscall int zsock_gethostname(char *buf, size_t len);
716716
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html
717717
* for normative description.
718718
* This function is also exposed as `inet_ntop()`
719-
* if @kconfig{CONFIG_POSIX_API} is defined.
719+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
720720
*/
721721
static inline char *zsock_inet_ntop(sa_family_t family, const void *src,
722722
char *dst, size_t size)
@@ -732,7 +732,7 @@ static inline char *zsock_inet_ntop(sa_family_t family, const void *src,
732732
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_pton.html
733733
* for normative description.
734734
* This function is also exposed as `inet_pton()`
735-
* if @kconfig{CONFIG_POSIX_API} is defined.
735+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
736736
*/
737737
__syscall int zsock_inet_pton(sa_family_t family, const char *src, void *dst);
738738

@@ -775,7 +775,7 @@ __syscall int z_zsock_getaddrinfo_internal(const char *host,
775775
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html
776776
* for normative description.
777777
* This function is also exposed as `getaddrinfo()`
778-
* if @kconfig{CONFIG_POSIX_API} is defined.
778+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
779779
*/
780780
int zsock_getaddrinfo(const char *host, const char *service,
781781
const struct zsock_addrinfo *hints,
@@ -789,7 +789,7 @@ int zsock_getaddrinfo(const char *host, const char *service,
789789
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/freeaddrinfo.html
790790
* for normative description.
791791
* This function is also exposed as `freeaddrinfo()`
792-
* if @kconfig{CONFIG_POSIX_API} is defined.
792+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
793793
*/
794794
void zsock_freeaddrinfo(struct zsock_addrinfo *ai);
795795

@@ -801,7 +801,7 @@ void zsock_freeaddrinfo(struct zsock_addrinfo *ai);
801801
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/gai_strerror.html
802802
* for normative description.
803803
* This function is also exposed as `gai_strerror()`
804-
* if @kconfig{CONFIG_POSIX_API} is defined.
804+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
805805
*/
806806
const char *zsock_gai_strerror(int errcode);
807807

@@ -836,7 +836,7 @@ const char *zsock_gai_strerror(int errcode);
836836
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnameinfo.html
837837
* for normative description.
838838
* This function is also exposed as `getnameinfo()`
839-
* if @kconfig{CONFIG_POSIX_API} is defined.
839+
* if @kconfig{CONFIG_POSIX_NETWORKING} is defined.
840840
*/
841841
int zsock_getnameinfo(const struct sockaddr *addr, socklen_t addrlen,
842842
char *host, socklen_t hostlen,
@@ -1278,7 +1278,7 @@ struct socket_op_vtable {
12781278
* Additionally, if non-zephyr-prefixed headers are used here,
12791279
* native_sim pulls in those from the host rather than Zephyr's.
12801280
*/
1281-
#if defined(CONFIG_POSIX_API)
1281+
#if defined(CONFIG_POSIX_NETWORKING)
12821282
#if !defined(ZEPHYR_INCLUDE_POSIX_ARPA_INET_H_)
12831283
#include <arpa/inet.h>
12841284
#endif
@@ -1294,6 +1294,6 @@ struct socket_op_vtable {
12941294
#if !defined(ZEPHYR_INCLUDE_POSIX_SYS_SOCKET_H_)
12951295
#include <sys/socket.h>
12961296
#endif
1297-
#endif /* CONFIG_POSIX_API */
1297+
#endif /* CONFIG_POSIX_NETWORKING */
12981298

12991299
#endif /* ZEPHYR_INCLUDE_NET_SOCKET_H_ */

include/zephyr/net/socket_select.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ typedef struct zvfs_fd_set zsock_fd_set;
4343
* use zsock_poll() instead. In Zephyr this function works only with
4444
* sockets, not arbitrary file descriptors.
4545
* This function is also exposed as `select()`
46-
* if @kconfig{CONFIG_POSIX_API} is defined (in which case
46+
* if @kconfig{CONFIG_POSIX_DEVICE_IO} is defined (in which case
4747
* it may conflict with generic POSIX `select()` function).
4848
*/
4949
static inline int zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *writefds,
@@ -68,7 +68,7 @@ static inline int zsock_select(int nfds, zsock_fd_set *readfds, zsock_fd_set *wr
6868
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html
6969
* for normative description.
7070
* This function is also exposed as `FD_ZERO()`
71-
* if @kconfig{CONFIG_POSIX_API} is defined.
71+
* if @kconfig{CONFIG_POSIX_DEVICE_IO} is defined.
7272
*/
7373
static inline void ZSOCK_FD_ZERO(zsock_fd_set *set)
7474
{
@@ -83,7 +83,7 @@ static inline void ZSOCK_FD_ZERO(zsock_fd_set *set)
8383
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html
8484
* for normative description.
8585
* This function is also exposed as `FD_ISSET()`
86-
* if @kconfig{CONFIG_POSIX_API} is defined.
86+
* if @kconfig{CONFIG_POSIX_DEVICE_IO} is defined.
8787
*/
8888
static inline int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set)
8989
{
@@ -98,7 +98,7 @@ static inline int ZSOCK_FD_ISSET(int fd, zsock_fd_set *set)
9898
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html
9999
* for normative description.
100100
* This function is also exposed as `FD_CLR()`
101-
* if @kconfig{CONFIG_POSIX_API} is defined.
101+
* if @kconfig{CONFIG_POSIX_DEVICE_IO} is defined.
102102
*/
103103
static inline void ZSOCK_FD_CLR(int fd, zsock_fd_set *set)
104104
{
@@ -113,7 +113,7 @@ static inline void ZSOCK_FD_CLR(int fd, zsock_fd_set *set)
113113
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html
114114
* for normative description.
115115
* This function is also exposed as `FD_SET()`
116-
* if @kconfig{CONFIG_POSIX_API} is defined.
116+
* if @kconfig{CONFIG_POSIX_DEVICE_IO} is defined.
117117
*/
118118
static inline void ZSOCK_FD_SET(int fd, zsock_fd_set *set)
119119
{

include/zephyr/posix/unistd.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
#include <sys/types.h>
1111
#include <time.h>
1212

13-
#ifdef CONFIG_POSIX_API
1413
#include <zephyr/fs/fs.h>
15-
#endif
1614
#include <zephyr/posix/sys/confstr.h>
1715
#include <zephyr/posix/sys/sysconf.h>
1816

@@ -22,7 +20,6 @@
2220
extern "C" {
2321
#endif
2422

25-
#ifdef CONFIG_POSIX_API
2623
/* File related operations */
2724
int close(int file);
2825
ssize_t write(int file, const void *buffer, size_t count);
@@ -46,8 +43,6 @@ FUNC_NORETURN void _exit(int status);
4643

4744
int gethostname(char *buf, size_t len);
4845

49-
#endif /* CONFIG_POSIX_API */
50-
5146
#ifdef CONFIG_POSIX_C_LIB_EXT
5247
int getopt(int argc, char *const argv[], const char *optstring);
5348
extern char *optarg;

lib/posix/options/clock.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,16 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
119119
int clock_getcpuclockid(pid_t pid, clockid_t *clock_id)
120120
{
121121
/* We don't allow any process ID but our own. */
122-
if (pid != 0 && pid != getpid()) {
122+
if (pid != 0) {
123123
return EPERM;
124124
}
125125

126+
#ifdef CONFIG_POSIX_MULTI_PROCESS
127+
if (pid != getpid()) {
128+
return EPERM;
129+
}
130+
#endif
131+
126132
*clock_id = CLOCK_PROCESS_CPUTIME_ID;
127133

128134
return 0;

samples/drivers/modem/hello_hl78xx/prj.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
CONFIG_HEAP_MEM_POOL_SIZE=4096
1010
CONFIG_MAIN_STACK_SIZE=4096
1111
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
12-
CONFIG_POSIX_API=y
12+
CONFIG_POSIX_AEP_CHOICE_PSE53=y
1313

1414
#PM
1515
# CONFIG_PM_DEVICE=y

samples/drivers/video/tcpserversink/prj.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ CONFIG_NETWORKING=y
33
CONFIG_NET_TCP=y
44
CONFIG_NET_IPV4=y
55
CONFIG_NET_SOCKETS=y
6-
CONFIG_POSIX_API=y
6+
CONFIG_POSIX_AEP_CHOICE_PSE53=y
77

88
# Kernel options
99
CONFIG_MAIN_STACK_SIZE=2048

samples/modules/thrift/hello/client/prj.conf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CONFIG_REQUIRES_FULL_LIBCPP=y
44
CONFIG_CPP=y
55
CONFIG_STD_CPP17=y
66
CONFIG_CPP_EXCEPTIONS=y
7-
CONFIG_POSIX_API=y
7+
CONFIG_POSIX_AEP_CHOICE_PSE53=y
88
CONFIG_COMMON_LIBC_THRD=y
99
CONFIG_DYNAMIC_THREAD=y
1010
CONFIG_THREAD_STACK_INFO=y
@@ -14,6 +14,8 @@ CONFIG_NET_SOCKETPAIR=y
1414
CONFIG_HEAP_MEM_POOL_SIZE=16384
1515
CONFIG_EVENTFD=y
1616
CONFIG_XSI_STREAMS=y
17+
CONFIG_XSI=y
18+
CONFIG_XSI_SINGLE_PROCESS=y
1719

1820
CONFIG_THRIFT=y
1921

0 commit comments

Comments
 (0)