Skip to content

Commit 45b3010

Browse files
cfriedtdleach02
authored andcommitted
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 <[email protected]>
1 parent 8c705ca commit 45b3010

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

include/zephyr/posix/posix_types.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
#include <sys/types.h>
1212
#endif
1313

14+
#if !defined(_CLOCK_T_DECLARED) && !defined(__clock_t_defined)
15+
typedef unsigned long clock_t;
16+
#define _CLOCK_T_DECLARED
17+
#define __clock_t_defined
18+
#endif
19+
20+
#if !defined(_CLOCKID_T_DECLARED) && !defined(__clockid_t_defined)
21+
typedef unsigned long clockid_t;
22+
#define _CLOCKID_T_DECLARED
23+
#define __clockid_t_defined
24+
#endif
25+
1426
#ifdef CONFIG_NEWLIB_LIBC
1527
#include <sys/_pthreadtypes.h>
1628
#endif

include/zephyr/posix/sys/select.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#ifndef ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_
77
#define ZEPHYR_INCLUDE_POSIX_SYS_SELECT_H_
88

9+
#include "posix_types.h"
10+
911
#include <zephyr/sys/fdtable.h>
1012

1113
#ifdef __cplusplus

tests/posix/net/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ project(posix_net)
77
FILE(GLOB app_sources src/*.c)
88

99
target_sources(app PRIVATE ${app_sources})
10+
11+
target_compile_options(app PRIVATE -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L)

0 commit comments

Comments
 (0)