Skip to content

Commit

Permalink
preload: Re-fix time64 redirects for glibc < 2.39.9
Browse files Browse the repository at this point in the history
glibc 2.38 in Debian doesn't know about `__USE_TIME64_REDIRECTS` yet, so
no redirection took place. Curiously this only broke on Debian/Ubuntu
ARM architectures, nowhere else.

Apply some guesswork to define `__USE_TIME64_REDIRECTS` ourselves in the
right circumstances.
  • Loading branch information
martinpitt committed May 23, 2024
1 parent d5f5991 commit 8cb6255
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/libumockdev-preload.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ extern int __REDIRECT_NTH (__ttyname_r_alias, (int __fd, char *__buf,
#include "ioctl_tree.h"

#ifdef __GLIBC__

/* __USE_TIME64_REDIRECTS was introduced in glibc 2.39.9. With older releases we need to look at
* __USE_TIME_BITS64 instead, but the latter is always defined in 2.39.9 now. So make some guesswork
* and define the former when appropriate. */
#if !defined(__USE_TIME64_REDIRECTS) && defined(__USE_TIME_BITS64) && __TIMESIZE == 32
#pragma message "Defining backwards compatibility shim __USE_TIME64_REDIRECTS for glibc < 2.39.9"
#define __USE_TIME64_REDIRECTS 1
#endif

/* Fixup for making a mess with __REDIRECT above */
#ifdef __USE_TIME64_REDIRECTS
#define clock_gettime __clock_gettime64
Expand Down

0 comments on commit 8cb6255

Please sign in to comment.