-
Notifications
You must be signed in to change notification settings - Fork 7.4k
posix: Clean up of struct timeval define and related functions #15628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fa233cc
9b79a84
97df338
c2d3c0e
81c772a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2019 Linaro Limited | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef ZEPHYR_INCLUDE_POSIX_SYS_TIME_H_ | ||
#define ZEPHYR_INCLUDE_POSIX_SYS_TIME_H_ | ||
|
||
#ifdef CONFIG_NEWLIB_LIBC | ||
/* Kludge to support outdated newlib version as used in SDK 0.10 for Xtensa */ | ||
#include <newlib.h> | ||
|
||
#ifdef __NEWLIB__ | ||
#include <sys/_timeval.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you expecting more things to end up in _timeval.h? Just curious why to introduce a new file instead of just putting the struct here directly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We discussed that at Connect and commit message explains - I'm introduce that file because newlib has that file with that define. It gets included by various other newlib headers. If we have concurrent definition in some other file (like Zephyr POSIX header), we get conflict. We should not play against newlib, but along with it, reusing its definitions. But then the other libc (minimal) should follow the same file structuring and naming, or we'll never get all the different configurations to work consistently. Now why newlib put that declaration in a separate is a different matter. I can theorize that as mentioned, |
||
#else | ||
#include <sys/types.h> | ||
struct timeval { | ||
time_t tv_sec; | ||
suseconds_t tv_usec; | ||
}; | ||
#endif | ||
|
||
#else | ||
#include <sys/_timeval.h> | ||
#endif /* CONFIG_NEWLIB_LIBC */ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
int gettimeofday(struct timeval *tv, const void *tz); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* ZEPHYR_INCLUDE_POSIX_SYS_TIME_H_ */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright (c) 2019 Linaro Limited | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS__TIMEVAL_H_ | ||
#define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS__TIMEVAL_H_ | ||
|
||
#include <sys/types.h> | ||
|
||
struct timeval { | ||
time_t tv_sec; | ||
suseconds_t tv_usec; | ||
}; | ||
|
||
#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_SYS__TIMEVAL_H_ */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some more comments here about what's going on. I'm guessing this is all because of xtensa's version of newlib being very old.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment 2 lines above of "Kludge to support outdated newlib version as used in SDK 0.10 for Xtensa" not enough?