Skip to content

Commit 9f13274

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

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ struct timeval {
2323
time_t tv_sec;
2424
suseconds_t tv_usec;
2525
};
26+
#define __timeval_defined
2627

2728
#endif /* ZEPHYR_LIB_LIBC_ARMSTDC_INCLUDE_SYS__TIMEVAL_H_ */

lib/libc/iar/include/sys/_timeval.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ struct timeval {
2323
time_t tv_sec;
2424
suseconds_t tv_usec;
2525
};
26+
#define __timeval_defined
2627

2728
#endif /* ZEPHYR_LIB_LIBC_IAR_INCLUDE_SYS__TIMEVAL_H_ */

lib/libc/minimal/include/sys/_timeval.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(_TIMEVAL_DECLARED) && !defined(__timeval_defined)
2223
struct timeval {
2324
time_t tv_sec;
2425
suseconds_t tv_usec;
2526
};
27+
#define _TIMEVAL_DECLARED
28+
#define __timeval_defined
29+
#endif
2630

2731
#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS__TIMEVAL_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__TIMEVAL_H_
8+
#define ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_SYS__TIMEVAL_H_
9+
10+
#include_next <sys/_timeval.h>
11+
12+
#define _TIMEVAL_DECLARED
13+
14+
#endif /* ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_SYS__TIMEVAL_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__TIMEVAL_H_
8+
#define ZEPHYR_LIB_LIBC_PICOLIBC_INCLUDE_SYS__TIMEVAL_H_
9+
10+
#include_next <sys/_timeval.h>
11+
12+
#define _TIMEVAL_DECLARED
13+
14+
#endif /* ZEPHYR_LIB_LIBC_PICOLIBC_INCLUDE_SYS__TIMEVAL_H_ */

0 commit comments

Comments
 (0)