libc: minimal: include: move fcntl.h to posix
The `fcntl.h` header has never been a part of ISO C so move it to `include/zephyr/posix`. To ensure a smooth migration, a header was left in `lib/libc/minimal/include` that prints a deprecation warning. Users should either include `<zephyr/posix/fcntl.h>` or switch to `CONFIG_POSIX_API=y`. Signed-off-by: Chris Friedt <cfriedt@meta.com>
This commit is contained in:
parent
6f4e96bc24
commit
8659e2f69e
13 changed files with 64 additions and 14 deletions
|
@ -9,7 +9,7 @@ LOG_MODULE_DECLARE(LOG_MODULE_NAME);
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <fcntl.h>
|
#include <zephyr/posix/fcntl.h>
|
||||||
|
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
/* Define sockaddr, etc, before simplelink.h */
|
/* Define sockaddr, etc, before simplelink.h */
|
||||||
|
|
21
include/zephyr/posix/fcntl.h
Normal file
21
include/zephyr/posix/fcntl.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Linaro Limited
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ZEPHYR_POSIX_FCNTL_H_
|
||||||
|
#define ZEPHYR_POSIX_FCNTL_H_
|
||||||
|
|
||||||
|
#define O_CREAT 0x0200
|
||||||
|
#define O_APPEND 0x0400
|
||||||
|
#define O_EXCL 0x0800
|
||||||
|
#define O_NONBLOCK 0x4000
|
||||||
|
|
||||||
|
#define F_DUPFD 0
|
||||||
|
#define F_GETFL 3
|
||||||
|
#define F_SETFL 4
|
||||||
|
|
||||||
|
int open(const char *name, int flags, ...);
|
||||||
|
|
||||||
|
#endif /* ZEPHYR_POSIX_FCNTL_H_ */
|
|
@ -11,7 +11,7 @@
|
||||||
#include <zephyr/sys/fdtable.h>
|
#include <zephyr/sys/fdtable.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <zephyr/posix/fcntl.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018 Linaro Limited
|
* Copyright (c) 2022 Meta
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -7,15 +7,10 @@
|
||||||
#ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_FCNTL_H_
|
#ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_FCNTL_H_
|
||||||
#define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_FCNTL_H_
|
#define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_FCNTL_H_
|
||||||
|
|
||||||
#define O_CREAT 0x0200
|
#ifndef CONFIG_POSIX_API
|
||||||
#define O_APPEND 0x0400
|
#pragma message("#include <fcntl.h> without CONFIG_POSIX_API is deprecated. " \
|
||||||
#define O_EXCL 0x0800
|
"Please use CONFIG_POSIX_API or #include <zephyr/posix/fcntl.h>")
|
||||||
#define O_NONBLOCK 0x4000
|
#endif
|
||||||
|
#include <zephyr/posix/fcntl.h>
|
||||||
#define F_DUPFD 0
|
|
||||||
#define F_GETFL 3
|
|
||||||
#define F_SETFL 4
|
|
||||||
|
|
||||||
int open(const char *name, int flags, ...);
|
|
||||||
|
|
||||||
#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS_FCNTL_H_ */
|
#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS_FCNTL_H_ */
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <zephyr/sys/fdtable.h>
|
#include <zephyr/sys/fdtable.h>
|
||||||
#include <zephyr/posix/sys/stat.h>
|
#include <zephyr/posix/sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <zephyr/posix/fcntl.h>
|
||||||
#include <zephyr/fs/fs.h>
|
#include <zephyr/fs/fs.h>
|
||||||
|
|
||||||
BUILD_ASSERT(PATH_MAX >= MAX_FILE_NAME, "PATH_MAX is less than MAX_FILE_NAME");
|
BUILD_ASSERT(PATH_MAX >= MAX_FILE_NAME, "PATH_MAX is less than MAX_FILE_NAME");
|
||||||
|
|
|
@ -4,7 +4,12 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_POSIX
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#else
|
||||||
|
#include <zephyr/posix/fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
|
|
|
@ -2,7 +2,11 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 2020 Friedt Professional Engineering Services, Inc
|
* Copyright (c) 2020 Friedt Professional Engineering Services, Inc
|
||||||
*/
|
*/
|
||||||
|
#ifdef CONFIG_ARCH_POSIX
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#else
|
||||||
|
#include <zephyr/posix/fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
LOG_MODULE_DECLARE(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
LOG_MODULE_DECLARE(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_POSIX
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#else
|
||||||
|
#include <zephyr/posix/fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
LOG_MODULE_DECLARE(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
LOG_MODULE_DECLARE(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_POSIX
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#else
|
||||||
|
#include <zephyr/posix/fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
LOG_MODULE_DECLARE(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
LOG_MODULE_DECLARE(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_POSIX
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#else
|
||||||
|
#include <zephyr/posix/fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
LOG_MODULE_DECLARE(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
LOG_MODULE_DECLARE(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_POSIX
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#else
|
||||||
|
#include <zephyr/posix/fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
LOG_MODULE_DECLARE(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
LOG_MODULE_DECLARE(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
||||||
|
|
|
@ -4,7 +4,12 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_POSIX
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#else
|
||||||
|
#include <zephyr/posix/fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_POSIX
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#else
|
||||||
|
#include <zephyr/posix/fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
LOG_MODULE_DECLARE(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
LOG_MODULE_DECLARE(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue