tests: posix: net: fix missing clock_t and clockid_t with newlib

Fix errors found in CI for missing clock_t and clockid_t types
when building the tests/posix/net testsuite.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
Chris Friedt 2024-10-15 12:53:37 -04:00 committed by David Leach
commit 45b3010d74
3 changed files with 16 additions and 0 deletions

View file

@ -11,6 +11,18 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#if !defined(_CLOCK_T_DECLARED) && !defined(__clock_t_defined)
typedef unsigned long clock_t;
#define _CLOCK_T_DECLARED
#define __clock_t_defined
#endif
#if !defined(_CLOCKID_T_DECLARED) && !defined(__clockid_t_defined)
typedef unsigned long clockid_t;
#define _CLOCKID_T_DECLARED
#define __clockid_t_defined
#endif
#ifdef CONFIG_NEWLIB_LIBC #ifdef CONFIG_NEWLIB_LIBC
#include <sys/_pthreadtypes.h> #include <sys/_pthreadtypes.h>
#endif #endif

View file

@ -6,6 +6,8 @@
#ifndef ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_ #ifndef ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_
#define ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_ #define ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_
#include "posix_types.h"
#include <zephyr/sys/fdtable.h> #include <zephyr/sys/fdtable.h>
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -7,3 +7,5 @@ project(posix_net)
FILE(GLOB app_sources src/*.c) FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources}) target_sources(app PRIVATE ${app_sources})
target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L)