-
Notifications
You must be signed in to change notification settings - Fork 583
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
timer: fix printf specifiers for __suseconds64_t #2452
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New internal glibc types __timeval64 [1] and __suseconds64_t [2] have been introduced as a solution for the Y2038 problem [3]. These 64-bit types are used across all architectures. However, this change causes the following build errors when cross-compiling on ARMv7 (armhf): criu/timer.c:49:17: error: format '%ld' expects argument of type 'long int', but argument 5 has type '__suseconds64_t' {aka 'long long int'} [-Werror=format=] 49 | pr_info("Restored %s timer to %" PRId64 ".%ld -> %" PRId64 ".%ld\n", n, | ^~~~~~~~~~~~~~~~~~~~~~~~ 50 | (int64_t)val->it_value.tv_sec, val->it_value.tv_usec, | ~~~~~~~~~~~~~~~~~~~~~ | | | __suseconds64_t {aka long long int} criu/timer.c:49:17: error: format '%ld' expects argument of type 'long int', but argument 7 has type '__suseconds64_t' {aka 'long long int'} [-Werror=format=] 49 | pr_info("Restored %s timer to %" PRId64 ".%ld -> %" PRId64 ".%ld\n", n, | ^~~~~~~~~~~~~~~~~~~~~~~~ 50 | (int64_t)val->it_value.tv_sec, val->it_value.tv_usec, 51 | (int64_t)val->it_interval.tv_sec, val->it_interval.tv_usec); | ~~~~~~~~~~~~~~~~~~~~~~~~ | | | __suseconds64_t {aka long long int} ns.c:234:48: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'time_t' {aka 'long long int'} [-Werror=format=] 234 | len = snprintf(buf, sizeof(buf), "%d %ld 0", clk_id, offset); | ~~^ ~~~~~~ | | | | long int time_t {aka long long int} | %lld msg.c:58:41: error: format '%ld' expects argument of type 'long int', but argument 3 has type '__suseconds64_t' {aka 'long long int'} [-Werror=format=] 58 | off += sprintf(buf + off, ".%.3ld: ", tv.tv_usec / 1000); | ~~~~^ ~~~~~~~~~~~~~~~~~ | | | | long int __suseconds64_t {aka long long int} | %.3lld ../lib/zdtmtst.h:137:26: error: format '%ld' expects argument of type 'long int', but argument 4 has type '__time64_t' {aka 'long long int'} [-Werror=format=] 137 | test_msg("ERR: %s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, \ | ^~~~~~~~~~~~~~ pthread_timers_h.c:72:17: note: in expansion of macro 'pr_perror' 72 | pr_perror("wrong interval: %ld:%ld", itimerspec.it_interval.tv_sec, itimerspec.it_interval.tv_nsec); | ^~~~~~~~~ vdso00.c:22:32: error: format '%li' expects argument of type 'long int', but argument 3 has type '__time64_t' {aka 'long long int'} [-Werror=format=] 22 | test_msg("%d time: %10li\n", getpid(), tv.tv_sec); | ~~~~^ ~~~~~~~~~ | | | | long int __time64_t {aka long long int} | %10lli vdso00.c:29:32: error: format '%li' expects argument of type 'long int', but argument 3 has type '__time64_t' {aka 'long long int'} [-Werror=format=] 29 | test_msg("%d time: %10li\n", getpid(), tv.tv_sec); | ~~~~^ ~~~~~~~~~ | | | | long int __time64_t {aka long long int} | %10lli vdso01.c:357:42: error: format '%li' expects argument of type 'long int', but argument 2 has type '__time64_t' {aka 'long long int'} [-Werror=format=] 357 | test_msg("gettimeofday: tv_sec %li vdso_gettimeofday: tv_sec %li\n", tv1.tv_sec, tv2.tv_sec); | ~~^ ~~~~~~~~~~ | | | | long int __time64_t {aka long long int} | %lli vdso01.c:357:72: error: format '%li' expects argument of type 'long int', but argument 3 has type '__time64_t' {aka 'long long int'} [-Werror=format=] 357 | test_msg("gettimeofday: tv_sec %li vdso_gettimeofday: tv_sec %li\n", tv1.tv_sec, tv2.tv_sec); | ~~^ ~~~~~~~~~~ | | | | long int __time64_t {aka long long int} | vdso01.c:328:43: error: format '%li' expects argument of type 'long int', but argument 2 has type '__time64_t' {aka 'long long int'} [-Werror=format=] 328 | test_msg("clock_gettime: tv_sec %li vdso_clock_gettime: tv_sec %li\n", ts1.tv_sec, ts2.tv_sec); | ~~^ ~~~~~~~~~~ | | | | long int __time64_t {aka long long int} | %lli vdso01.c:328:74: error: format '%li' expects argument of type 'long int', but argument 3 has type '__time64_t' {aka 'long long int'} [-Werror=format=] 328 | test_msg("clock_gettime: tv_sec %li vdso_clock_gettime: tv_sec %li\n", ts1.tv_sec, ts2.tv_sec); | ~~^ ~~~~~~~~~~ | | | | long int __time64_t {aka long long int} | ../lib/zdtmtst.h:144:26: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'time_t' {aka 'long long int'} [-Werror=format=] 144 | test_msg("FAIL: %s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, \ | ^~~~~~~~~~~~~~~ mtime_mmap.c:80:17: note: in expansion of macro 'fail' 80 | fail("mtime %ld wasn't updated on mmapped %s file", mtime_new, filename); | ^~~~ ../lib/zdtmtst.h:144:26: error: format '%ld' expects argument of type 'long int', but argument 4 has type '__time64_t' {aka 'long long int'} [-Werror=format=] 144 | test_msg("FAIL: %s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, \ | ^~~~~~~~~~~~~~~ mtime_mmap.c:101:17: note: in expansion of macro 'fail' 101 | fail("After migration, mtime changed to %ld", fst.st_mtime); | ^~~~ [1] https://sourceware.org/git/?p=glibc.git;h=504c98717062cb9bcbd4b3e59e932d04331ddca5 [2] https://sourceware.org/git/?p=glibc.git;h=3fced064f23562ec24f8312ffbc14950993969e6 [3] https://en.wikipedia.org/wiki/Year_2038_problem Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New internal glibc types __timeval64 and __suseconds64_t have been introduced as a solution for the Y2038 problem. These 64-bit types are used across all architectures. However, this change causes build errors when cross-compiling on ARMv7 (armhf). This pull request updates the printf format specifiers to support 64-bit integer types.