Skip to content

Commit 192b721

Browse files
committed
libc: indicate timespec is defined
In order to avoid multiple definition errors, indicate that struct timespec is declared. Signed-off-by: Chris Friedt <[email protected]>
1 parent 8017e17 commit 192b721

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

lib/libc/arcmwdt/include/sys/timespec.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
#include <sys/_timespec.h>
1111

12+
#define _TIMESPEC_DECLARED
13+
1214
struct itimerspec {
1315
struct timespec it_interval; /* Timer interval */
1416
struct timespec it_value; /* Timer expiration */

lib/libc/armstdc/include/sys/_timespec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ struct timespec {
1313
time_t tv_sec;
1414
long tv_nsec;
1515
};
16+
#define __timespec_defined
1617

1718
#endif /* ZEPHYR_LIB_LIBC_ARMSTDC_INCLUDE_SYS__TIMESPEC_H_ */

lib/libc/minimal/include/sys/_timespec.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ typedef _TIME_T_ time_t;
1919
typedef _SUSECONDS_T_ suseconds_t;
2020
#endif
2121

22+
#if !defined(_TIMESPEC_DECLARED) && !defined(__timespec_defined)
2223
struct timespec {
2324
time_t tv_sec;
2425
long tv_nsec;
2526
};
27+
#define __timespec_defined
28+
#define _TIMESPEC_DECLARED
29+
#endif
2630

2731
#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS__TIMESPEC_H_ */
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright The Zephyr Project Contributors
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_SYS__TIMESPEC_H_
8+
#define ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_SYS__TIMESPEC_H_
9+
10+
#include_next <sys/_timespec.h>
11+
12+
#define _TIMESPEC_DECLARED
13+
14+
#endif /* ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_SYS__TIMESPEC_H_ */
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright The Zephyr Project Contributors
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef ZEPHYR_LIB_LIBC_PICOLIBC_INCLUDE_SYS__TIMESPEC_H_
8+
#define ZEPHYR_LIB_LIBC_PICOLIBC_INCLUDE_SYS__TIMESPEC_H_
9+
10+
#include_next <sys/_timespec.h>
11+
12+
#define _TIMESPEC_DECLARED
13+
14+
#endif /* ZEPHYR_LIB_LIBC_PICOLIBC_INCLUDE_SYS__TIMESPEC_H_ */

0 commit comments

Comments
 (0)