libc: indicate timeval is defined

In order to avoid multiple definition errors, indicate that struct
timeval is declared.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
Chris Friedt
2025-10-14 15:07:10 -04:00
committed by Chris Friedt
parent 192b721732
commit 9f13274c00
5 changed files with 34 additions and 0 deletions

View File

@@ -23,5 +23,6 @@ struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
#define __timeval_defined
#endif /* ZEPHYR_LIB_LIBC_ARMSTDC_INCLUDE_SYS__TIMEVAL_H_ */

View File

@@ -23,5 +23,6 @@ struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
#define __timeval_defined
#endif /* ZEPHYR_LIB_LIBC_IAR_INCLUDE_SYS__TIMEVAL_H_ */

View File

@@ -19,9 +19,13 @@ typedef _TIME_T_ time_t;
typedef _SUSECONDS_T_ suseconds_t;
#endif
#if !defined(_TIMEVAL_DECLARED) && !defined(__timeval_defined)
struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
#define _TIMEVAL_DECLARED
#define __timeval_defined
#endif
#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS__TIMEVAL_H_ */

View File

@@ -0,0 +1,14 @@
/*
* Copyright The Zephyr Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_SYS__TIMEVAL_H_
#define ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_SYS__TIMEVAL_H_
#include_next <sys/_timeval.h>
#define _TIMEVAL_DECLARED
#endif /* ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_SYS__TIMEVAL_H_ */

View File

@@ -0,0 +1,14 @@
/*
* Copyright The Zephyr Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_LIB_LIBC_PICOLIBC_INCLUDE_SYS__TIMEVAL_H_
#define ZEPHYR_LIB_LIBC_PICOLIBC_INCLUDE_SYS__TIMEVAL_H_
#include_next <sys/_timeval.h>
#define _TIMEVAL_DECLARED
#endif /* ZEPHYR_LIB_LIBC_PICOLIBC_INCLUDE_SYS__TIMEVAL_H_ */