1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

libbreplace: compatibility fix for AIX

Adds macros for preprocessor compares and replaces an incomptatible
  compare with one of the new macros.
This fixes a comptability bug on AIX.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11621
Signed-off-by: Guillaume Xavier Taillon <gtaillon@ca.ibm.com>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Tue Jun 13 09:11:56 CEST 2017 on sn-devel-144
This commit is contained in:
Guillaume Xavier Taillon 2016-02-22 14:46:24 -05:00 committed by Bjoern Jacke
parent 60a8ba4a6b
commit 67095c76f6
2 changed files with 10 additions and 2 deletions

View File

@ -79,13 +79,21 @@ int rep_utimes(const char *filename, const struct timeval tv[2]);
typedef int clockid_t;
int rep_clock_gettime(clockid_t clk_id, struct timespec *tp);
#endif
/* make sure we have a best effort CUSTOM_CLOCK_MONOTONIC we can rely on */
/* make sure we have a best effort CUSTOM_CLOCK_MONOTONIC we can rely on.
*
* on AIX the values of CLOCK_* are cast expressions, not integer constants,
* this prevents them from being compared against in a preprocessor directive.
* The following ...IS_* macros can be used to check which clock is in use.
*/
#if defined(CLOCK_MONOTONIC)
#define CUSTOM_CLOCK_MONOTONIC CLOCK_MONOTONIC
#define CUSTOM_CLOCK_MONOTONIC_IS_MONOTONIC
#elif defined(CLOCK_HIGHRES)
#define CUSTOM_CLOCK_MONOTONIC CLOCK_HIGHRES
#define CUSTOM_CLOCK_MONOTONIC_IS_HIGHRES
#else
#define CUSTOM_CLOCK_MONOTONIC CLOCK_REALTIME
#define CUSTOM_CLOCK_MONOTONIC_IS_REALTIME
#endif
#endif

View File

@ -60,7 +60,7 @@ _PUBLIC_ void clock_gettime_mono(struct timespec *tp)
}
#endif
/* then try the monotonic clock: */
#if CUSTOM_CLOCK_MONOTONIC != CLOCK_REALTIME
#ifndef CUSTOM_CLOCK_MONOTONIC_IS_REALTIME
if (clock_gettime(CUSTOM_CLOCK_MONOTONIC,tp) == 0) {
return;
}