net: lwm2m: Fix native_posix fcntl() calls

Native POSIX target still needs to use the <fcntl.h> header
instead of <zephyr/posix/fcntl.h>

Also removed the include from various files that did not use it.

Also changed fcntl() calls to zsock_fcntl() because we directly
use zsock_* calls elsewhere.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This commit is contained in:
Seppo Takalo 2023-02-01 13:03:39 +02:00 committed by Stephanos Ioannidis
parent 78281132ba
commit d0dc67a72d
4 changed files with 8 additions and 7 deletions

View file

@ -32,7 +32,11 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <zephyr/net/socket.h>
#include <zephyr/sys/printk.h>
#include <zephyr/types.h>
#ifdef CONFIG_ARCH_POSIX
#include <fcntl.h>
#else
#include <zephyr/posix/fcntl.h>
#endif
#if defined(CONFIG_LWM2M_DTLS_SUPPORT)
#include <zephyr/net/tls_credentials.h>
@ -919,16 +923,16 @@ int lwm2m_socket_start(struct lwm2m_ctx *client_ctx)
goto error;
}
flags = fcntl(client_ctx->sock_fd, F_GETFL, 0);
flags = zsock_fcntl(client_ctx->sock_fd, F_GETFL, 0);
if (flags == -1) {
ret = -errno;
LOG_ERR("fcntl(F_GETFL) failed (%d)", ret);
LOG_ERR("zsock_fcntl(F_GETFL) failed (%d)", ret);
goto error;
}
ret = fcntl(client_ctx->sock_fd, F_SETFL, flags | O_NONBLOCK);
ret = zsock_fcntl(client_ctx->sock_fd, F_SETFL, flags | O_NONBLOCK);
if (ret == -1) {
ret = -errno;
LOG_ERR("fcntl(F_SETFL) failed (%d)", ret);
LOG_ERR("zsock_fcntl(F_SETFL) failed (%d)", ret);
goto error;
}

View file

@ -33,7 +33,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <zephyr/net/socket.h>
#include <zephyr/sys/printk.h>
#include <zephyr/types.h>
#include <zephyr/posix/fcntl.h>
#if defined(CONFIG_LWM2M_DTLS_SUPPORT)
#include <zephyr/net/tls_credentials.h>

View file

@ -37,7 +37,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <zephyr/net/socket.h>
#include <zephyr/sys/printk.h>
#include <zephyr/types.h>
#include <zephyr/posix/fcntl.h>
#if defined(CONFIG_LWM2M_RW_SENML_JSON_SUPPORT)
#include "lwm2m_rw_senml_json.h"

View file

@ -34,7 +34,6 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <time.h>
#include <zephyr/types.h>
#include <zephyr/posix/fcntl.h>
#define BINDING_OPT_MAX_LEN 3 /* "UQ" */
#define QUEUE_OPT_MAX_LEN 2 /* "Q" */