[tor-commits] [tor/master] Merge remote-tracking branch 'origin/maint-0.2.2'
nickm at torproject.org
nickm at torproject.org
Wed Mar 30 18:55:17 UTC 2011
commit ee871e7a0e9ce9b1df8b8f4add06e8c193b9544a
Merge: 18126f9 65eb0e4
Author: Nick Mathewson <nickm at torproject.org>
Date: Wed Mar 30 14:55:50 2011 -0400
Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts:
src/common/compat.h
src/or/circuitlist.c
src/or/circuituse.c
src/or/or.h
src/or/rephist.c
changes/cbt_hi_res | 7 +++
changes/cbt_parallel_intro | 4 ++
changes/zlib_aint_openssl | 3 +
configure.in | 8 ++--
src/common/compat.h | 47 ++++++++++++++++++++---
src/or/circuitlist.c | 4 +-
src/or/circuituse.c | 91 ++++++++++++++++++++++++++------------------
src/or/circuituse.h | 2 +-
src/or/main.c | 4 +-
9 files changed, 119 insertions(+), 51 deletions(-)
diff --cc src/common/compat.h
index db352de,550c08b..6d2565a
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@@ -335,17 -333,49 +335,52 @@@ struct tm *tor_localtime_r(const time_
struct tm *tor_gmtime_r(const time_t *timep, struct tm *result);
#endif
- /** Return true iff the tvp is related to uvp according to the relational
- * operator cmp. Recognized values for cmp are ==, <=, <, >=, and >. */
- #define tor_timercmp(tvp, uvp, cmp) \
- (((tvp)->tv_sec == (uvp)->tv_sec) ? \
- ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
- ((tvp)->tv_sec cmp (uvp)->tv_sec))
+ #ifndef timeradd
+ /** Replacement for timeradd on platforms that do not have it: sets tvout to
+ * the sum of tv1 and tv2. */
+ #define timeradd(tv1,tv2,tvout) \
+ do { \
+ (tvout)->tv_sec = (tv1)->tv_sec + (tv2)->tv_sec; \
+ (tvout)->tv_usec = (tv2)->tv_usec + (tv2)->tv_usec; \
+ if ((tvout)->tv_usec >= 1000000) { \
+ (tvout)->tv_usec -= 1000000; \
+ (tvout)->tv_sec++; \
+ } \
+ } while (0)
+ #endif
+
+ #ifndef timersub
+ /** Replacement for timersub on platforms that do not have it: sets tvout to
+ * tv1 minus tv2. */
+ #define timersub(tv1,tv2,tvout) \
+ do { \
+ (tvout)->tv_sec = (tv1)->tv_sec - (tv2)->tv_sec; \
+ (tvout)->tv_usec = (tv2)->tv_usec - (tv2)->tv_usec; \
+ if ((tvout)->tv_usec < 0) { \
+ (tvout)->tv_usec += 1000000; \
+ (tvout)->tv_sec--; \
+ } \
+ } while (0)
+ #endif
+
+ #ifndef timercmp
+ /** Replacement for timersub on platforms that do not have it: returns true
+ * iff the relational operator "op" makes the expression tv1 op tv2 true.
+ *
+ * Note that while this definition should work for all boolean opeators, some
+ * platforms' native timercmp definitions do not support >=, <=, or ==. So
+ * don't use those.
+ */
+ #define timercmp(tv1,tv2,op) \
+ (((tv1)->tv_sec == (tv2)->tv_sec) ? \
+ ((tv1)->tv_usec op (tv2)->tv_usec) : \
+ ((tv1)->tv_sec op (tv2)->tv_sec))
+ #endif
/* ===== File compatibility */
+int tor_open_cloexec(const char *path, int flags, unsigned mode);
+FILE *tor_fopen_cloexec(const char *path, const char *mode);
+
int replace_file(const char *from, const char *to);
int touch_file(const char *fname);
More information about the tor-commits
mailing list