11/*
2- * This file is part of libfaketime, version 0.9.10
2+ * This file is part of libfaketime, version 0.9.11
33 *
44 * libfaketime is free software; you can redistribute it and/or modify it
55 * under the terms of the GNU General Public License v2 as published by the
@@ -4195,21 +4195,21 @@ long handle_futex_syscall(long number, uint32_t* uaddr, int futex_op, uint32_t v
41954195 // not timeout related, just call the real syscall
41964196 goto futex_fallback ;
41974197 }
4198-
4198+
41994199 // if ((futex_op & FUTEX_CMD_MASK) == FUTEX_WAIT_BITSET) {
42004200 if (1 ) {
42014201 clockid_t clk_id = CLOCK_MONOTONIC ;
42024202 if (futex_op & FUTEX_CLOCK_REALTIME )
42034203 clk_id = CLOCK_REALTIME ;
42044204
42054205 struct timespec real_tp , fake_tp ;
4206-
4206+
42074207 DONT_FAKE_TIME ((* real_clock_gettime )(clk_id , & real_tp ));
42084208 fake_tp = real_tp ;
42094209 if (fake_clock_gettime (clk_id , & fake_tp ) == -1 ) {
42104210 goto futex_fallback ;
42114211 }
4212- // Create a corrected timeout by adjusting with the difference between
4212+ // Create a corrected timeout by adjusting with the difference between
42134213 // real and fake timestamps
42144214 struct timespec adjusted_timeout , time_diff ;
42154215 timespecsub (& fake_tp , & real_tp , & time_diff );
@@ -4218,15 +4218,15 @@ long handle_futex_syscall(long number, uint32_t* uaddr, int futex_op, uint32_t v
42184218 long result ;
42194219 result = real_syscall (number , uaddr , futex_op , val , & adjusted_timeout , uaddr2 , val3 );
42204220 if (result != 0 ) {
4221- return result ;
4221+ return result ;
42224222 }
4223-
4223+
42244224 // Check if the futex timeout has already passed according to fake time
42254225 struct timespec now_fake ;
42264226 if (fake_clock_gettime (clk_id , & now_fake ) != 0 ) {
42274227 return result ;
42284228 }
4229-
4229+
42304230 // If the timeout is already passed in fake time, return 0.
42314231 while (!timespeccmp (& now_fake , timeout , >=)) {
42324232 // Calculate how much real time we need to wait
@@ -4249,15 +4249,15 @@ long handle_futex_syscall(long number, uint32_t* uaddr, int futex_op, uint32_t v
42494249 struct timespec real_timeout ;
42504250 timespecadd (& real_now , & wait_time , & real_timeout );
42514251
4252- // fprintf(stdout, "libfaketime: recalculated real timeout: %ld.%09ld\n",
4252+ // fprintf(stdout, "libfaketime: recalculated real timeout: %ld.%09ld\n",
42534253 // real_timeout.tv_sec, real_timeout.tv_nsec);
42544254
42554255 // Call the real syscall with the recalculated timeout
42564256 result = real_syscall (number , uaddr , futex_op , val , & real_timeout , uaddr2 , val3 );
42574257 if (result != 0 ) {
4258- return result ;
4258+ return result ;
42594259 }
4260-
4260+
42614261 // Check if the futex timeout has already passed according to fake time
42624262 if (fake_clock_gettime (clk_id , & now_fake ) != 0 ) {
42634263 return result ;
@@ -4267,7 +4267,7 @@ long handle_futex_syscall(long number, uint32_t* uaddr, int futex_op, uint32_t v
42674267 } else {
42684268 return real_syscall (number , uaddr , futex_op , val , timeout , uaddr2 , val3 );
42694269 }
4270-
4270+
42714271 futex_fallback :
42724272 return real_syscall (number , uaddr , futex_op , val , timeout , uaddr2 , val3 );
42734273}
@@ -4298,7 +4298,7 @@ long syscall(long number, ...) {
42984298 va_end (ap );
42994299 return clock_gettime (clk_id , tp );
43004300 }
4301-
4301+
43024302#ifdef INTERCEPT_FUTEX
43034303 if (number == __NR_futex ) {
43044304 uint32_t * uaddr ;
@@ -4314,7 +4314,7 @@ long syscall(long number, ...) {
43144314 timeout = va_arg (ap , struct timespec * );
43154315 uaddr2 = va_arg (ap , uint32_t * );
43164316 val3 = va_arg (ap , uint32_t );
4317- va_end (ap );
4317+ va_end (ap );
43184318
43194319 return handle_futex_syscall (number , uaddr , futex_op , val , timeout , uaddr2 , val3 );
43204320 }
0 commit comments