mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Merge remote-tracking branch 'github/ticket26626'
This commit is contained in:
commit
df98582851
3
changes/ticket26626
Normal file
3
changes/ticket26626
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
o Code simplification and refactoring:
|
||||||
|
- Tor now assumes that you have standards-conformant stdint.h and
|
||||||
|
inttypes.h headers when compiling. Closes ticket 26626.
|
17
configure.ac
17
configure.ac
@ -1393,7 +1393,6 @@ AC_CHECK_HEADERS([errno.h \
|
|||||||
netinet/in6.h \
|
netinet/in6.h \
|
||||||
pwd.h \
|
pwd.h \
|
||||||
readpassphrase.h \
|
readpassphrase.h \
|
||||||
stdint.h \
|
|
||||||
stdatomic.h \
|
stdatomic.h \
|
||||||
sys/eventfd.h \
|
sys/eventfd.h \
|
||||||
sys/file.h \
|
sys/file.h \
|
||||||
@ -1517,22 +1516,6 @@ AC_CHECK_MEMBERS([struct timeval.tv_sec], , ,
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif])
|
#endif])
|
||||||
|
|
||||||
dnl In case we aren't given a working stdint.h, we'll need to grow our own.
|
|
||||||
dnl Watch out.
|
|
||||||
|
|
||||||
AC_CHECK_SIZEOF(int8_t)
|
|
||||||
AC_CHECK_SIZEOF(int16_t)
|
|
||||||
AC_CHECK_SIZEOF(int32_t)
|
|
||||||
AC_CHECK_SIZEOF(int64_t)
|
|
||||||
AC_CHECK_SIZEOF(uint8_t)
|
|
||||||
AC_CHECK_SIZEOF(uint16_t)
|
|
||||||
AC_CHECK_SIZEOF(uint32_t)
|
|
||||||
AC_CHECK_SIZEOF(uint64_t)
|
|
||||||
AC_CHECK_SIZEOF(intptr_t)
|
|
||||||
AC_CHECK_SIZEOF(uintptr_t)
|
|
||||||
|
|
||||||
dnl AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, intptr_t, uintptr_t])
|
|
||||||
|
|
||||||
AC_CHECK_SIZEOF(char)
|
AC_CHECK_SIZEOF(char)
|
||||||
AC_CHECK_SIZEOF(short)
|
AC_CHECK_SIZEOF(short)
|
||||||
AC_CHECK_SIZEOF(int)
|
AC_CHECK_SIZEOF(int)
|
||||||
|
@ -35,8 +35,8 @@ typedef int pid_t;
|
|||||||
#define PID_T_FORMAT "%d"
|
#define PID_T_FORMAT "%d"
|
||||||
#elif (SIZEOF_PID_T == SIZEOF_LONG)
|
#elif (SIZEOF_PID_T == SIZEOF_LONG)
|
||||||
#define PID_T_FORMAT "%ld"
|
#define PID_T_FORMAT "%ld"
|
||||||
#elif (SIZEOF_PID_T == SIZEOF_INT64_T)
|
#elif (SIZEOF_PID_T == 8)
|
||||||
#define PID_T_FORMAT I64_FORMAT
|
#define PID_T_FORMAT "%"PRId64
|
||||||
#else
|
#else
|
||||||
#error Unknown: SIZEOF_PID_T
|
#error Unknown: SIZEOF_PID_T
|
||||||
#endif /* (0 == SIZEOF_PID_T) && defined(_WIN32) || ... */
|
#endif /* (0 == SIZEOF_PID_T) && defined(_WIN32) || ... */
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#define TOR_COMPAT_COMPILER_H
|
#define TOR_COMPAT_COMPILER_H
|
||||||
|
|
||||||
#include "orconfig.h"
|
#include "orconfig.h"
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
#if defined(__has_feature)
|
#if defined(__has_feature)
|
||||||
# if __has_feature(address_sanitizer)
|
# if __has_feature(address_sanitizer)
|
||||||
@ -105,9 +106,6 @@
|
|||||||
#endif /* !defined(HAVE_MACRO__func__) */
|
#endif /* !defined(HAVE_MACRO__func__) */
|
||||||
#endif /* defined(_MSC_VER) */
|
#endif /* defined(_MSC_VER) */
|
||||||
|
|
||||||
#define U64_TO_DBL(x) ((double) (x))
|
|
||||||
#define DBL_TO_U64(x) ((uint64_t) (x))
|
|
||||||
|
|
||||||
#ifdef ENUM_VALS_ARE_SIGNED
|
#ifdef ENUM_VALS_ARE_SIGNED
|
||||||
#define ENUM_BF(t) unsigned
|
#define ENUM_BF(t) unsigned
|
||||||
#else
|
#else
|
||||||
@ -183,54 +181,10 @@
|
|||||||
#define OP_EQ ==
|
#define OP_EQ ==
|
||||||
#define OP_NE !=
|
#define OP_NE !=
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
/** Casts the uint64_t value in <b>a</b> to the right type for an argument
|
|
||||||
* to printf. */
|
|
||||||
#define U64_PRINTF_ARG(a) (a)
|
|
||||||
/** Casts the uint64_t* value in <b>a</b> to the right type for an argument
|
|
||||||
* to scanf. */
|
|
||||||
#define U64_SCANF_ARG(a) (a)
|
|
||||||
/** Expands to a literal uint64_t-typed constant for the value <b>n</b>. */
|
|
||||||
#define U64_LITERAL(n) (n ## ui64)
|
|
||||||
#define I64_PRINTF_ARG(a) (a)
|
|
||||||
#define I64_SCANF_ARG(a) (a)
|
|
||||||
#define I64_LITERAL(n) (n ## i64)
|
|
||||||
#else /* !(defined(_MSC_VER)) */
|
|
||||||
#define U64_PRINTF_ARG(a) ((long long unsigned int)(a))
|
|
||||||
#define U64_SCANF_ARG(a) ((long long unsigned int*)(a))
|
|
||||||
#define U64_LITERAL(n) (n ## llu)
|
|
||||||
#define I64_PRINTF_ARG(a) ((long long signed int)(a))
|
|
||||||
#define I64_SCANF_ARG(a) ((long long signed int*)(a))
|
|
||||||
#define I64_LITERAL(n) (n ## ll)
|
|
||||||
#endif /* defined(_MSC_VER) */
|
|
||||||
|
|
||||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||||
#define MINGW_ANY
|
#define MINGW_ANY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(MINGW_ANY)
|
|
||||||
/** The formatting string used to put a uint64_t value in a printf() or
|
|
||||||
* scanf() function. See also U64_PRINTF_ARG and U64_SCANF_ARG. */
|
|
||||||
#define U64_FORMAT "%I64u"
|
|
||||||
#define I64_FORMAT "%I64d"
|
|
||||||
#else /* !(defined(_MSC_VER) || defined(MINGW_ANY)) */
|
|
||||||
#define U64_FORMAT "%llu"
|
|
||||||
#define I64_FORMAT "%lld"
|
|
||||||
#endif /* defined(_MSC_VER) || defined(MINGW_ANY) */
|
|
||||||
|
|
||||||
#if (SIZEOF_INTPTR_T == SIZEOF_INT)
|
|
||||||
#define INTPTR_T_FORMAT "%d"
|
|
||||||
#define INTPTR_PRINTF_ARG(x) ((int)(x))
|
|
||||||
#elif (SIZEOF_INTPTR_T == SIZEOF_LONG)
|
|
||||||
#define INTPTR_T_FORMAT "%ld"
|
|
||||||
#define INTPTR_PRINTF_ARG(x) ((long)(x))
|
|
||||||
#elif (SIZEOF_INTPTR_T == 8)
|
|
||||||
#define INTPTR_T_FORMAT I64_FORMAT
|
|
||||||
#define INTPTR_PRINTF_ARG(x) I64_PRINTF_ARG(x)
|
|
||||||
#else
|
|
||||||
#error Unknown: SIZEOF_INTPTR_T
|
|
||||||
#endif /* (SIZEOF_INTPTR_T == SIZEOF_INT) || ... */
|
|
||||||
|
|
||||||
/** Macro: yield a pointer to the field at position <b>off</b> within the
|
/** Macro: yield a pointer to the field at position <b>off</b> within the
|
||||||
* structure <b>st</b>. Example:
|
* structure <b>st</b>. Example:
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -19,189 +19,16 @@
|
|||||||
|
|
||||||
#include "orconfig.h"
|
#include "orconfig.h"
|
||||||
|
|
||||||
#ifdef HAVE_STDINT_H
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#include <stdbool.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIMITS_H
|
|
||||||
#include <limits.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_LIMITS_H
|
#ifdef HAVE_SYS_LIMITS_H
|
||||||
#include <sys/limits.h>
|
#include <sys/limits.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MACHINE_LIMITS_H
|
|
||||||
#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
|
|
||||||
/* FreeBSD has a bug where it complains that this file is obsolete,
|
|
||||||
and I should migrate to using sys/limits. It complains even when
|
|
||||||
I include both.
|
|
||||||
__FreeBSD_kernel__ is defined by Debian GNU/kFreeBSD which
|
|
||||||
does the same thing (but doesn't defined __FreeBSD__).
|
|
||||||
*/
|
|
||||||
#include <machine/limits.h>
|
|
||||||
#endif /* !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) */
|
|
||||||
#endif /* defined(HAVE_MACHINE_LIMITS_H) */
|
|
||||||
#ifdef HAVE_INTTYPES_H
|
|
||||||
#include <inttypes.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#if (SIZEOF_INT8_T != 0)
|
|
||||||
#define HAVE_INT8_T
|
|
||||||
#endif
|
|
||||||
#if (SIZEOF_INT16_T != 0)
|
|
||||||
#define HAVE_INT16_T
|
|
||||||
#endif
|
|
||||||
#if (SIZEOF_INT32_T != 0)
|
|
||||||
#define HAVE_INT32_T
|
|
||||||
#endif
|
|
||||||
#if (SIZEOF_INT64_T != 0)
|
|
||||||
#define HAVE_INT64_T
|
|
||||||
#endif
|
|
||||||
#if (SIZEOF_UINT8_T != 0)
|
|
||||||
#define HAVE_UINT8_T
|
|
||||||
#endif
|
|
||||||
#if (SIZEOF_UINT16_T != 0)
|
|
||||||
#define HAVE_UINT16_T
|
|
||||||
#endif
|
|
||||||
#if (SIZEOF_UINT32_T != 0)
|
|
||||||
#define HAVE_UINT32_T
|
|
||||||
#endif
|
|
||||||
#if (SIZEOF_UINT64_T != 0)
|
|
||||||
#define HAVE_UINT64_T
|
|
||||||
#endif
|
|
||||||
#if (SIZEOF_INTPTR_T != 0)
|
|
||||||
#define HAVE_INTPTR_T
|
|
||||||
#endif
|
|
||||||
#if (SIZEOF_UINTPTR_T != 0)
|
|
||||||
#define HAVE_UINTPTR_T
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (SIZEOF_CHAR == 1)
|
|
||||||
#ifndef HAVE_INT8_T
|
|
||||||
typedef signed char int8_t;
|
|
||||||
#define HAVE_INT8_T
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT8_T
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
#define HAVE_UINT8_T
|
|
||||||
#endif
|
|
||||||
#endif /* (SIZEOF_CHAR == 1) */
|
|
||||||
|
|
||||||
#if (SIZEOF_SHORT == 2)
|
|
||||||
#ifndef HAVE_INT16_T
|
|
||||||
typedef signed short int16_t;
|
|
||||||
#define HAVE_INT16_T
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT16_T
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
#define HAVE_UINT16_T
|
|
||||||
#endif
|
|
||||||
#endif /* (SIZEOF_SHORT == 2) */
|
|
||||||
|
|
||||||
#if (SIZEOF_INT == 2)
|
|
||||||
#ifndef HAVE_INT16_T
|
|
||||||
typedef signed int int16_t;
|
|
||||||
#define HAVE_INT16_T
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT16_T
|
|
||||||
typedef unsigned int uint16_t;
|
|
||||||
#define HAVE_UINT16_T
|
|
||||||
#endif
|
|
||||||
#elif (SIZEOF_INT == 4)
|
|
||||||
#ifndef HAVE_INT32_T
|
|
||||||
typedef signed int int32_t;
|
|
||||||
#define HAVE_INT32_T
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT32_T
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
#define HAVE_UINT32_T
|
|
||||||
#endif
|
|
||||||
#ifndef UINT16_MAX
|
|
||||||
#define UINT16_MAX 0xffffu
|
|
||||||
#endif
|
|
||||||
#ifndef INT16_MAX
|
|
||||||
#define INT16_MAX 0x7fff
|
|
||||||
#endif
|
|
||||||
#ifndef INT16_MIN
|
|
||||||
#define INT16_MIN (-INT16_MAX-1)
|
|
||||||
#endif
|
|
||||||
#ifndef UINT32_MAX
|
|
||||||
#define UINT32_MAX 0xffffffffu
|
|
||||||
#endif
|
|
||||||
#ifndef INT32_MAX
|
|
||||||
#define INT32_MAX 0x7fffffff
|
|
||||||
#endif
|
|
||||||
#ifndef INT32_MIN
|
|
||||||
#define INT32_MIN (-2147483647-1)
|
|
||||||
#endif
|
|
||||||
#endif /* (SIZEOF_INT == 2) || ... */
|
|
||||||
|
|
||||||
#if (SIZEOF_LONG == 4)
|
|
||||||
#ifndef HAVE_INT32_T
|
|
||||||
typedef signed long int32_t;
|
|
||||||
#define HAVE_INT32_T
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT32_T
|
|
||||||
typedef unsigned long uint32_t;
|
|
||||||
#define HAVE_UINT32_T
|
|
||||||
#ifndef UINT32_MAX
|
|
||||||
#define UINT32_MAX 0xfffffffful
|
|
||||||
#endif
|
|
||||||
#endif /* !defined(HAVE_UINT32_T) */
|
|
||||||
#elif (SIZEOF_LONG == 8)
|
|
||||||
#ifndef HAVE_INT64_T
|
|
||||||
typedef signed long int64_t;
|
|
||||||
#define HAVE_INT64_T
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT32_T
|
|
||||||
typedef unsigned long uint64_t;
|
|
||||||
#define HAVE_UINT32_T
|
|
||||||
#endif
|
|
||||||
#ifndef UINT64_MAX
|
|
||||||
#define UINT64_MAX 0xfffffffffffffffful
|
|
||||||
#endif
|
|
||||||
#endif /* (SIZEOF_LONG == 4) || ... */
|
|
||||||
|
|
||||||
#if (SIZEOF_LONG_LONG == 8)
|
|
||||||
#ifndef HAVE_INT64_T
|
|
||||||
typedef signed long long int64_t;
|
|
||||||
#define HAVE_INT64_T
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT64_T
|
|
||||||
typedef unsigned long long uint64_t;
|
|
||||||
#define HAVE_UINT64_T
|
|
||||||
#endif
|
|
||||||
#ifndef UINT64_MAX
|
|
||||||
#define UINT64_MAX 0xffffffffffffffffull
|
|
||||||
#endif
|
|
||||||
#ifndef INT64_MAX
|
|
||||||
#define INT64_MAX 0x7fffffffffffffffll
|
|
||||||
#endif
|
|
||||||
#endif /* (SIZEOF_LONG_LONG == 8) */
|
|
||||||
|
|
||||||
#if (SIZEOF___INT64 == 8)
|
|
||||||
#ifndef HAVE_INT64_T
|
|
||||||
typedef signed __int64 int64_t;
|
|
||||||
#define HAVE_INT64_T
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT64_T
|
|
||||||
typedef unsigned __int64 uint64_t;
|
|
||||||
#define HAVE_UINT64_T
|
|
||||||
#endif
|
|
||||||
#ifndef UINT64_MAX
|
|
||||||
#define UINT64_MAX 0xffffffffffffffffui64
|
|
||||||
#endif
|
|
||||||
#ifndef INT64_MAX
|
|
||||||
#define INT64_MAX 0x7fffffffffffffffi64
|
|
||||||
#endif
|
|
||||||
#endif /* (SIZEOF___INT64 == 8) */
|
|
||||||
|
|
||||||
#ifndef INT64_MIN
|
|
||||||
#define INT64_MIN ((- INT64_MAX) - 1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SIZE_MAX
|
#ifndef SIZE_MAX
|
||||||
#if SIZEOF_SIZE_T == 8
|
#if SIZEOF_SIZE_T == 8
|
||||||
@ -223,100 +50,12 @@ typedef int32_t ssize_t;
|
|||||||
#endif /* SIZEOF_SIZE_T == 8 || ... */
|
#endif /* SIZEOF_SIZE_T == 8 || ... */
|
||||||
#endif /* !defined(HAVE_SSIZE_T) */
|
#endif /* !defined(HAVE_SSIZE_T) */
|
||||||
|
|
||||||
#if (SIZEOF_VOID_P > 4 && SIZEOF_VOID_P <= 8)
|
|
||||||
#ifndef HAVE_INTPTR_T
|
|
||||||
typedef int64_t intptr_t;
|
|
||||||
#define SIZEOF_INTPTR_T 8
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINTPTR_T
|
|
||||||
typedef uint64_t uintptr_t;
|
|
||||||
#define SIZEOF_UINTPTR_T 8
|
|
||||||
#endif
|
|
||||||
#elif (SIZEOF_VOID_P > 2 && SIZEOF_VOID_P <= 4)
|
|
||||||
#ifndef HAVE_INTPTR_T
|
|
||||||
typedef int32_t intptr_t;
|
|
||||||
#define SIZEOF_INTPTR_T 4
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINTPTR_T
|
|
||||||
typedef uint32_t uintptr_t;
|
|
||||||
#define SIZEOF_UINTPTR_T 4
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#error "void * is either >8 bytes or <= 2. In either case, I am confused."
|
|
||||||
#endif /* (SIZEOF_VOID_P > 4 && SIZEOF_VOID_P <= 8) || ... */
|
|
||||||
|
|
||||||
#ifndef HAVE_INT8_T
|
|
||||||
#error "Missing type int8_t"
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT8_T
|
|
||||||
#error "Missing type uint8_t"
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_INT16_T
|
|
||||||
#error "Missing type int16_t"
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT16_T
|
|
||||||
#error "Missing type uint16_t"
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_INT32_T
|
|
||||||
#error "Missing type int32_t"
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT32_T
|
|
||||||
#error "Missing type uint32_t"
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_INT64_T
|
|
||||||
#error "Missing type int64_t"
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_UINT64_T
|
|
||||||
#error "Missing type uint64_t"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This assumes a sane (2's-complement) representation. But if you
|
/* This assumes a sane (2's-complement) representation. But if you
|
||||||
* aren't 2's complement, and you don't define LONG_MAX, then you're so
|
* aren't 2's complement, and you don't define LONG_MAX, then you're so
|
||||||
* bizarre that I want nothing to do with you. */
|
* bizarre that I want nothing to do with you. */
|
||||||
#ifndef USING_TWOS_COMPLEMENT
|
#ifndef USING_TWOS_COMPLEMENT
|
||||||
#error "Seems that your platform doesn't use 2's complement arithmetic. Argh."
|
#error "Seems that your platform doesn't use 2's complement arithmetic. Argh."
|
||||||
#endif
|
#endif
|
||||||
#ifndef LONG_MAX
|
|
||||||
#if (SIZEOF_LONG == 4)
|
|
||||||
#define LONG_MAX 0x7fffffffL
|
|
||||||
#elif (SIZEOF_LONG == 8)
|
|
||||||
#define LONG_MAX 0x7fffffffffffffffL
|
|
||||||
#else
|
|
||||||
#error "Can't define LONG_MAX"
|
|
||||||
#endif /* (SIZEOF_LONG == 4) || ... */
|
|
||||||
#endif /* !defined(LONG_MAX) */
|
|
||||||
|
|
||||||
#ifndef INT_MAX
|
|
||||||
#if (SIZEOF_INT == 4)
|
|
||||||
#define INT_MAX 0x7fffffffL
|
|
||||||
#elif (SIZEOF_INT == 8)
|
|
||||||
#define INT_MAX 0x7fffffffffffffffL
|
|
||||||
#else
|
|
||||||
#error "Can't define INT_MAX"
|
|
||||||
#endif /* (SIZEOF_INT == 4) || ... */
|
|
||||||
#endif /* !defined(INT_MAX) */
|
|
||||||
|
|
||||||
#ifndef UINT_MAX
|
|
||||||
#if (SIZEOF_INT == 2)
|
|
||||||
#define UINT_MAX 0xffffu
|
|
||||||
#elif (SIZEOF_INT == 4)
|
|
||||||
#define UINT_MAX 0xffffffffu
|
|
||||||
#elif (SIZEOF_INT == 8)
|
|
||||||
#define UINT_MAX 0xffffffffffffffffu
|
|
||||||
#else
|
|
||||||
#error "Can't define UINT_MAX"
|
|
||||||
#endif /* (SIZEOF_INT == 2) || ... */
|
|
||||||
#endif /* !defined(UINT_MAX) */
|
|
||||||
|
|
||||||
#ifndef SHORT_MAX
|
|
||||||
#if (SIZEOF_SHORT == 2)
|
|
||||||
#define SHORT_MAX 0x7fff
|
|
||||||
#elif (SIZEOF_SHORT == 4)
|
|
||||||
#define SHORT_MAX 0x7fffffff
|
|
||||||
#else
|
|
||||||
#error "Can't define SHORT_MAX"
|
|
||||||
#endif /* (SIZEOF_SHORT == 2) || ... */
|
|
||||||
#endif /* !defined(SHORT_MAX) */
|
|
||||||
|
|
||||||
#ifndef TIME_MAX
|
#ifndef TIME_MAX
|
||||||
|
|
||||||
|
@ -16,27 +16,27 @@ int
|
|||||||
tor_log2(uint64_t u64)
|
tor_log2(uint64_t u64)
|
||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
if (u64 >= (U64_LITERAL(1)<<32)) {
|
if (u64 >= (UINT64_C(1)<<32)) {
|
||||||
u64 >>= 32;
|
u64 >>= 32;
|
||||||
r = 32;
|
r = 32;
|
||||||
}
|
}
|
||||||
if (u64 >= (U64_LITERAL(1)<<16)) {
|
if (u64 >= (UINT64_C(1)<<16)) {
|
||||||
u64 >>= 16;
|
u64 >>= 16;
|
||||||
r += 16;
|
r += 16;
|
||||||
}
|
}
|
||||||
if (u64 >= (U64_LITERAL(1)<<8)) {
|
if (u64 >= (UINT64_C(1)<<8)) {
|
||||||
u64 >>= 8;
|
u64 >>= 8;
|
||||||
r += 8;
|
r += 8;
|
||||||
}
|
}
|
||||||
if (u64 >= (U64_LITERAL(1)<<4)) {
|
if (u64 >= (UINT64_C(1)<<4)) {
|
||||||
u64 >>= 4;
|
u64 >>= 4;
|
||||||
r += 4;
|
r += 4;
|
||||||
}
|
}
|
||||||
if (u64 >= (U64_LITERAL(1)<<2)) {
|
if (u64 >= (UINT64_C(1)<<2)) {
|
||||||
u64 >>= 2;
|
u64 >>= 2;
|
||||||
r += 2;
|
r += 2;
|
||||||
}
|
}
|
||||||
if (u64 >= (U64_LITERAL(1)<<1)) {
|
if (u64 >= (UINT64_C(1)<<1)) {
|
||||||
// u64 >>= 1; // not using this any more.
|
// u64 >>= 1; // not using this any more.
|
||||||
r += 1;
|
r += 1;
|
||||||
}
|
}
|
||||||
@ -55,12 +55,12 @@ round_to_power_of_2(uint64_t u64)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
lg2 = tor_log2(u64);
|
lg2 = tor_log2(u64);
|
||||||
low = U64_LITERAL(1) << lg2;
|
low = UINT64_C(1) << lg2;
|
||||||
|
|
||||||
if (lg2 == 63)
|
if (lg2 == 63)
|
||||||
return low;
|
return low;
|
||||||
|
|
||||||
high = U64_LITERAL(1) << (lg2+1);
|
high = UINT64_C(1) << (lg2+1);
|
||||||
if (high - u64 < u64 - low)
|
if (high - u64 < u64 - low)
|
||||||
return high;
|
return high;
|
||||||
else
|
else
|
||||||
|
@ -23,7 +23,7 @@ typedef int socklen_t;
|
|||||||
* any inadvertent checks for the socket being <= 0 or > 0 will probably
|
* any inadvertent checks for the socket being <= 0 or > 0 will probably
|
||||||
* still work. */
|
* still work. */
|
||||||
#define tor_socket_t intptr_t
|
#define tor_socket_t intptr_t
|
||||||
#define TOR_SOCKET_T_FORMAT INTPTR_T_FORMAT
|
#define TOR_SOCKET_T_FORMAT "%"PRIuPTR
|
||||||
#define SOCKET_OK(s) ((SOCKET)(s) != INVALID_SOCKET)
|
#define SOCKET_OK(s) ((SOCKET)(s) != INVALID_SOCKET)
|
||||||
#define TOR_INVALID_SOCKET INVALID_SOCKET
|
#define TOR_INVALID_SOCKET INVALID_SOCKET
|
||||||
#else /* !(defined(_WIN32)) */
|
#else /* !(defined(_WIN32)) */
|
||||||
|
@ -51,15 +51,15 @@ tv_udiff(const struct timeval *start, const struct timeval *end)
|
|||||||
/* Sanity check tv_usec */
|
/* Sanity check tv_usec */
|
||||||
if (start->tv_usec > TOR_USEC_PER_SEC || start->tv_usec < 0) {
|
if (start->tv_usec > TOR_USEC_PER_SEC || start->tv_usec < 0) {
|
||||||
log_warn(LD_GENERAL, "comparing times on microsecond detail with bad "
|
log_warn(LD_GENERAL, "comparing times on microsecond detail with bad "
|
||||||
"start tv_usec: " I64_FORMAT " microseconds",
|
"start tv_usec: %"PRId64 " microseconds",
|
||||||
I64_PRINTF_ARG(start->tv_usec));
|
(int64_t)start->tv_usec);
|
||||||
return LONG_MAX;
|
return LONG_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end->tv_usec > TOR_USEC_PER_SEC || end->tv_usec < 0) {
|
if (end->tv_usec > TOR_USEC_PER_SEC || end->tv_usec < 0) {
|
||||||
log_warn(LD_GENERAL, "comparing times on microsecond detail with bad "
|
log_warn(LD_GENERAL, "comparing times on microsecond detail with bad "
|
||||||
"end tv_usec: " I64_FORMAT " microseconds",
|
"end tv_usec: %"PRId64 " microseconds",
|
||||||
I64_PRINTF_ARG(end->tv_usec));
|
(int64_t)end->tv_usec);
|
||||||
return LONG_MAX;
|
return LONG_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ tv_udiff(const struct timeval *start, const struct timeval *end)
|
|||||||
if (secdiff > (int64_t)(LONG_MAX/1000000 - 1) ||
|
if (secdiff > (int64_t)(LONG_MAX/1000000 - 1) ||
|
||||||
secdiff < (int64_t)(LONG_MIN/1000000 + 1)) {
|
secdiff < (int64_t)(LONG_MIN/1000000 + 1)) {
|
||||||
log_warn(LD_GENERAL, "comparing times on microsecond detail too far "
|
log_warn(LD_GENERAL, "comparing times on microsecond detail too far "
|
||||||
"apart: " I64_FORMAT " seconds", I64_PRINTF_ARG(secdiff));
|
"apart: %"PRId64 " seconds", (secdiff));
|
||||||
return LONG_MAX;
|
return LONG_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,15 +100,15 @@ tv_mdiff(const struct timeval *start, const struct timeval *end)
|
|||||||
/* Sanity check tv_usec */
|
/* Sanity check tv_usec */
|
||||||
if (start->tv_usec > TOR_USEC_PER_SEC || start->tv_usec < 0) {
|
if (start->tv_usec > TOR_USEC_PER_SEC || start->tv_usec < 0) {
|
||||||
log_warn(LD_GENERAL, "comparing times on millisecond detail with bad "
|
log_warn(LD_GENERAL, "comparing times on millisecond detail with bad "
|
||||||
"start tv_usec: " I64_FORMAT " microseconds",
|
"start tv_usec: %"PRId64 " microseconds",
|
||||||
I64_PRINTF_ARG(start->tv_usec));
|
(int64_t)start->tv_usec);
|
||||||
return LONG_MAX;
|
return LONG_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end->tv_usec > TOR_USEC_PER_SEC || end->tv_usec < 0) {
|
if (end->tv_usec > TOR_USEC_PER_SEC || end->tv_usec < 0) {
|
||||||
log_warn(LD_GENERAL, "comparing times on millisecond detail with bad "
|
log_warn(LD_GENERAL, "comparing times on millisecond detail with bad "
|
||||||
"end tv_usec: " I64_FORMAT " microseconds",
|
"end tv_usec: %"PRId64 " microseconds",
|
||||||
I64_PRINTF_ARG(end->tv_usec));
|
(int64_t)end->tv_usec);
|
||||||
return LONG_MAX;
|
return LONG_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ tv_mdiff(const struct timeval *start, const struct timeval *end)
|
|||||||
if (secdiff > (int64_t)(LONG_MAX/1000 - 2) ||
|
if (secdiff > (int64_t)(LONG_MAX/1000 - 2) ||
|
||||||
secdiff < (int64_t)(LONG_MIN/1000 + 1)) {
|
secdiff < (int64_t)(LONG_MIN/1000 + 1)) {
|
||||||
log_warn(LD_GENERAL, "comparing times on millisecond detail too far "
|
log_warn(LD_GENERAL, "comparing times on millisecond detail too far "
|
||||||
"apart: " I64_FORMAT " seconds", I64_PRINTF_ARG(secdiff));
|
"apart: %"PRId64 " seconds", (int64_t)secdiff);
|
||||||
return LONG_MAX;
|
return LONG_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2442,8 +2442,8 @@ tls_get_write_overhead_ratio,(void))
|
|||||||
if (total_bytes_written_over_tls == 0)
|
if (total_bytes_written_over_tls == 0)
|
||||||
return 1.0;
|
return 1.0;
|
||||||
|
|
||||||
return U64_TO_DBL(total_bytes_written_by_tls) /
|
return ((double)total_bytes_written_by_tls) /
|
||||||
U64_TO_DBL(total_bytes_written_over_tls);
|
((double)total_bytes_written_over_tls);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implement check_no_tls_errors: If there are any pending OpenSSL
|
/** Implement check_no_tls_errors: If there are any pending OpenSSL
|
||||||
|
@ -100,9 +100,9 @@ correct_tm(int islocal, const time_t *timep, struct tm *resultbuf,
|
|||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
done:
|
done:
|
||||||
if (err_out) {
|
if (err_out) {
|
||||||
tor_asprintf(err_out, "%s("I64_FORMAT") failed with error %s: %s",
|
tor_asprintf(err_out, "%s(%"PRId64") failed with error %s: %s",
|
||||||
islocal?"localtime":"gmtime",
|
islocal?"localtime":"gmtime",
|
||||||
timep?I64_PRINTF_ARG(*timep):0,
|
timep?((int64_t)*timep):0,
|
||||||
strerror(errno),
|
strerror(errno),
|
||||||
outcome);
|
outcome);
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,10 @@ tor_gettimeofday, (struct timeval *timeval))
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* Epoch bias copied from perl: number of units between windows epoch and
|
/* Epoch bias copied from perl: number of units between windows epoch and
|
||||||
* Unix epoch. */
|
* Unix epoch. */
|
||||||
#define EPOCH_BIAS U64_LITERAL(116444736000000000)
|
#define EPOCH_BIAS UINT64_C(116444736000000000)
|
||||||
#define UNITS_PER_SEC U64_LITERAL(10000000)
|
#define UNITS_PER_SEC UINT64_C(10000000)
|
||||||
#define USEC_PER_SEC U64_LITERAL(1000000)
|
#define USEC_PER_SEC UINT64_C(1000000)
|
||||||
#define UNITS_PER_USEC U64_LITERAL(10)
|
#define UNITS_PER_USEC UINT64_C(10)
|
||||||
union {
|
union {
|
||||||
uint64_t ft_64;
|
uint64_t ft_64;
|
||||||
FILETIME ft_ft;
|
FILETIME ft_ft;
|
||||||
|
@ -643,7 +643,7 @@ client_dns_incr_failures(const char *address)
|
|||||||
ent->expires = time(NULL) + MAX_DNS_ENTRY_AGE;
|
ent->expires = time(NULL) + MAX_DNS_ENTRY_AGE;
|
||||||
strmap_set(addressmap,address,ent);
|
strmap_set(addressmap,address,ent);
|
||||||
}
|
}
|
||||||
if (ent->num_resolve_failures < SHORT_MAX)
|
if (ent->num_resolve_failures < SHRT_MAX)
|
||||||
++ent->num_resolve_failures; /* don't overflow */
|
++ent->num_resolve_failures; /* don't overflow */
|
||||||
log_info(LD_APP, "Address %s now has %d resolve failures.",
|
log_info(LD_APP, "Address %s now has %d resolve failures.",
|
||||||
safe_str_client(address),
|
safe_str_client(address),
|
||||||
|
290
src/or/channel.c
290
src/or/channel.c
@ -391,9 +391,9 @@ channel_register(channel_t *chan)
|
|||||||
if (chan->registered) return;
|
if (chan->registered) return;
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Registering channel %p (ID " U64_FORMAT ") "
|
"Registering channel %p (ID %"PRIu64 ") "
|
||||||
"in state %s (%d) with digest %s",
|
"in state %s (%d) with digest %s",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier),
|
chan, (chan->global_identifier),
|
||||||
channel_state_to_string(chan->state), chan->state,
|
channel_state_to_string(chan->state), chan->state,
|
||||||
hex_str(chan->identity_digest, DIGEST_LEN));
|
hex_str(chan->identity_digest, DIGEST_LEN));
|
||||||
|
|
||||||
@ -421,9 +421,9 @@ channel_register(channel_t *chan)
|
|||||||
channel_add_to_digest_map(chan);
|
channel_add_to_digest_map(chan);
|
||||||
} else {
|
} else {
|
||||||
log_info(LD_CHANNEL,
|
log_info(LD_CHANNEL,
|
||||||
"Channel %p (global ID " U64_FORMAT ") "
|
"Channel %p (global ID %"PRIu64 ") "
|
||||||
"in state %s (%d) registered with no identity digest",
|
"in state %s (%d) registered with no identity digest",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier),
|
chan, (chan->global_identifier),
|
||||||
channel_state_to_string(chan->state), chan->state);
|
channel_state_to_string(chan->state), chan->state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -487,9 +487,9 @@ channel_listener_register(channel_listener_t *chan_l)
|
|||||||
if (chan_l->registered) return;
|
if (chan_l->registered) return;
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Registering channel listener %p (ID " U64_FORMAT ") "
|
"Registering channel listener %p (ID %"PRIu64 ") "
|
||||||
"in state %s (%d)",
|
"in state %s (%d)",
|
||||||
chan_l, U64_PRINTF_ARG(chan_l->global_identifier),
|
chan_l, (chan_l->global_identifier),
|
||||||
channel_listener_state_to_string(chan_l->state),
|
channel_listener_state_to_string(chan_l->state),
|
||||||
chan_l->state);
|
chan_l->state);
|
||||||
|
|
||||||
@ -579,9 +579,9 @@ channel_add_to_digest_map(channel_t *chan)
|
|||||||
TOR_LIST_INSERT_HEAD(&ent->channel_list, chan, next_with_same_id);
|
TOR_LIST_INSERT_HEAD(&ent->channel_list, chan, next_with_same_id);
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Added channel %p (global ID " U64_FORMAT ") "
|
"Added channel %p (global ID %"PRIu64 ") "
|
||||||
"to identity map in state %s (%d) with digest %s",
|
"to identity map in state %s (%d) with digest %s",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier),
|
chan, (chan->global_identifier),
|
||||||
channel_state_to_string(chan->state), chan->state,
|
channel_state_to_string(chan->state), chan->state,
|
||||||
hex_str(chan->identity_digest, DIGEST_LEN));
|
hex_str(chan->identity_digest, DIGEST_LEN));
|
||||||
}
|
}
|
||||||
@ -618,18 +618,18 @@ channel_remove_from_digest_map(channel_t *chan)
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Removed channel %p (global ID " U64_FORMAT ") from "
|
"Removed channel %p (global ID %"PRIu64 ") from "
|
||||||
"identity map in state %s (%d) with digest %s",
|
"identity map in state %s (%d) with digest %s",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier),
|
chan, (chan->global_identifier),
|
||||||
channel_state_to_string(chan->state), chan->state,
|
channel_state_to_string(chan->state), chan->state,
|
||||||
hex_str(chan->identity_digest, DIGEST_LEN));
|
hex_str(chan->identity_digest, DIGEST_LEN));
|
||||||
} else {
|
} else {
|
||||||
/* Shouldn't happen */
|
/* Shouldn't happen */
|
||||||
log_warn(LD_BUG,
|
log_warn(LD_BUG,
|
||||||
"Trying to remove channel %p (global ID " U64_FORMAT ") with "
|
"Trying to remove channel %p (global ID %"PRIu64 ") with "
|
||||||
"digest %s from identity map, but couldn't find any with "
|
"digest %s from identity map, but couldn't find any with "
|
||||||
"that digest",
|
"that digest",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier),
|
chan, (chan->global_identifier),
|
||||||
hex_str(chan->identity_digest, DIGEST_LEN));
|
hex_str(chan->identity_digest, DIGEST_LEN));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -883,8 +883,8 @@ channel_free_(channel_t *chan)
|
|||||||
tor_assert(!(chan->registered));
|
tor_assert(!(chan->registered));
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Freeing channel " U64_FORMAT " at %p",
|
"Freeing channel %"PRIu64 " at %p",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan);
|
(chan->global_identifier), chan);
|
||||||
|
|
||||||
/* Get this one out of the scheduler */
|
/* Get this one out of the scheduler */
|
||||||
scheduler_release_channel(chan);
|
scheduler_release_channel(chan);
|
||||||
@ -929,8 +929,8 @@ channel_listener_free_(channel_listener_t *chan_l)
|
|||||||
if (!chan_l) return;
|
if (!chan_l) return;
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Freeing channel_listener_t " U64_FORMAT " at %p",
|
"Freeing channel_listener_t %"PRIu64 " at %p",
|
||||||
U64_PRINTF_ARG(chan_l->global_identifier),
|
(chan_l->global_identifier),
|
||||||
chan_l);
|
chan_l);
|
||||||
|
|
||||||
/* It must be closed or errored */
|
/* It must be closed or errored */
|
||||||
@ -956,8 +956,8 @@ channel_force_xfree(channel_t *chan)
|
|||||||
tor_assert(chan);
|
tor_assert(chan);
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Force-freeing channel " U64_FORMAT " at %p",
|
"Force-freeing channel %"PRIu64 " at %p",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan);
|
(chan->global_identifier), chan);
|
||||||
|
|
||||||
/* Get this one out of the scheduler */
|
/* Get this one out of the scheduler */
|
||||||
scheduler_release_channel(chan);
|
scheduler_release_channel(chan);
|
||||||
@ -1000,8 +1000,8 @@ channel_listener_force_xfree(channel_listener_t *chan_l)
|
|||||||
tor_assert(chan_l);
|
tor_assert(chan_l);
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Force-freeing channel_listener_t " U64_FORMAT " at %p",
|
"Force-freeing channel_listener_t %"PRIu64 " at %p",
|
||||||
U64_PRINTF_ARG(chan_l->global_identifier),
|
(chan_l->global_identifier),
|
||||||
chan_l);
|
chan_l);
|
||||||
|
|
||||||
/* Call a free method if there is one */
|
/* Call a free method if there is one */
|
||||||
@ -1040,8 +1040,8 @@ channel_listener_set_listener_fn(channel_listener_t *chan_l,
|
|||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Setting listener callback for channel listener %p "
|
"Setting listener callback for channel listener %p "
|
||||||
"(global ID " U64_FORMAT ") to %p",
|
"(global ID %"PRIu64 ") to %p",
|
||||||
chan_l, U64_PRINTF_ARG(chan_l->global_identifier),
|
chan_l, (chan_l->global_identifier),
|
||||||
listener);
|
listener);
|
||||||
|
|
||||||
chan_l->listener = listener;
|
chan_l->listener = listener;
|
||||||
@ -1140,9 +1140,9 @@ channel_mark_for_close(channel_t *chan)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Closing channel %p (global ID " U64_FORMAT ") "
|
"Closing channel %p (global ID %"PRIu64 ") "
|
||||||
"by request",
|
"by request",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier));
|
chan, (chan->global_identifier));
|
||||||
|
|
||||||
/* Note closing by request from above */
|
/* Note closing by request from above */
|
||||||
chan->reason_for_closing = CHANNEL_CLOSE_REQUESTED;
|
chan->reason_for_closing = CHANNEL_CLOSE_REQUESTED;
|
||||||
@ -1180,9 +1180,9 @@ channel_listener_mark_for_close(channel_listener_t *chan_l)
|
|||||||
chan_l->state == CHANNEL_LISTENER_STATE_ERROR) return;
|
chan_l->state == CHANNEL_LISTENER_STATE_ERROR) return;
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Closing channel listener %p (global ID " U64_FORMAT ") "
|
"Closing channel listener %p (global ID %"PRIu64 ") "
|
||||||
"by request",
|
"by request",
|
||||||
chan_l, U64_PRINTF_ARG(chan_l->global_identifier));
|
chan_l, (chan_l->global_identifier));
|
||||||
|
|
||||||
/* Note closing by request from above */
|
/* Note closing by request from above */
|
||||||
chan_l->reason_for_closing = CHANNEL_LISTENER_CLOSE_REQUESTED;
|
chan_l->reason_for_closing = CHANNEL_LISTENER_CLOSE_REQUESTED;
|
||||||
@ -1218,9 +1218,9 @@ channel_close_from_lower_layer(channel_t *chan)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Closing channel %p (global ID " U64_FORMAT ") "
|
"Closing channel %p (global ID %"PRIu64 ") "
|
||||||
"due to lower-layer event",
|
"due to lower-layer event",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier));
|
chan, (chan->global_identifier));
|
||||||
|
|
||||||
/* Note closing by event from below */
|
/* Note closing by event from below */
|
||||||
chan->reason_for_closing = CHANNEL_CLOSE_FROM_BELOW;
|
chan->reason_for_closing = CHANNEL_CLOSE_FROM_BELOW;
|
||||||
@ -1303,8 +1303,8 @@ channel_clear_identity_digest(channel_t *chan)
|
|||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Clearing remote endpoint digest on channel %p with "
|
"Clearing remote endpoint digest on channel %p with "
|
||||||
"global ID " U64_FORMAT,
|
"global ID %"PRIu64,
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier));
|
chan, (chan->global_identifier));
|
||||||
|
|
||||||
state_not_in_map = CHANNEL_CONDEMNED(chan);
|
state_not_in_map = CHANNEL_CONDEMNED(chan);
|
||||||
|
|
||||||
@ -1334,8 +1334,8 @@ channel_set_identity_digest(channel_t *chan,
|
|||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Setting remote endpoint digest on channel %p with "
|
"Setting remote endpoint digest on channel %p with "
|
||||||
"global ID " U64_FORMAT " to digest %s",
|
"global ID %"PRIu64 " to digest %s",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier),
|
chan, (chan->global_identifier),
|
||||||
identity_digest ?
|
identity_digest ?
|
||||||
hex_str(identity_digest, DIGEST_LEN) : "(null)");
|
hex_str(identity_digest, DIGEST_LEN) : "(null)");
|
||||||
|
|
||||||
@ -1391,8 +1391,8 @@ channel_clear_remote_end(channel_t *chan)
|
|||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Clearing remote endpoint identity on channel %p with "
|
"Clearing remote endpoint identity on channel %p with "
|
||||||
"global ID " U64_FORMAT,
|
"global ID %"PRIu64,
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier));
|
chan, (chan->global_identifier));
|
||||||
|
|
||||||
state_not_in_map = CHANNEL_CONDEMNED(chan);
|
state_not_in_map = CHANNEL_CONDEMNED(chan);
|
||||||
|
|
||||||
@ -1475,13 +1475,13 @@ channel_write_packed_cell(channel_t *chan, packed_cell_t *cell)
|
|||||||
|
|
||||||
if (CHANNEL_IS_CLOSING(chan)) {
|
if (CHANNEL_IS_CLOSING(chan)) {
|
||||||
log_debug(LD_CHANNEL, "Discarding %p on closing channel %p with "
|
log_debug(LD_CHANNEL, "Discarding %p on closing channel %p with "
|
||||||
"global ID "U64_FORMAT, cell, chan,
|
"global ID %"PRIu64, cell, chan,
|
||||||
U64_PRINTF_ARG(chan->global_identifier));
|
(chan->global_identifier));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Writing %p to channel %p with global ID "
|
"Writing %p to channel %p with global ID "
|
||||||
U64_FORMAT, cell, chan, U64_PRINTF_ARG(chan->global_identifier));
|
"%"PRIu64, cell, chan, (chan->global_identifier));
|
||||||
|
|
||||||
ret = write_packed_cell(chan, cell);
|
ret = write_packed_cell(chan, cell);
|
||||||
|
|
||||||
@ -1518,9 +1518,9 @@ channel_change_state_(channel_t *chan, channel_state_t to_state)
|
|||||||
if (from_state == to_state) {
|
if (from_state == to_state) {
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Got no-op transition from \"%s\" to itself on channel %p"
|
"Got no-op transition from \"%s\" to itself on channel %p"
|
||||||
"(global ID " U64_FORMAT ")",
|
"(global ID %"PRIu64 ")",
|
||||||
channel_state_to_string(to_state),
|
channel_state_to_string(to_state),
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier));
|
chan, (chan->global_identifier));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1532,10 +1532,10 @@ channel_change_state_(channel_t *chan, channel_state_t to_state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Changing state of channel %p (global ID " U64_FORMAT
|
"Changing state of channel %p (global ID %"PRIu64
|
||||||
") from \"%s\" to \"%s\"",
|
") from \"%s\" to \"%s\"",
|
||||||
chan,
|
chan,
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
channel_state_to_string(chan->state),
|
channel_state_to_string(chan->state),
|
||||||
channel_state_to_string(to_state));
|
channel_state_to_string(to_state));
|
||||||
|
|
||||||
@ -1638,9 +1638,9 @@ channel_listener_change_state(channel_listener_t *chan_l,
|
|||||||
if (from_state == to_state) {
|
if (from_state == to_state) {
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Got no-op transition from \"%s\" to itself on channel "
|
"Got no-op transition from \"%s\" to itself on channel "
|
||||||
"listener %p (global ID " U64_FORMAT ")",
|
"listener %p (global ID %"PRIu64 ")",
|
||||||
channel_listener_state_to_string(to_state),
|
channel_listener_state_to_string(to_state),
|
||||||
chan_l, U64_PRINTF_ARG(chan_l->global_identifier));
|
chan_l, (chan_l->global_identifier));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1652,9 +1652,9 @@ channel_listener_change_state(channel_listener_t *chan_l,
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Changing state of channel listener %p (global ID " U64_FORMAT
|
"Changing state of channel listener %p (global ID %"PRIu64
|
||||||
"from \"%s\" to \"%s\"",
|
"from \"%s\" to \"%s\"",
|
||||||
chan_l, U64_PRINTF_ARG(chan_l->global_identifier),
|
chan_l, (chan_l->global_identifier),
|
||||||
channel_listener_state_to_string(chan_l->state),
|
channel_listener_state_to_string(chan_l->state),
|
||||||
channel_listener_state_to_string(to_state));
|
channel_listener_state_to_string(to_state));
|
||||||
|
|
||||||
@ -1803,8 +1803,8 @@ channel_listener_process_incoming(channel_listener_t *listener)
|
|||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Processing queue of incoming connections for channel "
|
"Processing queue of incoming connections for channel "
|
||||||
"listener %p (global ID " U64_FORMAT ")",
|
"listener %p (global ID %"PRIu64 ")",
|
||||||
listener, U64_PRINTF_ARG(listener->global_identifier));
|
listener, (listener->global_identifier));
|
||||||
|
|
||||||
if (!(listener->incoming_list)) return;
|
if (!(listener->incoming_list)) return;
|
||||||
|
|
||||||
@ -1813,12 +1813,12 @@ channel_listener_process_incoming(channel_listener_t *listener)
|
|||||||
tor_assert(chan);
|
tor_assert(chan);
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Handling incoming channel %p (" U64_FORMAT ") "
|
"Handling incoming channel %p (%"PRIu64 ") "
|
||||||
"for listener %p (" U64_FORMAT ")",
|
"for listener %p (%"PRIu64 ")",
|
||||||
chan,
|
chan,
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
listener,
|
listener,
|
||||||
U64_PRINTF_ARG(listener->global_identifier));
|
(listener->global_identifier));
|
||||||
/* Make sure this is set correctly */
|
/* Make sure this is set correctly */
|
||||||
channel_mark_incoming(chan);
|
channel_mark_incoming(chan);
|
||||||
listener->listener(listener, chan);
|
listener->listener(listener, chan);
|
||||||
@ -1924,10 +1924,10 @@ channel_listener_queue_incoming(channel_listener_t *listener,
|
|||||||
tor_assert(incoming);
|
tor_assert(incoming);
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Queueing incoming channel %p (global ID " U64_FORMAT ") on "
|
"Queueing incoming channel %p (global ID %"PRIu64 ") on "
|
||||||
"channel listener %p (global ID " U64_FORMAT ")",
|
"channel listener %p (global ID %"PRIu64 ")",
|
||||||
incoming, U64_PRINTF_ARG(incoming->global_identifier),
|
incoming, (incoming->global_identifier),
|
||||||
listener, U64_PRINTF_ARG(listener->global_identifier));
|
listener, (listener->global_identifier));
|
||||||
|
|
||||||
/* Do we need to queue it, or can we just call the listener right away? */
|
/* Do we need to queue it, or can we just call the listener right away? */
|
||||||
if (!(listener->listener)) need_to_queue = 1;
|
if (!(listener->listener)) need_to_queue = 1;
|
||||||
@ -1984,8 +1984,8 @@ channel_process_cell(channel_t *chan, cell_t *cell)
|
|||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Processing incoming cell_t %p for channel %p (global ID "
|
"Processing incoming cell_t %p for channel %p (global ID "
|
||||||
U64_FORMAT ")", cell, chan,
|
"%"PRIu64 ")", cell, chan,
|
||||||
U64_PRINTF_ARG(chan->global_identifier));
|
(chan->global_identifier));
|
||||||
chan->cell_handler(chan, cell);
|
chan->cell_handler(chan, cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2025,8 +2025,8 @@ channel_send_destroy(circid_t circ_id, channel_t *chan, int reason)
|
|||||||
tor_assert(chan);
|
tor_assert(chan);
|
||||||
if (circ_id == 0) {
|
if (circ_id == 0) {
|
||||||
log_warn(LD_BUG, "Attempted to send a destroy cell for circID 0 "
|
log_warn(LD_BUG, "Attempted to send a destroy cell for circID 0 "
|
||||||
"on a channel " U64_FORMAT " at %p in state %s (%d)",
|
"on a channel %"PRIu64 " at %p in state %s (%d)",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
chan, channel_state_to_string(chan->state),
|
chan, channel_state_to_string(chan->state),
|
||||||
chan->state);
|
chan->state);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2038,14 +2038,14 @@ channel_send_destroy(circid_t circ_id, channel_t *chan, int reason)
|
|||||||
circuitmux_append_destroy_cell(chan, chan->cmux, circ_id, reason);
|
circuitmux_append_destroy_cell(chan, chan->cmux, circ_id, reason);
|
||||||
log_debug(LD_OR,
|
log_debug(LD_OR,
|
||||||
"Sending destroy (circID %u) on channel %p "
|
"Sending destroy (circID %u) on channel %p "
|
||||||
"(global ID " U64_FORMAT ")",
|
"(global ID %"PRIu64 ")",
|
||||||
(unsigned)circ_id, chan,
|
(unsigned)circ_id, chan,
|
||||||
U64_PRINTF_ARG(chan->global_identifier));
|
(chan->global_identifier));
|
||||||
} else {
|
} else {
|
||||||
log_warn(LD_BUG,
|
log_warn(LD_BUG,
|
||||||
"Someone called channel_send_destroy() for circID %u "
|
"Someone called channel_send_destroy() for circID %u "
|
||||||
"on a channel " U64_FORMAT " at %p in state %s (%d)",
|
"on a channel %"PRIu64 " at %p in state %s (%d)",
|
||||||
(unsigned)circ_id, U64_PRINTF_ARG(chan->global_identifier),
|
(unsigned)circ_id, (chan->global_identifier),
|
||||||
chan, channel_state_to_string(chan->state),
|
chan, channel_state_to_string(chan->state),
|
||||||
chan->state);
|
chan->state);
|
||||||
}
|
}
|
||||||
@ -2179,9 +2179,9 @@ channel_free_list(smartlist_t *channels, int mark_for_close)
|
|||||||
/* Deregister and free it */
|
/* Deregister and free it */
|
||||||
tor_assert(curr);
|
tor_assert(curr);
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Cleaning up channel %p (global ID " U64_FORMAT ") "
|
"Cleaning up channel %p (global ID %"PRIu64 ") "
|
||||||
"in state %s (%d)",
|
"in state %s (%d)",
|
||||||
curr, U64_PRINTF_ARG(curr->global_identifier),
|
curr, (curr->global_identifier),
|
||||||
channel_state_to_string(curr->state), curr->state);
|
channel_state_to_string(curr->state), curr->state);
|
||||||
/* Detach circuits early so they can find the channel */
|
/* Detach circuits early so they can find the channel */
|
||||||
if (curr->cmux) {
|
if (curr->cmux) {
|
||||||
@ -2210,9 +2210,9 @@ channel_listener_free_list(smartlist_t *listeners, int mark_for_close)
|
|||||||
/* Deregister and free it */
|
/* Deregister and free it */
|
||||||
tor_assert(curr);
|
tor_assert(curr);
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Cleaning up channel listener %p (global ID " U64_FORMAT ") "
|
"Cleaning up channel listener %p (global ID %"PRIu64 ") "
|
||||||
"in state %s (%d)",
|
"in state %s (%d)",
|
||||||
curr, U64_PRINTF_ARG(curr->global_identifier),
|
curr, (curr->global_identifier),
|
||||||
channel_listener_state_to_string(curr->state), curr->state);
|
channel_listener_state_to_string(curr->state), curr->state);
|
||||||
channel_listener_unregister(curr);
|
channel_listener_unregister(curr);
|
||||||
if (mark_for_close) {
|
if (mark_for_close) {
|
||||||
@ -2535,33 +2535,33 @@ channel_dump_statistics, (channel_t *chan, int severity))
|
|||||||
age = (double)(now - chan->timestamp_created);
|
age = (double)(now - chan->timestamp_created);
|
||||||
|
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
"Channel " U64_FORMAT " (at %p) with transport %s is in state "
|
"Channel %"PRIu64 " (at %p) with transport %s is in state "
|
||||||
"%s (%d)",
|
"%s (%d)",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan,
|
(chan->global_identifier), chan,
|
||||||
channel_describe_transport(chan),
|
channel_describe_transport(chan),
|
||||||
channel_state_to_string(chan->state), chan->state);
|
channel_state_to_string(chan->state), chan->state);
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " was created at " U64_FORMAT
|
" * Channel %"PRIu64 " was created at %"PRIu64
|
||||||
" (" U64_FORMAT " seconds ago) "
|
" (%"PRIu64 " seconds ago) "
|
||||||
"and last active at " U64_FORMAT " (" U64_FORMAT " seconds ago)",
|
"and last active at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
U64_PRINTF_ARG(chan->timestamp_created),
|
(uint64_t)(chan->timestamp_created),
|
||||||
U64_PRINTF_ARG(now - chan->timestamp_created),
|
(uint64_t)(now - chan->timestamp_created),
|
||||||
U64_PRINTF_ARG(chan->timestamp_active),
|
(uint64_t)(chan->timestamp_active),
|
||||||
U64_PRINTF_ARG(now - chan->timestamp_active));
|
(uint64_t)(now - chan->timestamp_active));
|
||||||
|
|
||||||
/* Handle digest. */
|
/* Handle digest. */
|
||||||
if (!tor_digest_is_zero(chan->identity_digest)) {
|
if (!tor_digest_is_zero(chan->identity_digest)) {
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " says it is connected "
|
" * Channel %"PRIu64 " says it is connected "
|
||||||
"to an OR with digest %s",
|
"to an OR with digest %s",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
hex_str(chan->identity_digest, DIGEST_LEN));
|
hex_str(chan->identity_digest, DIGEST_LEN));
|
||||||
} else {
|
} else {
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " does not know the digest"
|
" * Channel %"PRIu64 " does not know the digest"
|
||||||
" of the OR it is connected to",
|
" of the OR it is connected to",
|
||||||
U64_PRINTF_ARG(chan->global_identifier));
|
(chan->global_identifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle remote address and descriptions */
|
/* Handle remote address and descriptions */
|
||||||
@ -2570,10 +2570,10 @@ channel_dump_statistics, (channel_t *chan, int severity))
|
|||||||
char *actual = tor_strdup(channel_get_actual_remote_descr(chan));
|
char *actual = tor_strdup(channel_get_actual_remote_descr(chan));
|
||||||
remote_addr_str = tor_addr_to_str_dup(&remote_addr);
|
remote_addr_str = tor_addr_to_str_dup(&remote_addr);
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " says its remote address"
|
" * Channel %"PRIu64 " says its remote address"
|
||||||
" is %s, and gives a canonical description of \"%s\" and an "
|
" is %s, and gives a canonical description of \"%s\" and an "
|
||||||
"actual description of \"%s\"",
|
"actual description of \"%s\"",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
safe_str(remote_addr_str),
|
safe_str(remote_addr_str),
|
||||||
safe_str(channel_get_canonical_remote_descr(chan)),
|
safe_str(channel_get_canonical_remote_descr(chan)),
|
||||||
safe_str(actual));
|
safe_str(actual));
|
||||||
@ -2582,10 +2582,10 @@ channel_dump_statistics, (channel_t *chan, int severity))
|
|||||||
} else {
|
} else {
|
||||||
char *actual = tor_strdup(channel_get_actual_remote_descr(chan));
|
char *actual = tor_strdup(channel_get_actual_remote_descr(chan));
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " does not know its remote "
|
" * Channel %"PRIu64 " does not know its remote "
|
||||||
"address, but gives a canonical description of \"%s\" and an "
|
"address, but gives a canonical description of \"%s\" and an "
|
||||||
"actual description of \"%s\"",
|
"actual description of \"%s\"",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
channel_get_canonical_remote_descr(chan),
|
channel_get_canonical_remote_descr(chan),
|
||||||
actual);
|
actual);
|
||||||
tor_free(actual);
|
tor_free(actual);
|
||||||
@ -2593,9 +2593,9 @@ channel_dump_statistics, (channel_t *chan, int severity))
|
|||||||
|
|
||||||
/* Handle marks */
|
/* Handle marks */
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " has these marks: %s %s %s "
|
" * Channel %"PRIu64 " has these marks: %s %s %s "
|
||||||
"%s %s %s",
|
"%s %s %s",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
channel_is_bad_for_new_circs(chan) ?
|
channel_is_bad_for_new_circs(chan) ?
|
||||||
"bad_for_new_circs" : "!bad_for_new_circs",
|
"bad_for_new_circs" : "!bad_for_new_circs",
|
||||||
channel_is_canonical(chan) ?
|
channel_is_canonical(chan) ?
|
||||||
@ -2612,9 +2612,9 @@ channel_dump_statistics, (channel_t *chan, int severity))
|
|||||||
|
|
||||||
/* Describe circuits */
|
/* Describe circuits */
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " has %d active circuits out of"
|
" * Channel %"PRIu64 " has %d active circuits out of"
|
||||||
" %d in total",
|
" %d in total",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
(chan->cmux != NULL) ?
|
(chan->cmux != NULL) ?
|
||||||
circuitmux_num_active_circuits(chan->cmux) : 0,
|
circuitmux_num_active_circuits(chan->cmux) : 0,
|
||||||
(chan->cmux != NULL) ?
|
(chan->cmux != NULL) ?
|
||||||
@ -2622,78 +2622,78 @@ channel_dump_statistics, (channel_t *chan, int severity))
|
|||||||
|
|
||||||
/* Describe timestamps */
|
/* Describe timestamps */
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " was last used by a "
|
" * Channel %"PRIu64 " was last used by a "
|
||||||
"client at " U64_FORMAT " (" U64_FORMAT " seconds ago)",
|
"client at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
U64_PRINTF_ARG(chan->timestamp_client),
|
(uint64_t)(chan->timestamp_client),
|
||||||
U64_PRINTF_ARG(now - chan->timestamp_client));
|
(uint64_t)(now - chan->timestamp_client));
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " last received a cell "
|
" * Channel %"PRIu64 " last received a cell "
|
||||||
"at " U64_FORMAT " (" U64_FORMAT " seconds ago)",
|
"at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
U64_PRINTF_ARG(chan->timestamp_recv),
|
(uint64_t)(chan->timestamp_recv),
|
||||||
U64_PRINTF_ARG(now - chan->timestamp_recv));
|
(uint64_t)(now - chan->timestamp_recv));
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " last transmitted a cell "
|
" * Channel %"PRIu64 " last transmitted a cell "
|
||||||
"at " U64_FORMAT " (" U64_FORMAT " seconds ago)",
|
"at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
U64_PRINTF_ARG(chan->timestamp_xmit),
|
(uint64_t)(chan->timestamp_xmit),
|
||||||
U64_PRINTF_ARG(now - chan->timestamp_xmit));
|
(uint64_t)(now - chan->timestamp_xmit));
|
||||||
|
|
||||||
/* Describe counters and rates */
|
/* Describe counters and rates */
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " has received "
|
" * Channel %"PRIu64 " has received "
|
||||||
U64_FORMAT " bytes in " U64_FORMAT " cells and transmitted "
|
"%"PRIu64 " bytes in %"PRIu64 " cells and transmitted "
|
||||||
U64_FORMAT " bytes in " U64_FORMAT " cells",
|
"%"PRIu64 " bytes in %"PRIu64 " cells",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
U64_PRINTF_ARG(chan->n_bytes_recved),
|
(chan->n_bytes_recved),
|
||||||
U64_PRINTF_ARG(chan->n_cells_recved),
|
(chan->n_cells_recved),
|
||||||
U64_PRINTF_ARG(chan->n_bytes_xmitted),
|
(chan->n_bytes_xmitted),
|
||||||
U64_PRINTF_ARG(chan->n_cells_xmitted));
|
(chan->n_cells_xmitted));
|
||||||
if (now > chan->timestamp_created &&
|
if (now > chan->timestamp_created &&
|
||||||
chan->timestamp_created > 0) {
|
chan->timestamp_created > 0) {
|
||||||
if (chan->n_bytes_recved > 0) {
|
if (chan->n_bytes_recved > 0) {
|
||||||
avg = (double)(chan->n_bytes_recved) / age;
|
avg = (double)(chan->n_bytes_recved) / age;
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " has averaged %f "
|
" * Channel %"PRIu64 " has averaged %f "
|
||||||
"bytes received per second",
|
"bytes received per second",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), avg);
|
(chan->global_identifier), avg);
|
||||||
}
|
}
|
||||||
if (chan->n_cells_recved > 0) {
|
if (chan->n_cells_recved > 0) {
|
||||||
avg = (double)(chan->n_cells_recved) / age;
|
avg = (double)(chan->n_cells_recved) / age;
|
||||||
if (avg >= 1.0) {
|
if (avg >= 1.0) {
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " has averaged %f "
|
" * Channel %"PRIu64 " has averaged %f "
|
||||||
"cells received per second",
|
"cells received per second",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), avg);
|
(chan->global_identifier), avg);
|
||||||
} else if (avg >= 0.0) {
|
} else if (avg >= 0.0) {
|
||||||
interval = 1.0 / avg;
|
interval = 1.0 / avg;
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " has averaged %f "
|
" * Channel %"PRIu64 " has averaged %f "
|
||||||
"seconds between received cells",
|
"seconds between received cells",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), interval);
|
(chan->global_identifier), interval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan->n_bytes_xmitted > 0) {
|
if (chan->n_bytes_xmitted > 0) {
|
||||||
avg = (double)(chan->n_bytes_xmitted) / age;
|
avg = (double)(chan->n_bytes_xmitted) / age;
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " has averaged %f "
|
" * Channel %"PRIu64 " has averaged %f "
|
||||||
"bytes transmitted per second",
|
"bytes transmitted per second",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), avg);
|
(chan->global_identifier), avg);
|
||||||
}
|
}
|
||||||
if (chan->n_cells_xmitted > 0) {
|
if (chan->n_cells_xmitted > 0) {
|
||||||
avg = (double)(chan->n_cells_xmitted) / age;
|
avg = (double)(chan->n_cells_xmitted) / age;
|
||||||
if (avg >= 1.0) {
|
if (avg >= 1.0) {
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " has averaged %f "
|
" * Channel %"PRIu64 " has averaged %f "
|
||||||
"cells transmitted per second",
|
"cells transmitted per second",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), avg);
|
(chan->global_identifier), avg);
|
||||||
} else if (avg >= 0.0) {
|
} else if (avg >= 0.0) {
|
||||||
interval = 1.0 / avg;
|
interval = 1.0 / avg;
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel " U64_FORMAT " has averaged %f "
|
" * Channel %"PRIu64 " has averaged %f "
|
||||||
"seconds between transmitted cells",
|
"seconds between transmitted cells",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), interval);
|
(chan->global_identifier), interval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2718,29 +2718,29 @@ channel_listener_dump_statistics(channel_listener_t *chan_l, int severity)
|
|||||||
age = (double)(now - chan_l->timestamp_created);
|
age = (double)(now - chan_l->timestamp_created);
|
||||||
|
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
"Channel listener " U64_FORMAT " (at %p) with transport %s is in "
|
"Channel listener %"PRIu64 " (at %p) with transport %s is in "
|
||||||
"state %s (%d)",
|
"state %s (%d)",
|
||||||
U64_PRINTF_ARG(chan_l->global_identifier), chan_l,
|
(chan_l->global_identifier), chan_l,
|
||||||
channel_listener_describe_transport(chan_l),
|
channel_listener_describe_transport(chan_l),
|
||||||
channel_listener_state_to_string(chan_l->state), chan_l->state);
|
channel_listener_state_to_string(chan_l->state), chan_l->state);
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel listener " U64_FORMAT " was created at " U64_FORMAT
|
" * Channel listener %"PRIu64 " was created at %"PRIu64
|
||||||
" (" U64_FORMAT " seconds ago) "
|
" (%"PRIu64 " seconds ago) "
|
||||||
"and last active at " U64_FORMAT " (" U64_FORMAT " seconds ago)",
|
"and last active at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
||||||
U64_PRINTF_ARG(chan_l->global_identifier),
|
(chan_l->global_identifier),
|
||||||
U64_PRINTF_ARG(chan_l->timestamp_created),
|
(uint64_t)(chan_l->timestamp_created),
|
||||||
U64_PRINTF_ARG(now - chan_l->timestamp_created),
|
(uint64_t)(now - chan_l->timestamp_created),
|
||||||
U64_PRINTF_ARG(chan_l->timestamp_active),
|
(uint64_t)(chan_l->timestamp_active),
|
||||||
U64_PRINTF_ARG(now - chan_l->timestamp_active));
|
(uint64_t)(now - chan_l->timestamp_active));
|
||||||
|
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel listener " U64_FORMAT " last accepted an incoming "
|
" * Channel listener %"PRIu64 " last accepted an incoming "
|
||||||
"channel at " U64_FORMAT " (" U64_FORMAT " seconds ago) "
|
"channel at %"PRIu64 " (%"PRIu64 " seconds ago) "
|
||||||
"and has accepted " U64_FORMAT " channels in total",
|
"and has accepted %"PRIu64 " channels in total",
|
||||||
U64_PRINTF_ARG(chan_l->global_identifier),
|
(chan_l->global_identifier),
|
||||||
U64_PRINTF_ARG(chan_l->timestamp_accepted),
|
(uint64_t)(chan_l->timestamp_accepted),
|
||||||
U64_PRINTF_ARG(now - chan_l->timestamp_accepted),
|
(uint64_t)(now - chan_l->timestamp_accepted),
|
||||||
U64_PRINTF_ARG(chan_l->n_accepted));
|
(uint64_t)(chan_l->n_accepted));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If it's sensible to do so, get the rate of incoming channels on this
|
* If it's sensible to do so, get the rate of incoming channels on this
|
||||||
@ -2752,15 +2752,15 @@ channel_listener_dump_statistics(channel_listener_t *chan_l, int severity)
|
|||||||
avg = (double)(chan_l->n_accepted) / age;
|
avg = (double)(chan_l->n_accepted) / age;
|
||||||
if (avg >= 1.0) {
|
if (avg >= 1.0) {
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel listener " U64_FORMAT " has averaged %f incoming "
|
" * Channel listener %"PRIu64 " has averaged %f incoming "
|
||||||
"channels per second",
|
"channels per second",
|
||||||
U64_PRINTF_ARG(chan_l->global_identifier), avg);
|
(chan_l->global_identifier), avg);
|
||||||
} else if (avg >= 0.0) {
|
} else if (avg >= 0.0) {
|
||||||
interval = 1.0 / avg;
|
interval = 1.0 / avg;
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel listener " U64_FORMAT " has averaged %f seconds "
|
" * Channel listener %"PRIu64 " has averaged %f seconds "
|
||||||
"between incoming channels",
|
"between incoming channels",
|
||||||
U64_PRINTF_ARG(chan_l->global_identifier), interval);
|
(chan_l->global_identifier), interval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,10 +283,10 @@ channelpadding_update_padding_for_channel(channel_t *chan,
|
|||||||
pad_vars->ito_high_ms);
|
pad_vars->ito_high_ms);
|
||||||
|
|
||||||
log_fn(LOG_INFO,LD_OR,
|
log_fn(LOG_INFO,LD_OR,
|
||||||
"Negotiated padding=%d, lo=%d, hi=%d on "U64_FORMAT,
|
"Negotiated padding=%d, lo=%d, hi=%d on %"PRIu64,
|
||||||
chan->padding_enabled, chan->padding_timeout_low_ms,
|
chan->padding_enabled, chan->padding_timeout_low_ms,
|
||||||
chan->padding_timeout_high_ms,
|
chan->padding_timeout_high_ms,
|
||||||
U64_PRINTF_ARG(chan->global_identifier));
|
(chan->global_identifier));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -394,13 +394,13 @@ channelpadding_send_padding_cell_for_callback(channel_t *chan)
|
|||||||
monotime_coarse_get(&now);
|
monotime_coarse_get(&now);
|
||||||
|
|
||||||
log_fn(LOG_INFO,LD_OR,
|
log_fn(LOG_INFO,LD_OR,
|
||||||
"Sending netflow keepalive on "U64_FORMAT" to %s (%s) after "
|
"Sending netflow keepalive on %"PRIu64" to %s (%s) after "
|
||||||
I64_FORMAT" ms. Delta "I64_FORMAT"ms",
|
"%"PRId64" ms. Delta %"PRId64"ms",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
safe_str_client(chan->get_remote_descr(chan, 0)),
|
safe_str_client(chan->get_remote_descr(chan, 0)),
|
||||||
safe_str_client(hex_str(chan->identity_digest, DIGEST_LEN)),
|
safe_str_client(hex_str(chan->identity_digest, DIGEST_LEN)),
|
||||||
I64_PRINTF_ARG(monotime_coarse_diff_msec(&chan->timestamp_xfer,&now)),
|
(monotime_coarse_diff_msec(&chan->timestamp_xfer,&now)),
|
||||||
I64_PRINTF_ARG(
|
(
|
||||||
monotime_coarse_diff_msec(&chan->next_padding_time,&now)));
|
monotime_coarse_diff_msec(&chan->next_padding_time,&now)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,9 +540,9 @@ channelpadding_compute_time_until_pad_for_netflow(channel_t *chan)
|
|||||||
if (ms_till_pad > DFLT_NETFLOW_INACTIVE_KEEPALIVE_MAX) {
|
if (ms_till_pad > DFLT_NETFLOW_INACTIVE_KEEPALIVE_MAX) {
|
||||||
tor_fragile_assert();
|
tor_fragile_assert();
|
||||||
log_warn(LD_BUG,
|
log_warn(LD_BUG,
|
||||||
"Channel padding timeout scheduled "I64_FORMAT"ms in the future. "
|
"Channel padding timeout scheduled %"PRId64"ms in the future. "
|
||||||
"Did the monotonic clock just jump?",
|
"Did the monotonic clock just jump?",
|
||||||
I64_PRINTF_ARG(ms_till_pad));
|
(ms_till_pad));
|
||||||
return 0; /* Clock jumped: Send padding now */
|
return 0; /* Clock jumped: Send padding now */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,8 +566,8 @@ channelpadding_compute_time_until_pad_for_netflow(channel_t *chan)
|
|||||||
int severity = (ms_till_pad < -NETFLOW_MISSED_WINDOW)
|
int severity = (ms_till_pad < -NETFLOW_MISSED_WINDOW)
|
||||||
? LOG_NOTICE : LOG_INFO;
|
? LOG_NOTICE : LOG_INFO;
|
||||||
log_fn(severity, LD_OR,
|
log_fn(severity, LD_OR,
|
||||||
"Channel padding timeout scheduled "I64_FORMAT"ms in the past. ",
|
"Channel padding timeout scheduled %"PRId64"ms in the past. ",
|
||||||
I64_PRINTF_ARG(-ms_till_pad));
|
(-ms_till_pad));
|
||||||
return 0; /* Clock jumped: Send padding now */
|
return 0; /* Clock jumped: Send padding now */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,8 +698,8 @@ channelpadding_reduce_padding_on_channel(channel_t *chan)
|
|||||||
chan->padding_timeout_high_ms = consensus_nf_ito_high_reduced;
|
chan->padding_timeout_high_ms = consensus_nf_ito_high_reduced;
|
||||||
|
|
||||||
log_fn(LOG_INFO,LD_OR,
|
log_fn(LOG_INFO,LD_OR,
|
||||||
"Reduced padding on channel "U64_FORMAT": lo=%d, hi=%d",
|
"Reduced padding on channel %"PRIu64": lo=%d, hi=%d",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
chan->padding_timeout_low_ms, chan->padding_timeout_high_ms);
|
chan->padding_timeout_low_ms, chan->padding_timeout_high_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,19 +194,19 @@ channel_tls_connect(const tor_addr_t *addr, uint16_t port,
|
|||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"In channel_tls_connect() for channel %p "
|
"In channel_tls_connect() for channel %p "
|
||||||
"(global id " U64_FORMAT ")",
|
"(global id %"PRIu64 ")",
|
||||||
tlschan,
|
tlschan,
|
||||||
U64_PRINTF_ARG(chan->global_identifier));
|
(chan->global_identifier));
|
||||||
|
|
||||||
if (is_local_addr(addr)) {
|
if (is_local_addr(addr)) {
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Marking new outgoing channel " U64_FORMAT " at %p as local",
|
"Marking new outgoing channel %"PRIu64 " at %p as local",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan);
|
(chan->global_identifier), chan);
|
||||||
channel_mark_local(chan);
|
channel_mark_local(chan);
|
||||||
} else {
|
} else {
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Marking new outgoing channel " U64_FORMAT " at %p as remote",
|
"Marking new outgoing channel %"PRIu64 " at %p as remote",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan);
|
(chan->global_identifier), chan);
|
||||||
channel_mark_remote(chan);
|
channel_mark_remote(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,8 +222,8 @@ channel_tls_connect(const tor_addr_t *addr, uint16_t port,
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Got orconn %p for channel with global id " U64_FORMAT,
|
"Got orconn %p for channel with global id %"PRIu64,
|
||||||
tlschan->conn, U64_PRINTF_ARG(chan->global_identifier));
|
tlschan->conn, (chan->global_identifier));
|
||||||
|
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
@ -273,8 +273,8 @@ channel_tls_start_listener(void)
|
|||||||
channel_tls_listener = listener;
|
channel_tls_listener = listener;
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Starting TLS channel listener %p with global id " U64_FORMAT,
|
"Starting TLS channel listener %p with global id %"PRIu64,
|
||||||
listener, U64_PRINTF_ARG(listener->global_identifier));
|
listener, (listener->global_identifier));
|
||||||
|
|
||||||
channel_listener_register(listener);
|
channel_listener_register(listener);
|
||||||
} else listener = channel_tls_listener;
|
} else listener = channel_tls_listener;
|
||||||
@ -303,9 +303,9 @@ channel_tls_free_all(void)
|
|||||||
*/
|
*/
|
||||||
old_listener = channel_tls_listener;
|
old_listener = channel_tls_listener;
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Closing channel_tls_listener with ID " U64_FORMAT
|
"Closing channel_tls_listener with ID %"PRIu64
|
||||||
" at %p.",
|
" at %p.",
|
||||||
U64_PRINTF_ARG(old_listener->global_identifier),
|
(old_listener->global_identifier),
|
||||||
old_listener);
|
old_listener);
|
||||||
channel_listener_unregister(old_listener);
|
channel_listener_unregister(old_listener);
|
||||||
channel_listener_mark_for_close(old_listener);
|
channel_listener_mark_for_close(old_listener);
|
||||||
@ -337,13 +337,13 @@ channel_tls_handle_incoming(or_connection_t *orconn)
|
|||||||
|
|
||||||
if (is_local_addr(&(TO_CONN(orconn)->addr))) {
|
if (is_local_addr(&(TO_CONN(orconn)->addr))) {
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Marking new incoming channel " U64_FORMAT " at %p as local",
|
"Marking new incoming channel %"PRIu64 " at %p as local",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan);
|
(chan->global_identifier), chan);
|
||||||
channel_mark_local(chan);
|
channel_mark_local(chan);
|
||||||
} else {
|
} else {
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Marking new incoming channel " U64_FORMAT " at %p as remote",
|
"Marking new incoming channel %"PRIu64 " at %p as remote",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan);
|
(chan->global_identifier), chan);
|
||||||
channel_mark_remote(chan);
|
channel_mark_remote(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,8 +433,8 @@ channel_tls_describe_transport_method(channel_t *chan)
|
|||||||
|
|
||||||
if (buf) tor_free(buf);
|
if (buf) tor_free(buf);
|
||||||
tor_asprintf(&buf,
|
tor_asprintf(&buf,
|
||||||
"TLS channel (connection " U64_FORMAT ")",
|
"TLS channel (connection %"PRIu64 ")",
|
||||||
U64_PRINTF_ARG(id));
|
(id));
|
||||||
|
|
||||||
rv = buf;
|
rv = buf;
|
||||||
} else {
|
} else {
|
||||||
@ -495,8 +495,8 @@ channel_tls_get_overhead_estimate_method(channel_t *chan)
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Estimated overhead ratio for TLS chan " U64_FORMAT " is %f",
|
"Estimated overhead ratio for TLS chan %"PRIu64 " is %f",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), overhead);
|
(chan->global_identifier), overhead);
|
||||||
|
|
||||||
return overhead;
|
return overhead;
|
||||||
}
|
}
|
||||||
@ -627,8 +627,8 @@ channel_tls_has_queued_writes_method(channel_t *chan)
|
|||||||
if (!(tlschan->conn)) {
|
if (!(tlschan->conn)) {
|
||||||
log_info(LD_CHANNEL,
|
log_info(LD_CHANNEL,
|
||||||
"something called has_queued_writes on a tlschan "
|
"something called has_queued_writes on a tlschan "
|
||||||
"(%p with ID " U64_FORMAT " but no conn",
|
"(%p with ID %"PRIu64 " but no conn",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier));
|
chan, (chan->global_identifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
outbuf_len = (tlschan->conn != NULL) ?
|
outbuf_len = (tlschan->conn != NULL) ?
|
||||||
@ -695,8 +695,8 @@ channel_tls_matches_extend_info_method(channel_t *chan,
|
|||||||
if (!(tlschan->conn)) {
|
if (!(tlschan->conn)) {
|
||||||
log_info(LD_CHANNEL,
|
log_info(LD_CHANNEL,
|
||||||
"something called matches_extend_info on a tlschan "
|
"something called matches_extend_info on a tlschan "
|
||||||
"(%p with ID " U64_FORMAT " but no conn",
|
"(%p with ID %"PRIu64 " but no conn",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier));
|
chan, (chan->global_identifier));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,8 +725,8 @@ channel_tls_matches_target_method(channel_t *chan,
|
|||||||
if (!(tlschan->conn)) {
|
if (!(tlschan->conn)) {
|
||||||
log_info(LD_CHANNEL,
|
log_info(LD_CHANNEL,
|
||||||
"something called matches_target on a tlschan "
|
"something called matches_target on a tlschan "
|
||||||
"(%p with ID " U64_FORMAT " but no conn",
|
"(%p with ID %"PRIu64 " but no conn",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier));
|
chan, (chan->global_identifier));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -808,8 +808,8 @@ channel_tls_write_cell_method(channel_t *chan, cell_t *cell)
|
|||||||
} else {
|
} else {
|
||||||
log_info(LD_CHANNEL,
|
log_info(LD_CHANNEL,
|
||||||
"something called write_cell on a tlschan "
|
"something called write_cell on a tlschan "
|
||||||
"(%p with ID " U64_FORMAT " but no conn",
|
"(%p with ID %"PRIu64 " but no conn",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier));
|
chan, (chan->global_identifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
return written;
|
return written;
|
||||||
@ -841,8 +841,8 @@ channel_tls_write_packed_cell_method(channel_t *chan,
|
|||||||
} else {
|
} else {
|
||||||
log_info(LD_CHANNEL,
|
log_info(LD_CHANNEL,
|
||||||
"something called write_packed_cell on a tlschan "
|
"something called write_packed_cell on a tlschan "
|
||||||
"(%p with ID " U64_FORMAT " but no conn",
|
"(%p with ID %"PRIu64 " but no conn",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier));
|
chan, (chan->global_identifier));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -870,8 +870,8 @@ channel_tls_write_var_cell_method(channel_t *chan, var_cell_t *var_cell)
|
|||||||
} else {
|
} else {
|
||||||
log_info(LD_CHANNEL,
|
log_info(LD_CHANNEL,
|
||||||
"something called write_var_cell on a tlschan "
|
"something called write_var_cell on a tlschan "
|
||||||
"(%p with ID " U64_FORMAT " but no conn",
|
"(%p with ID %"PRIu64 " but no conn",
|
||||||
chan, U64_PRINTF_ARG(chan->global_identifier));
|
chan, (chan->global_identifier));
|
||||||
}
|
}
|
||||||
|
|
||||||
return written;
|
return written;
|
||||||
@ -1343,15 +1343,15 @@ channel_tls_update_marks(or_connection_t *conn)
|
|||||||
if (is_local_addr(&(TO_CONN(conn)->addr))) {
|
if (is_local_addr(&(TO_CONN(conn)->addr))) {
|
||||||
if (!channel_is_local(chan)) {
|
if (!channel_is_local(chan)) {
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Marking channel " U64_FORMAT " at %p as local",
|
"Marking channel %"PRIu64 " at %p as local",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan);
|
(chan->global_identifier), chan);
|
||||||
channel_mark_local(chan);
|
channel_mark_local(chan);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (channel_is_local(chan)) {
|
if (channel_is_local(chan)) {
|
||||||
log_debug(LD_CHANNEL,
|
log_debug(LD_CHANNEL,
|
||||||
"Marking channel " U64_FORMAT " at %p as remote",
|
"Marking channel %"PRIu64 " at %p as remote",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan);
|
(chan->global_identifier), chan);
|
||||||
channel_mark_remote(chan);
|
channel_mark_remote(chan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,11 +202,11 @@ get_unique_circ_id_by_chan(channel_t *chan)
|
|||||||
chan->cmux);
|
chan->cmux);
|
||||||
|
|
||||||
log_warn(LD_CIRC, " Circuitmux on this channel has %u circuits, "
|
log_warn(LD_CIRC, " Circuitmux on this channel has %u circuits, "
|
||||||
"of which %u are active. It says it has "I64_FORMAT
|
"of which %u are active. It says it has %"PRId64
|
||||||
" destroy cells queued.",
|
" destroy cells queued.",
|
||||||
circuitmux_num_circuits(chan->cmux),
|
circuitmux_num_circuits(chan->cmux),
|
||||||
circuitmux_num_active_circuits(chan->cmux),
|
circuitmux_num_active_circuits(chan->cmux),
|
||||||
I64_PRINTF_ARG(queued_destroys));
|
(queued_destroys));
|
||||||
|
|
||||||
/* Change this into "if (1)" in order to get more information about
|
/* Change this into "if (1)" in order to get more information about
|
||||||
* possible failure modes here. You'll need to know how to use gdb with
|
* possible failure modes here. You'll need to know how to use gdb with
|
||||||
@ -1150,20 +1150,20 @@ circuit_note_clock_jumped(int64_t seconds_elapsed, bool was_idle)
|
|||||||
{
|
{
|
||||||
int severity = server_mode(get_options()) ? LOG_WARN : LOG_NOTICE;
|
int severity = server_mode(get_options()) ? LOG_WARN : LOG_NOTICE;
|
||||||
if (was_idle) {
|
if (was_idle) {
|
||||||
tor_log(severity, LD_GENERAL, "Tor has been idle for "I64_FORMAT
|
tor_log(severity, LD_GENERAL, "Tor has been idle for %"PRId64
|
||||||
" seconds; assuming established circuits no longer work.",
|
" seconds; assuming established circuits no longer work.",
|
||||||
I64_PRINTF_ARG(seconds_elapsed));
|
(seconds_elapsed));
|
||||||
} else {
|
} else {
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
"Your system clock just jumped "I64_FORMAT" seconds %s; "
|
"Your system clock just jumped %"PRId64" seconds %s; "
|
||||||
"assuming established circuits no longer work.",
|
"assuming established circuits no longer work.",
|
||||||
I64_PRINTF_ARG(
|
(
|
||||||
seconds_elapsed >=0 ? seconds_elapsed : -seconds_elapsed),
|
seconds_elapsed >=0 ? seconds_elapsed : -seconds_elapsed),
|
||||||
seconds_elapsed >=0 ? "forward" : "backward");
|
seconds_elapsed >=0 ? "forward" : "backward");
|
||||||
}
|
}
|
||||||
control_event_general_status(LOG_WARN, "CLOCK_JUMPED TIME="I64_FORMAT
|
control_event_general_status(LOG_WARN, "CLOCK_JUMPED TIME=%"PRId64
|
||||||
" IDLE=%d",
|
" IDLE=%d",
|
||||||
I64_PRINTF_ARG(seconds_elapsed), was_idle?1:0);
|
(seconds_elapsed), was_idle?1:0);
|
||||||
/* so we log when it works again */
|
/* so we log when it works again */
|
||||||
note_that_we_maybe_cant_complete_circuits();
|
note_that_we_maybe_cant_complete_circuits();
|
||||||
control_event_client_status(severity, "CIRCUIT_NOT_ESTABLISHED REASON=%s",
|
control_event_client_status(severity, "CIRCUIT_NOT_ESTABLISHED REASON=%s",
|
||||||
|
@ -1003,9 +1003,9 @@ origin_circuit_new(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_info(LD_CIRC,
|
log_info(LD_CIRC,
|
||||||
"Circuit " U64_FORMAT " chose an idle timeout of %d based on "
|
"Circuit %"PRIu32" chose an idle timeout of %d based on "
|
||||||
"%d seconds of predictive building remaining.",
|
"%d seconds of predictive building remaining.",
|
||||||
U64_PRINTF_ARG(circ->global_identifier),
|
(circ->global_identifier),
|
||||||
circ->circuit_idle_timeout,
|
circ->circuit_idle_timeout,
|
||||||
prediction_time_remaining);
|
prediction_time_remaining);
|
||||||
}
|
}
|
||||||
@ -1392,9 +1392,9 @@ circuit_get_by_circid_channel_impl(circid_t circ_id, channel_t *chan,
|
|||||||
if (found && found->circuit) {
|
if (found && found->circuit) {
|
||||||
log_debug(LD_CIRC,
|
log_debug(LD_CIRC,
|
||||||
"circuit_get_by_circid_channel_impl() returning circuit %p for"
|
"circuit_get_by_circid_channel_impl() returning circuit %p for"
|
||||||
" circ_id %u, channel ID " U64_FORMAT " (%p)",
|
" circ_id %u, channel ID %"PRIu64 " (%p)",
|
||||||
found->circuit, (unsigned)circ_id,
|
found->circuit, (unsigned)circ_id,
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan);
|
(chan->global_identifier), chan);
|
||||||
if (found_entry_out)
|
if (found_entry_out)
|
||||||
*found_entry_out = 1;
|
*found_entry_out = 1;
|
||||||
return found->circuit;
|
return found->circuit;
|
||||||
@ -1402,10 +1402,10 @@ circuit_get_by_circid_channel_impl(circid_t circ_id, channel_t *chan,
|
|||||||
|
|
||||||
log_debug(LD_CIRC,
|
log_debug(LD_CIRC,
|
||||||
"circuit_get_by_circid_channel_impl() found %s for"
|
"circuit_get_by_circid_channel_impl() found %s for"
|
||||||
" circ_id %u, channel ID " U64_FORMAT " (%p)",
|
" circ_id %u, channel ID %"PRIu64 " (%p)",
|
||||||
found ? "placeholder" : "nothing",
|
found ? "placeholder" : "nothing",
|
||||||
(unsigned)circ_id,
|
(unsigned)circ_id,
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan);
|
(chan->global_identifier), chan);
|
||||||
|
|
||||||
if (found_entry_out)
|
if (found_entry_out)
|
||||||
*found_entry_out = found ? 1 : 0;
|
*found_entry_out = found ? 1 : 0;
|
||||||
@ -2604,10 +2604,10 @@ circuits_handle_oom(size_t current_allocation)
|
|||||||
|
|
||||||
done_recovering_mem:
|
done_recovering_mem:
|
||||||
|
|
||||||
log_notice(LD_GENERAL, "Removed "U64_FORMAT" bytes by killing %d circuits; "
|
log_notice(LD_GENERAL, "Removed %"TOR_PRIuSZ" bytes by killing %d circuits; "
|
||||||
"%d circuits remain alive. Also killed %d non-linked directory "
|
"%d circuits remain alive. Also killed %d non-linked directory "
|
||||||
"connections.",
|
"connections.",
|
||||||
U64_PRINTF_ARG(mem_recovered),
|
mem_recovered,
|
||||||
n_circuits_killed,
|
n_circuits_killed,
|
||||||
smartlist_len(circlist) - n_circuits_killed,
|
smartlist_len(circlist) - n_circuits_killed,
|
||||||
n_dirconns_killed);
|
n_dirconns_killed);
|
||||||
|
@ -320,10 +320,10 @@ circuitmux_detach_all_circuits(circuitmux_t *cmux, smartlist_t *detached_out)
|
|||||||
} else {
|
} else {
|
||||||
/* Complain and move on */
|
/* Complain and move on */
|
||||||
log_warn(LD_CIRC,
|
log_warn(LD_CIRC,
|
||||||
"Circuit %u/channel " U64_FORMAT " had direction == "
|
"Circuit %u/channel %"PRIu64 " had direction == "
|
||||||
"CELL_DIRECTION_IN, but isn't an or_circuit_t",
|
"CELL_DIRECTION_IN, but isn't an or_circuit_t",
|
||||||
(unsigned)to_remove->circ_id,
|
(unsigned)to_remove->circ_id,
|
||||||
U64_PRINTF_ARG(to_remove->chan_id));
|
(to_remove->chan_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free policy-specific data if we have it */
|
/* Free policy-specific data if we have it */
|
||||||
@ -344,15 +344,15 @@ circuitmux_detach_all_circuits(circuitmux_t *cmux, smartlist_t *detached_out)
|
|||||||
} else {
|
} else {
|
||||||
/* Complain and move on */
|
/* Complain and move on */
|
||||||
log_warn(LD_CIRC,
|
log_warn(LD_CIRC,
|
||||||
"Couldn't find circuit %u (for channel " U64_FORMAT ")",
|
"Couldn't find circuit %u (for channel %"PRIu64 ")",
|
||||||
(unsigned)to_remove->circ_id,
|
(unsigned)to_remove->circ_id,
|
||||||
U64_PRINTF_ARG(to_remove->chan_id));
|
(to_remove->chan_id));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Complain and move on */
|
/* Complain and move on */
|
||||||
log_warn(LD_CIRC,
|
log_warn(LD_CIRC,
|
||||||
"Couldn't find channel " U64_FORMAT " (for circuit id %u)",
|
"Couldn't find channel %"PRIu64 " (for circuit id %u)",
|
||||||
U64_PRINTF_ARG(to_remove->chan_id),
|
(to_remove->chan_id),
|
||||||
(unsigned)to_remove->circ_id);
|
(unsigned)to_remove->circ_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,17 +428,17 @@ circuitmux_free_(circuitmux_t *cmux)
|
|||||||
global_destroy_ctr -= cmux->destroy_cell_queue.n;
|
global_destroy_ctr -= cmux->destroy_cell_queue.n;
|
||||||
log_debug(LD_CIRC,
|
log_debug(LD_CIRC,
|
||||||
"Freeing cmux at %p with %u queued destroys; the last cmux "
|
"Freeing cmux at %p with %u queued destroys; the last cmux "
|
||||||
"destroy balance was "I64_FORMAT", global is "I64_FORMAT,
|
"destroy balance was %"PRId64", global is %"PRId64,
|
||||||
cmux, cmux->destroy_cell_queue.n,
|
cmux, cmux->destroy_cell_queue.n,
|
||||||
I64_PRINTF_ARG(cmux->destroy_ctr),
|
(cmux->destroy_ctr),
|
||||||
I64_PRINTF_ARG(global_destroy_ctr));
|
(global_destroy_ctr));
|
||||||
} else {
|
} else {
|
||||||
log_debug(LD_CIRC,
|
log_debug(LD_CIRC,
|
||||||
"Freeing cmux at %p with no queued destroys, the cmux destroy "
|
"Freeing cmux at %p with no queued destroys, the cmux destroy "
|
||||||
"balance was "I64_FORMAT", global is "I64_FORMAT,
|
"balance was %"PRId64", global is %"PRId64,
|
||||||
cmux,
|
cmux,
|
||||||
I64_PRINTF_ARG(cmux->destroy_ctr),
|
(cmux->destroy_ctr),
|
||||||
I64_PRINTF_ARG(global_destroy_ctr));
|
(global_destroy_ctr));
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy_cell_queue_clear(&cmux->destroy_cell_queue);
|
destroy_cell_queue_clear(&cmux->destroy_cell_queue);
|
||||||
@ -835,9 +835,9 @@ circuitmux_attach_circuit,(circuitmux_t *cmux, circuit_t *circ,
|
|||||||
* directions match and update the cell count and active circuit count.
|
* directions match and update the cell count and active circuit count.
|
||||||
*/
|
*/
|
||||||
log_info(LD_CIRC,
|
log_info(LD_CIRC,
|
||||||
"Circuit %u on channel " U64_FORMAT " was already attached to "
|
"Circuit %u on channel %"PRIu64 " was already attached to "
|
||||||
"cmux %p (trying to attach to %p)",
|
"cmux %p (trying to attach to %p)",
|
||||||
(unsigned)circ_id, U64_PRINTF_ARG(channel_id),
|
(unsigned)circ_id, (channel_id),
|
||||||
((direction == CELL_DIRECTION_OUT) ?
|
((direction == CELL_DIRECTION_OUT) ?
|
||||||
circ->n_mux : TO_OR_CIRCUIT(circ)->p_mux),
|
circ->n_mux : TO_OR_CIRCUIT(circ)->p_mux),
|
||||||
cmux);
|
cmux);
|
||||||
@ -869,8 +869,8 @@ circuitmux_attach_circuit,(circuitmux_t *cmux, circuit_t *circ,
|
|||||||
* counts.
|
* counts.
|
||||||
*/
|
*/
|
||||||
log_debug(LD_CIRC,
|
log_debug(LD_CIRC,
|
||||||
"Attaching circuit %u on channel " U64_FORMAT " to cmux %p",
|
"Attaching circuit %u on channel %"PRIu64 " to cmux %p",
|
||||||
(unsigned)circ_id, U64_PRINTF_ARG(channel_id), cmux);
|
(unsigned)circ_id, (channel_id), cmux);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assert that the circuit doesn't already have a mux for this
|
* Assert that the circuit doesn't already have a mux for this
|
||||||
@ -1241,11 +1241,11 @@ circuitmux_notify_xmit_destroy(circuitmux_t *cmux)
|
|||||||
--(cmux->destroy_ctr);
|
--(cmux->destroy_ctr);
|
||||||
--(global_destroy_ctr);
|
--(global_destroy_ctr);
|
||||||
log_debug(LD_CIRC,
|
log_debug(LD_CIRC,
|
||||||
"Cmux at %p sent a destroy, cmux counter is now "I64_FORMAT", "
|
"Cmux at %p sent a destroy, cmux counter is now %"PRId64", "
|
||||||
"global counter is now "I64_FORMAT,
|
"global counter is now %"PRId64,
|
||||||
cmux,
|
cmux,
|
||||||
I64_PRINTF_ARG(cmux->destroy_ctr),
|
(cmux->destroy_ctr),
|
||||||
I64_PRINTF_ARG(global_destroy_ctr));
|
(global_destroy_ctr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*DOCDOC */
|
/*DOCDOC */
|
||||||
@ -1262,10 +1262,10 @@ circuitmux_append_destroy_cell(channel_t *chan,
|
|||||||
++global_destroy_ctr;
|
++global_destroy_ctr;
|
||||||
log_debug(LD_CIRC,
|
log_debug(LD_CIRC,
|
||||||
"Cmux at %p queued a destroy for circ %u, cmux counter is now "
|
"Cmux at %p queued a destroy for circ %u, cmux counter is now "
|
||||||
I64_FORMAT", global counter is now "I64_FORMAT,
|
"%"PRId64", global counter is now %"PRId64,
|
||||||
cmux, circ_id,
|
cmux, circ_id,
|
||||||
I64_PRINTF_ARG(cmux->destroy_ctr),
|
(cmux->destroy_ctr),
|
||||||
I64_PRINTF_ARG(global_destroy_ctr));
|
(global_destroy_ctr));
|
||||||
|
|
||||||
/* XXXX Duplicate code from append_cell_to_circuit_queue */
|
/* XXXX Duplicate code from append_cell_to_circuit_queue */
|
||||||
if (!channel_has_queued_writes(chan)) {
|
if (!channel_has_queued_writes(chan)) {
|
||||||
@ -1303,12 +1303,12 @@ circuitmux_count_queued_destroy_cells(const channel_t *chan,
|
|||||||
n_destroy_cells != manual_total ||
|
n_destroy_cells != manual_total ||
|
||||||
n_destroy_cells != manual_total_in_map) {
|
n_destroy_cells != manual_total_in_map) {
|
||||||
log_warn(LD_BUG, " Discrepancy in counts for queued destroy cells on "
|
log_warn(LD_BUG, " Discrepancy in counts for queued destroy cells on "
|
||||||
"circuitmux. n="I64_FORMAT". queue_size="I64_FORMAT". "
|
"circuitmux. n=%"PRId64". queue_size=%"PRId64". "
|
||||||
"manual_total="I64_FORMAT". manual_total_in_map="I64_FORMAT".",
|
"manual_total=%"PRId64". manual_total_in_map=%"PRId64".",
|
||||||
I64_PRINTF_ARG(n_destroy_cells),
|
(n_destroy_cells),
|
||||||
I64_PRINTF_ARG(destroy_queue_size),
|
(destroy_queue_size),
|
||||||
I64_PRINTF_ARG(manual_total),
|
(manual_total),
|
||||||
I64_PRINTF_ARG(manual_total_in_map));
|
(manual_total_in_map));
|
||||||
}
|
}
|
||||||
|
|
||||||
return n_destroy_cells;
|
return n_destroy_cells;
|
||||||
|
@ -713,8 +713,8 @@ circuit_build_times_handle_completed_hop(origin_circuit_t *circ)
|
|||||||
* Switch their purpose and wait. */
|
* Switch their purpose and wait. */
|
||||||
if (circ->base_.purpose != CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT) {
|
if (circ->base_.purpose != CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT) {
|
||||||
log_info(LD_CIRC,
|
log_info(LD_CIRC,
|
||||||
"Deciding to timeout circuit "U64_FORMAT"\n",
|
"Deciding to timeout circuit %"PRIu32"\n",
|
||||||
U64_PRINTF_ARG(circ->global_identifier));
|
(circ->global_identifier));
|
||||||
circuit_build_times_mark_circ_as_measurement_only(circ);
|
circuit_build_times_mark_circ_as_measurement_only(circ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -719,9 +719,8 @@ circuit_expire_building(void)
|
|||||||
circuit_build_times_enough_to_compute(get_circuit_build_times())) {
|
circuit_build_times_enough_to_compute(get_circuit_build_times())) {
|
||||||
|
|
||||||
log_info(LD_CIRC,
|
log_info(LD_CIRC,
|
||||||
"Deciding to count the timeout for circuit "U64_FORMAT"\n",
|
"Deciding to count the timeout for circuit %"PRIu32"\n",
|
||||||
U64_PRINTF_ARG(
|
TO_ORIGIN_CIRCUIT(victim)->global_identifier);
|
||||||
TO_ORIGIN_CIRCUIT(victim)->global_identifier));
|
|
||||||
|
|
||||||
/* Circuits are allowed to last longer for measurement.
|
/* Circuits are allowed to last longer for measurement.
|
||||||
* Switch their purpose and wait. */
|
* Switch their purpose and wait. */
|
||||||
@ -1510,10 +1509,10 @@ circuit_expire_old_circuits_clientside(void)
|
|||||||
circ->purpose <= CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED) ||
|
circ->purpose <= CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED) ||
|
||||||
circ->purpose == CIRCUIT_PURPOSE_S_CONNECT_REND) {
|
circ->purpose == CIRCUIT_PURPOSE_S_CONNECT_REND) {
|
||||||
log_info(LD_CIRC,
|
log_info(LD_CIRC,
|
||||||
"Closing circuit "U64_FORMAT
|
"Closing circuit %"PRIu32
|
||||||
" that has been unused for %ld msec.",
|
" that has been unused for %ld msec.",
|
||||||
U64_PRINTF_ARG(TO_ORIGIN_CIRCUIT(circ)->global_identifier),
|
TO_ORIGIN_CIRCUIT(circ)->global_identifier,
|
||||||
tv_mdiff(&circ->timestamp_began, &now));
|
tv_mdiff(&circ->timestamp_began, &now));
|
||||||
circuit_mark_for_close(circ, END_CIRC_REASON_FINISHED);
|
circuit_mark_for_close(circ, END_CIRC_REASON_FINISHED);
|
||||||
} else if (!TO_ORIGIN_CIRCUIT(circ)->is_ancient) {
|
} else if (!TO_ORIGIN_CIRCUIT(circ)->is_ancient) {
|
||||||
/* Server-side rend joined circuits can end up really old, because
|
/* Server-side rend joined circuits can end up really old, because
|
||||||
|
@ -249,10 +249,10 @@ command_process_create_cell(cell_t *cell, channel_t *chan)
|
|||||||
tor_assert(chan);
|
tor_assert(chan);
|
||||||
|
|
||||||
log_debug(LD_OR,
|
log_debug(LD_OR,
|
||||||
"Got a CREATE cell for circ_id %u on channel " U64_FORMAT
|
"Got a CREATE cell for circ_id %u on channel %"PRIu64
|
||||||
" (%p)",
|
" (%p)",
|
||||||
(unsigned)cell->circ_id,
|
(unsigned)cell->circ_id,
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan);
|
(chan->global_identifier), chan);
|
||||||
|
|
||||||
/* First thing we do, even though the cell might be invalid, is inform the
|
/* First thing we do, even though the cell might be invalid, is inform the
|
||||||
* DoS mitigation subsystem layer of this event. Validation is done by this
|
* DoS mitigation subsystem layer of this event. Validation is done by this
|
||||||
|
@ -3061,8 +3061,8 @@ ensure_bandwidth_cap(uint64_t *value, const char *desc, char **msg)
|
|||||||
--*value;
|
--*value;
|
||||||
}
|
}
|
||||||
if (*value > ROUTER_MAX_DECLARED_BANDWIDTH) {
|
if (*value > ROUTER_MAX_DECLARED_BANDWIDTH) {
|
||||||
tor_asprintf(msg, "%s ("U64_FORMAT") must be at most %d",
|
tor_asprintf(msg, "%s (%"PRIu64") must be at most %d",
|
||||||
desc, U64_PRINTF_ARG(*value),
|
desc, (*value),
|
||||||
ROUTER_MAX_DECLARED_BANDWIDTH);
|
ROUTER_MAX_DECLARED_BANDWIDTH);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -4595,8 +4595,8 @@ compute_real_max_mem_in_queues(const uint64_t val, int log_guess)
|
|||||||
uint64_t result;
|
uint64_t result;
|
||||||
|
|
||||||
if (val == 0) {
|
if (val == 0) {
|
||||||
#define ONE_GIGABYTE (U64_LITERAL(1) << 30)
|
#define ONE_GIGABYTE (UINT64_C(1) << 30)
|
||||||
#define ONE_MEGABYTE (U64_LITERAL(1) << 20)
|
#define ONE_MEGABYTE (UINT64_C(1) << 20)
|
||||||
/* The user didn't pick a memory limit. Choose a very large one
|
/* The user didn't pick a memory limit. Choose a very large one
|
||||||
* that is still smaller than the system memory */
|
* that is still smaller than the system memory */
|
||||||
static int notice_sent = 0;
|
static int notice_sent = 0;
|
||||||
@ -4650,10 +4650,10 @@ compute_real_max_mem_in_queues(const uint64_t val, int log_guess)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (log_guess && ! notice_sent) {
|
if (log_guess && ! notice_sent) {
|
||||||
log_notice(LD_CONFIG, "%sMaxMemInQueues is set to "U64_FORMAT" MB. "
|
log_notice(LD_CONFIG, "%sMaxMemInQueues is set to %"PRIu64" MB. "
|
||||||
"You can override this by setting MaxMemInQueues by hand.",
|
"You can override this by setting MaxMemInQueues by hand.",
|
||||||
ram ? "Based on detected system memory, " : "",
|
ram ? "Based on detected system memory, " : "",
|
||||||
U64_PRINTF_ARG(result / ONE_MEGABYTE));
|
(result / ONE_MEGABYTE));
|
||||||
notice_sent = 1;
|
notice_sent = 1;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
|
|
||||||
/** Maximum default value for MaxMemInQueues, in bytes. */
|
/** Maximum default value for MaxMemInQueues, in bytes. */
|
||||||
#if SIZEOF_VOID_P >= 8
|
#if SIZEOF_VOID_P >= 8
|
||||||
#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (U64_LITERAL(8) << 30)
|
#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (UINT64_C(8) << 30)
|
||||||
#else
|
#else
|
||||||
#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (U64_LITERAL(2) << 30)
|
#define MAX_DEFAULT_MEMORY_QUEUE_SIZE (UINT64_C(2) << 30)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MOCK_DECL(const char*, get_dirportfrontpage, (void));
|
MOCK_DECL(const char*, get_dirportfrontpage, (void));
|
||||||
|
@ -575,8 +575,8 @@ config_get_assigned_option(const config_format_t *fmt, const void *options,
|
|||||||
escape_val = 0; /* Can't need escape. */
|
escape_val = 0; /* Can't need escape. */
|
||||||
break;
|
break;
|
||||||
case CONFIG_TYPE_MEMUNIT:
|
case CONFIG_TYPE_MEMUNIT:
|
||||||
tor_asprintf(&result->value, U64_FORMAT,
|
tor_asprintf(&result->value, "%"PRIu64,
|
||||||
U64_PRINTF_ARG(*(uint64_t*)value));
|
(*(uint64_t*)value));
|
||||||
escape_val = 0; /* Can't need escape. */
|
escape_val = 0; /* Can't need escape. */
|
||||||
break;
|
break;
|
||||||
case CONFIG_TYPE_DOUBLE:
|
case CONFIG_TYPE_DOUBLE:
|
||||||
@ -1041,15 +1041,15 @@ static struct unit_table_t memory_units[] = {
|
|||||||
{ "gigabit", 1<<27 },
|
{ "gigabit", 1<<27 },
|
||||||
{ "gbits", 1<<27 },
|
{ "gbits", 1<<27 },
|
||||||
{ "gbit", 1<<27 },
|
{ "gbit", 1<<27 },
|
||||||
{ "tb", U64_LITERAL(1)<<40 },
|
{ "tb", UINT64_C(1)<<40 },
|
||||||
{ "tbyte", U64_LITERAL(1)<<40 },
|
{ "tbyte", UINT64_C(1)<<40 },
|
||||||
{ "tbytes", U64_LITERAL(1)<<40 },
|
{ "tbytes", UINT64_C(1)<<40 },
|
||||||
{ "terabyte", U64_LITERAL(1)<<40 },
|
{ "terabyte", UINT64_C(1)<<40 },
|
||||||
{ "terabytes", U64_LITERAL(1)<<40 },
|
{ "terabytes", UINT64_C(1)<<40 },
|
||||||
{ "terabits", U64_LITERAL(1)<<37 },
|
{ "terabits", UINT64_C(1)<<37 },
|
||||||
{ "terabit", U64_LITERAL(1)<<37 },
|
{ "terabit", UINT64_C(1)<<37 },
|
||||||
{ "tbits", U64_LITERAL(1)<<37 },
|
{ "tbits", UINT64_C(1)<<37 },
|
||||||
{ "tbit", U64_LITERAL(1)<<37 },
|
{ "tbit", UINT64_C(1)<<37 },
|
||||||
{ NULL, 0 },
|
{ NULL, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1118,7 +1118,7 @@ config_parse_units(const char *val, struct unit_table_t *u, int *ok)
|
|||||||
|
|
||||||
if (!cp) {
|
if (!cp) {
|
||||||
*ok = 1;
|
*ok = 1;
|
||||||
v = use_float ? DBL_TO_U64(d) : v;
|
v = use_float ? ((uint64_t)d) : v;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,9 +624,9 @@ connection_free_minimal(connection_t *conn)
|
|||||||
/* Owww, this shouldn't happen, but... */
|
/* Owww, this shouldn't happen, but... */
|
||||||
log_info(LD_CHANNEL,
|
log_info(LD_CHANNEL,
|
||||||
"Freeing orconn at %p, saw channel %p with ID "
|
"Freeing orconn at %p, saw channel %p with ID "
|
||||||
U64_FORMAT " left un-NULLed",
|
"%"PRIu64 " left un-NULLed",
|
||||||
or_conn, TLS_CHAN_TO_BASE(or_conn->chan),
|
or_conn, TLS_CHAN_TO_BASE(or_conn->chan),
|
||||||
U64_PRINTF_ARG(
|
(
|
||||||
TLS_CHAN_TO_BASE(or_conn->chan)->global_identifier));
|
TLS_CHAN_TO_BASE(or_conn->chan)->global_identifier));
|
||||||
if (!CHANNEL_FINISHED(TLS_CHAN_TO_BASE(or_conn->chan))) {
|
if (!CHANNEL_FINISHED(TLS_CHAN_TO_BASE(or_conn->chan))) {
|
||||||
channel_close_for_error(TLS_CHAN_TO_BASE(or_conn->chan));
|
channel_close_for_error(TLS_CHAN_TO_BASE(or_conn->chan));
|
||||||
@ -4996,16 +4996,16 @@ connection_dump_buffer_mem_stats(int severity)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
"In buffers for %d connections: "U64_FORMAT" used/"U64_FORMAT" allocated",
|
"In buffers for %d connections: %"PRIu64" used/%"PRIu64" allocated",
|
||||||
smartlist_len(conns),
|
smartlist_len(conns),
|
||||||
U64_PRINTF_ARG(total_used), U64_PRINTF_ARG(total_alloc));
|
(total_used), (total_alloc));
|
||||||
for (i=CONN_TYPE_MIN_; i <= CONN_TYPE_MAX_; ++i) {
|
for (i=CONN_TYPE_MIN_; i <= CONN_TYPE_MAX_; ++i) {
|
||||||
if (!n_conns_by_type[i])
|
if (!n_conns_by_type[i])
|
||||||
continue;
|
continue;
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" For %d %s connections: "U64_FORMAT" used/"U64_FORMAT" allocated",
|
" For %d %s connections: %"PRIu64" used/%"PRIu64" allocated",
|
||||||
n_conns_by_type[i], conn_type_to_string(i),
|
n_conns_by_type[i], conn_type_to_string(i),
|
||||||
U64_PRINTF_ARG(used_by_type[i]), U64_PRINTF_ARG(alloc_by_type[i]));
|
(used_by_type[i]), (alloc_by_type[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3200,9 +3200,9 @@ connection_ap_handshake_socks_reply(entry_connection_t *conn, char *reply,
|
|||||||
!CIRCUIT_IS_ORIGIN(conn->edge_.on_circuit)) {
|
!CIRCUIT_IS_ORIGIN(conn->edge_.on_circuit)) {
|
||||||
if (endreason != END_STREAM_REASON_RESOLVEFAILED) {
|
if (endreason != END_STREAM_REASON_RESOLVEFAILED) {
|
||||||
log_info(LD_BUG,
|
log_info(LD_BUG,
|
||||||
"No origin circuit for successful SOCKS stream "U64_FORMAT
|
"No origin circuit for successful SOCKS stream %"PRIu64
|
||||||
". Reason: %d",
|
". Reason: %d",
|
||||||
U64_PRINTF_ARG(ENTRY_TO_CONN(conn)->global_identifier),
|
(ENTRY_TO_CONN(conn)->global_identifier),
|
||||||
endreason);
|
endreason);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -855,9 +855,9 @@ connection_or_set_canonical(or_connection_t *or_conn,
|
|||||||
TLS_CHAN_TO_BASE(or_conn->chan), is_canonical);
|
TLS_CHAN_TO_BASE(or_conn->chan), is_canonical);
|
||||||
|
|
||||||
log_info(LD_CIRC,
|
log_info(LD_CIRC,
|
||||||
"Channel " U64_FORMAT " chose an idle timeout of %d.",
|
"Channel %"PRIu64 " chose an idle timeout of %d.",
|
||||||
or_conn->chan ?
|
or_conn->chan ?
|
||||||
U64_PRINTF_ARG(TLS_CHAN_TO_BASE(or_conn->chan)->global_identifier):0,
|
(TLS_CHAN_TO_BASE(or_conn->chan)->global_identifier):0,
|
||||||
or_conn->idle_timeout);
|
or_conn->idle_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1893,9 +1893,9 @@ getinfo_helper_misc(control_connection_t *conn, const char *question,
|
|||||||
}
|
}
|
||||||
*answer = tor_dup_ip(addr);
|
*answer = tor_dup_ip(addr);
|
||||||
} else if (!strcmp(question, "traffic/read")) {
|
} else if (!strcmp(question, "traffic/read")) {
|
||||||
tor_asprintf(answer, U64_FORMAT, U64_PRINTF_ARG(get_bytes_read()));
|
tor_asprintf(answer, "%"PRIu64, (get_bytes_read()));
|
||||||
} else if (!strcmp(question, "traffic/written")) {
|
} else if (!strcmp(question, "traffic/written")) {
|
||||||
tor_asprintf(answer, U64_FORMAT, U64_PRINTF_ARG(get_bytes_written()));
|
tor_asprintf(answer, "%"PRIu64, (get_bytes_written()));
|
||||||
} else if (!strcmp(question, "process/pid")) {
|
} else if (!strcmp(question, "process/pid")) {
|
||||||
int myPid = -1;
|
int myPid = -1;
|
||||||
|
|
||||||
@ -1930,8 +1930,8 @@ getinfo_helper_misc(control_connection_t *conn, const char *question,
|
|||||||
int max_fds = get_max_sockets();
|
int max_fds = get_max_sockets();
|
||||||
tor_asprintf(answer, "%d", max_fds);
|
tor_asprintf(answer, "%d", max_fds);
|
||||||
} else if (!strcmp(question, "limits/max-mem-in-queues")) {
|
} else if (!strcmp(question, "limits/max-mem-in-queues")) {
|
||||||
tor_asprintf(answer, U64_FORMAT,
|
tor_asprintf(answer, "%"PRIu64,
|
||||||
U64_PRINTF_ARG(get_options()->MaxMemInQueues));
|
(get_options()->MaxMemInQueues));
|
||||||
} else if (!strcmp(question, "fingerprint")) {
|
} else if (!strcmp(question, "fingerprint")) {
|
||||||
crypto_pk_t *server_key;
|
crypto_pk_t *server_key;
|
||||||
if (!server_mode(get_options())) {
|
if (!server_mode(get_options())) {
|
||||||
@ -5891,8 +5891,8 @@ control_event_stream_status(entry_connection_t *conn, stream_status_event_t tp,
|
|||||||
if (circ && CIRCUIT_IS_ORIGIN(circ))
|
if (circ && CIRCUIT_IS_ORIGIN(circ))
|
||||||
origin_circ = TO_ORIGIN_CIRCUIT(circ);
|
origin_circ = TO_ORIGIN_CIRCUIT(circ);
|
||||||
send_control_event(EVENT_STREAM_STATUS,
|
send_control_event(EVENT_STREAM_STATUS,
|
||||||
"650 STREAM "U64_FORMAT" %s %lu %s%s%s%s\r\n",
|
"650 STREAM %"PRIu64" %s %lu %s%s%s%s\r\n",
|
||||||
U64_PRINTF_ARG(ENTRY_TO_CONN(conn)->global_identifier),
|
(ENTRY_TO_CONN(conn)->global_identifier),
|
||||||
status,
|
status,
|
||||||
origin_circ?
|
origin_circ?
|
||||||
(unsigned long)origin_circ->global_identifier : 0ul,
|
(unsigned long)origin_circ->global_identifier : 0ul,
|
||||||
@ -5963,12 +5963,12 @@ control_event_or_conn_status(or_connection_t *conn, or_conn_status_event_t tp,
|
|||||||
|
|
||||||
orconn_target_get_name(name, sizeof(name), conn);
|
orconn_target_get_name(name, sizeof(name), conn);
|
||||||
send_control_event(EVENT_OR_CONN_STATUS,
|
send_control_event(EVENT_OR_CONN_STATUS,
|
||||||
"650 ORCONN %s %s%s%s%s ID="U64_FORMAT"\r\n",
|
"650 ORCONN %s %s%s%s%s ID=%"PRIu64"\r\n",
|
||||||
name, status,
|
name, status,
|
||||||
reason ? " REASON=" : "",
|
reason ? " REASON=" : "",
|
||||||
orconn_end_reason_to_control_string(reason),
|
orconn_end_reason_to_control_string(reason),
|
||||||
ncircs_buf,
|
ncircs_buf,
|
||||||
U64_PRINTF_ARG(conn->base_.global_identifier));
|
(conn->base_.global_identifier));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -5988,8 +5988,8 @@ control_event_stream_bandwidth(edge_connection_t *edge_conn)
|
|||||||
tor_gettimeofday(&now);
|
tor_gettimeofday(&now);
|
||||||
format_iso_time_nospace_usec(tbuf, &now);
|
format_iso_time_nospace_usec(tbuf, &now);
|
||||||
send_control_event(EVENT_STREAM_BANDWIDTH_USED,
|
send_control_event(EVENT_STREAM_BANDWIDTH_USED,
|
||||||
"650 STREAM_BW "U64_FORMAT" %lu %lu %s\r\n",
|
"650 STREAM_BW %"PRIu64" %lu %lu %s\r\n",
|
||||||
U64_PRINTF_ARG(edge_conn->base_.global_identifier),
|
(edge_conn->base_.global_identifier),
|
||||||
(unsigned long)edge_conn->n_read,
|
(unsigned long)edge_conn->n_read,
|
||||||
(unsigned long)edge_conn->n_written,
|
(unsigned long)edge_conn->n_written,
|
||||||
tbuf);
|
tbuf);
|
||||||
@ -6022,8 +6022,8 @@ control_event_stream_bandwidth_used(void)
|
|||||||
tor_gettimeofday(&now);
|
tor_gettimeofday(&now);
|
||||||
format_iso_time_nospace_usec(tbuf, &now);
|
format_iso_time_nospace_usec(tbuf, &now);
|
||||||
send_control_event(EVENT_STREAM_BANDWIDTH_USED,
|
send_control_event(EVENT_STREAM_BANDWIDTH_USED,
|
||||||
"650 STREAM_BW "U64_FORMAT" %lu %lu %s\r\n",
|
"650 STREAM_BW %"PRIu64" %lu %lu %s\r\n",
|
||||||
U64_PRINTF_ARG(edge_conn->base_.global_identifier),
|
(edge_conn->base_.global_identifier),
|
||||||
(unsigned long)edge_conn->n_read,
|
(unsigned long)edge_conn->n_read,
|
||||||
(unsigned long)edge_conn->n_written,
|
(unsigned long)edge_conn->n_written,
|
||||||
tbuf);
|
tbuf);
|
||||||
@ -6101,9 +6101,9 @@ control_event_conn_bandwidth(connection_t *conn)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
send_control_event(EVENT_CONN_BW,
|
send_control_event(EVENT_CONN_BW,
|
||||||
"650 CONN_BW ID="U64_FORMAT" TYPE=%s "
|
"650 CONN_BW ID=%"PRIu64" TYPE=%s "
|
||||||
"READ=%lu WRITTEN=%lu\r\n",
|
"READ=%lu WRITTEN=%lu\r\n",
|
||||||
U64_PRINTF_ARG(conn->global_identifier),
|
(conn->global_identifier),
|
||||||
conn_type_str,
|
conn_type_str,
|
||||||
(unsigned long)conn->n_read_conn_bw,
|
(unsigned long)conn->n_read_conn_bw,
|
||||||
(unsigned long)conn->n_written_conn_bw);
|
(unsigned long)conn->n_written_conn_bw);
|
||||||
@ -6168,9 +6168,9 @@ append_cell_stats_by_command(smartlist_t *event_parts, const char *key,
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i <= CELL_COMMAND_MAX_; i++) {
|
for (i = 0; i <= CELL_COMMAND_MAX_; i++) {
|
||||||
if (include_if_non_zero[i] > 0) {
|
if (include_if_non_zero[i] > 0) {
|
||||||
smartlist_add_asprintf(key_value_strings, "%s:"U64_FORMAT,
|
smartlist_add_asprintf(key_value_strings, "%s:%"PRIu64,
|
||||||
cell_command_to_string(i),
|
cell_command_to_string(i),
|
||||||
U64_PRINTF_ARG(number_to_include[i]));
|
(number_to_include[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (smartlist_len(key_value_strings) > 0) {
|
if (smartlist_len(key_value_strings) > 0) {
|
||||||
@ -6197,8 +6197,8 @@ format_cell_stats(char **event_string, circuit_t *circ,
|
|||||||
or_circuit_t *or_circ = TO_OR_CIRCUIT(circ);
|
or_circuit_t *or_circ = TO_OR_CIRCUIT(circ);
|
||||||
smartlist_add_asprintf(event_parts, "InboundQueue=%lu",
|
smartlist_add_asprintf(event_parts, "InboundQueue=%lu",
|
||||||
(unsigned long)or_circ->p_circ_id);
|
(unsigned long)or_circ->p_circ_id);
|
||||||
smartlist_add_asprintf(event_parts, "InboundConn="U64_FORMAT,
|
smartlist_add_asprintf(event_parts, "InboundConn=%"PRIu64,
|
||||||
U64_PRINTF_ARG(or_circ->p_chan->global_identifier));
|
(or_circ->p_chan->global_identifier));
|
||||||
append_cell_stats_by_command(event_parts, "InboundAdded",
|
append_cell_stats_by_command(event_parts, "InboundAdded",
|
||||||
cell_stats->added_cells_appward,
|
cell_stats->added_cells_appward,
|
||||||
cell_stats->added_cells_appward);
|
cell_stats->added_cells_appward);
|
||||||
@ -6212,8 +6212,8 @@ format_cell_stats(char **event_string, circuit_t *circ,
|
|||||||
if (circ->n_chan) {
|
if (circ->n_chan) {
|
||||||
smartlist_add_asprintf(event_parts, "OutboundQueue=%lu",
|
smartlist_add_asprintf(event_parts, "OutboundQueue=%lu",
|
||||||
(unsigned long)circ->n_circ_id);
|
(unsigned long)circ->n_circ_id);
|
||||||
smartlist_add_asprintf(event_parts, "OutboundConn="U64_FORMAT,
|
smartlist_add_asprintf(event_parts, "OutboundConn=%"PRIu64,
|
||||||
U64_PRINTF_ARG(circ->n_chan->global_identifier));
|
(circ->n_chan->global_identifier));
|
||||||
append_cell_stats_by_command(event_parts, "OutboundAdded",
|
append_cell_stats_by_command(event_parts, "OutboundAdded",
|
||||||
cell_stats->added_cells_exitward,
|
cell_stats->added_cells_exitward,
|
||||||
cell_stats->added_cells_exitward);
|
cell_stats->added_cells_exitward);
|
||||||
|
@ -283,7 +283,7 @@ get_overhead_for_onionskins(uint32_t *usec_out, double *frac_out,
|
|||||||
onionskins_usec_internal[onionskin_type];
|
onionskins_usec_internal[onionskin_type];
|
||||||
|
|
||||||
*usec_out = (uint32_t)(overhead / onionskins_n_processed[onionskin_type]);
|
*usec_out = (uint32_t)(overhead / onionskins_n_processed[onionskin_type]);
|
||||||
*frac_out = U64_TO_DBL(overhead) / onionskins_usec_internal[onionskin_type];
|
*frac_out = ((double)overhead) / onionskins_usec_internal[onionskin_type];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1001,13 +1001,13 @@ networkstatus_check_weights(int64_t Wgg, int64_t Wgd, int64_t Wmg,
|
|||||||
out:
|
out:
|
||||||
if (berr) {
|
if (berr) {
|
||||||
log_info(LD_DIR,
|
log_info(LD_DIR,
|
||||||
"Bw weight mismatch %d. G="I64_FORMAT" M="I64_FORMAT
|
"Bw weight mismatch %d. G=%"PRId64" M=%"PRId64
|
||||||
" E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT
|
" E=%"PRId64" D=%"PRId64" T=%"PRId64
|
||||||
" Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d"
|
" Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d"
|
||||||
" Wgd=%d Wgg=%d Wme=%d Wmg=%d",
|
" Wgd=%d Wgg=%d Wme=%d Wmg=%d",
|
||||||
berr,
|
berr,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
(int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee,
|
(int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee,
|
||||||
(int)Wgd, (int)Wgg, (int)Wme, (int)Wmg);
|
(int)Wgd, (int)Wgg, (int)Wme, (int)Wmg);
|
||||||
}
|
}
|
||||||
@ -1033,10 +1033,10 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
|
|||||||
|
|
||||||
if (G <= 0 || M <= 0 || E <= 0 || D <= 0) {
|
if (G <= 0 || M <= 0 || E <= 0 || D <= 0) {
|
||||||
log_warn(LD_DIR, "Consensus with empty bandwidth: "
|
log_warn(LD_DIR, "Consensus with empty bandwidth: "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64
|
||||||
" D="I64_FORMAT" T="I64_FORMAT,
|
" D=%"PRId64" T=%"PRId64,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T));
|
(D), (T));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1067,13 +1067,13 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
|
|||||||
|
|
||||||
if (berr) {
|
if (berr) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weights error %d for %s v10. G="I64_FORMAT" M="I64_FORMAT
|
"Bw Weights error %d for %s v10. G=%"PRId64" M=%"PRId64
|
||||||
" E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT
|
" E=%"PRId64" D=%"PRId64" T=%"PRId64
|
||||||
" Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d"
|
" Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d"
|
||||||
" Wgd=%d Wgg=%d Wme=%d Wmg=%d weight_scale=%d",
|
" Wgd=%d Wgg=%d Wme=%d Wmg=%d weight_scale=%d",
|
||||||
berr, casename,
|
berr, casename,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
(int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee,
|
(int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee,
|
||||||
(int)Wgd, (int)Wgg, (int)Wme, (int)Wmg, (int)weight_scale);
|
(int)Wgd, (int)Wgg, (int)Wme, (int)Wmg, (int)weight_scale);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1138,13 +1138,13 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
|
|||||||
if (berr != BW_WEIGHTS_NO_ERROR &&
|
if (berr != BW_WEIGHTS_NO_ERROR &&
|
||||||
berr != BW_WEIGHTS_BALANCE_MID_ERROR) {
|
berr != BW_WEIGHTS_BALANCE_MID_ERROR) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weights error %d for %s v10. G="I64_FORMAT" M="I64_FORMAT
|
"Bw Weights error %d for %s v10. G=%"PRId64" M=%"PRId64
|
||||||
" E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT
|
" E=%"PRId64" D=%"PRId64" T=%"PRId64
|
||||||
" Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d"
|
" Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d"
|
||||||
" Wgd=%d Wgg=%d Wme=%d Wmg=%d weight_scale=%d",
|
" Wgd=%d Wgg=%d Wme=%d Wmg=%d weight_scale=%d",
|
||||||
berr, casename,
|
berr, casename,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
(int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee,
|
(int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee,
|
||||||
(int)Wgd, (int)Wgg, (int)Wme, (int)Wmg, (int)weight_scale);
|
(int)Wgd, (int)Wgg, (int)Wme, (int)Wmg, (int)weight_scale);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1155,10 +1155,10 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
|
|||||||
// Case 3: Exactly one of Guard or Exit is scarce
|
// Case 3: Exactly one of Guard or Exit is scarce
|
||||||
if (!(3*E < T || 3*G < T) || !(3*G >= T || 3*E >= T)) {
|
if (!(3*E < T || 3*G < T) || !(3*G >= T || 3*E >= T)) {
|
||||||
log_warn(LD_BUG,
|
log_warn(LD_BUG,
|
||||||
"Bw-Weights Case 3 v10 but with G="I64_FORMAT" M="
|
"Bw-Weights Case 3 v10 but with G=%"PRId64" M="
|
||||||
I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT,
|
"%"PRId64" E=%"PRId64" D=%"PRId64" T=%"PRId64,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T));
|
(D), (T));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (3*(S+D) < T) { // Subcase a: S+D < T/3
|
if (3*(S+D) < T) { // Subcase a: S+D < T/3
|
||||||
@ -1210,13 +1210,13 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
|
|||||||
}
|
}
|
||||||
if (berr) {
|
if (berr) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weights error %d for %s v10. G="I64_FORMAT" M="I64_FORMAT
|
"Bw Weights error %d for %s v10. G=%"PRId64" M=%"PRId64
|
||||||
" E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT
|
" E=%"PRId64" D=%"PRId64" T=%"PRId64
|
||||||
" Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d"
|
" Wmd=%d Wme=%d Wmg=%d Wed=%d Wee=%d"
|
||||||
" Wgd=%d Wgg=%d Wme=%d Wmg=%d weight_scale=%d",
|
" Wgd=%d Wgg=%d Wme=%d Wmg=%d weight_scale=%d",
|
||||||
berr, casename,
|
berr, casename,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
(int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee,
|
(int)Wmd, (int)Wme, (int)Wmg, (int)Wed, (int)Wee,
|
||||||
(int)Wgd, (int)Wgg, (int)Wme, (int)Wmg, (int)weight_scale);
|
(int)Wgd, (int)Wgg, (int)Wme, (int)Wmg, (int)weight_scale);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1250,11 +1250,11 @@ networkstatus_compute_bw_weights_v10(smartlist_t *chunks, int64_t G,
|
|||||||
(int)weight_scale, (int)Wmd, (int)Wme, (int)Wmg, (int)weight_scale);
|
(int)weight_scale, (int)Wmd, (int)Wme, (int)Wmg, (int)weight_scale);
|
||||||
|
|
||||||
log_notice(LD_CIRC, "Computed bandwidth weights for %s with v10: "
|
log_notice(LD_CIRC, "Computed bandwidth weights for %s with v10: "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT,
|
" T=%"PRId64,
|
||||||
casename,
|
casename,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T));
|
(D), (T));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1758,9 +1758,9 @@ networkstatus_compute_consensus(smartlist_t *votes,
|
|||||||
|
|
||||||
/* Build the flag indexes. Note that no vote can have more than 64 members
|
/* Build the flag indexes. Note that no vote can have more than 64 members
|
||||||
* for known_flags, so no value will be greater than 63, so it's safe to
|
* for known_flags, so no value will be greater than 63, so it's safe to
|
||||||
* do U64_LITERAL(1) << index on these values. But note also that
|
* do UINT64_C(1) << index on these values. But note also that
|
||||||
* named_flag and unnamed_flag are initialized to -1, so we need to check
|
* named_flag and unnamed_flag are initialized to -1, so we need to check
|
||||||
* that they're actually set before doing U64_LITERAL(1) << index with
|
* that they're actually set before doing UINT64_C(1) << index with
|
||||||
* them.*/
|
* them.*/
|
||||||
SMARTLIST_FOREACH_BEGIN(votes, networkstatus_t *, v) {
|
SMARTLIST_FOREACH_BEGIN(votes, networkstatus_t *, v) {
|
||||||
flag_map[v_sl_idx] = tor_calloc(smartlist_len(v->known_flags),
|
flag_map[v_sl_idx] = tor_calloc(smartlist_len(v->known_flags),
|
||||||
@ -1789,7 +1789,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
|
|||||||
uint64_t nf;
|
uint64_t nf;
|
||||||
if (named_flag[v_sl_idx]<0)
|
if (named_flag[v_sl_idx]<0)
|
||||||
continue;
|
continue;
|
||||||
nf = U64_LITERAL(1) << named_flag[v_sl_idx];
|
nf = UINT64_C(1) << named_flag[v_sl_idx];
|
||||||
SMARTLIST_FOREACH_BEGIN(v->routerstatus_list,
|
SMARTLIST_FOREACH_BEGIN(v->routerstatus_list,
|
||||||
vote_routerstatus_t *, rs) {
|
vote_routerstatus_t *, rs) {
|
||||||
|
|
||||||
@ -1814,7 +1814,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
|
|||||||
uint64_t uf;
|
uint64_t uf;
|
||||||
if (unnamed_flag[v_sl_idx]<0)
|
if (unnamed_flag[v_sl_idx]<0)
|
||||||
continue;
|
continue;
|
||||||
uf = U64_LITERAL(1) << unnamed_flag[v_sl_idx];
|
uf = UINT64_C(1) << unnamed_flag[v_sl_idx];
|
||||||
SMARTLIST_FOREACH_BEGIN(v->routerstatus_list,
|
SMARTLIST_FOREACH_BEGIN(v->routerstatus_list,
|
||||||
vote_routerstatus_t *, rs) {
|
vote_routerstatus_t *, rs) {
|
||||||
if ((rs->flags & uf) != 0) {
|
if ((rs->flags & uf) != 0) {
|
||||||
@ -1904,11 +1904,11 @@ networkstatus_compute_consensus(smartlist_t *votes,
|
|||||||
|
|
||||||
/* Tally up all the flags. */
|
/* Tally up all the flags. */
|
||||||
for (int flag = 0; flag < n_voter_flags[voter_idx]; ++flag) {
|
for (int flag = 0; flag < n_voter_flags[voter_idx]; ++flag) {
|
||||||
if (rs->flags & (U64_LITERAL(1) << flag))
|
if (rs->flags & (UINT64_C(1) << flag))
|
||||||
++flag_counts[flag_map[voter_idx][flag]];
|
++flag_counts[flag_map[voter_idx][flag]];
|
||||||
}
|
}
|
||||||
if (named_flag[voter_idx] >= 0 &&
|
if (named_flag[voter_idx] >= 0 &&
|
||||||
(rs->flags & (U64_LITERAL(1) << named_flag[voter_idx]))) {
|
(rs->flags & (UINT64_C(1) << named_flag[voter_idx]))) {
|
||||||
if (chosen_name && strcmp(chosen_name, rs->status.nickname)) {
|
if (chosen_name && strcmp(chosen_name, rs->status.nickname)) {
|
||||||
log_notice(LD_DIR, "Conflict on naming for router: %s vs %s",
|
log_notice(LD_DIR, "Conflict on naming for router: %s vs %s",
|
||||||
chosen_name, rs->status.nickname);
|
chosen_name, rs->status.nickname);
|
||||||
|
@ -1941,12 +1941,12 @@ directory_send_command(dir_connection_t *conn,
|
|||||||
|
|
||||||
log_debug(LD_DIR,
|
log_debug(LD_DIR,
|
||||||
"Sent request to directory server '%s:%d': "
|
"Sent request to directory server '%s:%d': "
|
||||||
"(purpose: %d, request size: " U64_FORMAT ", "
|
"(purpose: %d, request size: %"TOR_PRIuSZ", "
|
||||||
"payload size: " U64_FORMAT ")",
|
"payload size: %"TOR_PRIuSZ")",
|
||||||
conn->base_.address, conn->base_.port,
|
conn->base_.address, conn->base_.port,
|
||||||
conn->base_.purpose,
|
conn->base_.purpose,
|
||||||
U64_PRINTF_ARG(total_request_len),
|
(total_request_len),
|
||||||
U64_PRINTF_ARG(payload ? payload_len : 0));
|
(payload ? payload_len : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Parse an HTTP request string <b>headers</b> of the form
|
/** Parse an HTTP request string <b>headers</b> of the form
|
||||||
@ -2432,14 +2432,14 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
|
|||||||
|
|
||||||
tor_log(LOG_DEBUG, LD_DIR,
|
tor_log(LOG_DEBUG, LD_DIR,
|
||||||
"Received response from directory server '%s:%d': %d %s "
|
"Received response from directory server '%s:%d': %d %s "
|
||||||
"(purpose: %d, response size: " U64_FORMAT
|
"(purpose: %d, response size: %"TOR_PRIuSZ
|
||||||
#ifdef MEASUREMENTS_21206
|
#ifdef MEASUREMENTS_21206
|
||||||
", data cells received: %d, data cells sent: %d"
|
", data cells received: %d, data cells sent: %d"
|
||||||
#endif
|
#endif
|
||||||
", compression: %d)",
|
", compression: %d)",
|
||||||
conn->base_.address, conn->base_.port, status_code,
|
conn->base_.address, conn->base_.port, status_code,
|
||||||
escaped(reason), conn->base_.purpose,
|
escaped(reason), conn->base_.purpose,
|
||||||
U64_PRINTF_ARG(received_bytes),
|
(received_bytes),
|
||||||
#ifdef MEASUREMENTS_21206
|
#ifdef MEASUREMENTS_21206
|
||||||
conn->data_cells_received, conn->data_cells_sent,
|
conn->data_cells_received, conn->data_cells_sent,
|
||||||
#endif
|
#endif
|
||||||
|
@ -1040,12 +1040,12 @@ geoip_get_transport_history(void)
|
|||||||
void *transport_count_ptr = strmap_get(transport_counts, transport_name);
|
void *transport_count_ptr = strmap_get(transport_counts, transport_name);
|
||||||
uintptr_t transport_count = (uintptr_t) transport_count_ptr;
|
uintptr_t transport_count = (uintptr_t) transport_count_ptr;
|
||||||
|
|
||||||
log_debug(LD_GENERAL, "We got "U64_FORMAT" clients with transport '%s'.",
|
log_debug(LD_GENERAL, "We got %"PRIu64" clients with transport '%s'.",
|
||||||
U64_PRINTF_ARG((uint64_t)transport_count), transport_name);
|
((uint64_t)transport_count), transport_name);
|
||||||
|
|
||||||
smartlist_add_asprintf(string_chunks, "%s="U64_FORMAT,
|
smartlist_add_asprintf(string_chunks, "%s=%"PRIu64,
|
||||||
transport_name,
|
transport_name,
|
||||||
U64_PRINTF_ARG(round_uint64_to_next_multiple_of(
|
(round_uint64_to_next_multiple_of(
|
||||||
(uint64_t)transport_count,
|
(uint64_t)transport_count,
|
||||||
granularity)));
|
granularity)));
|
||||||
} SMARTLIST_FOREACH_END(transport_name);
|
} SMARTLIST_FOREACH_END(transport_name);
|
||||||
|
@ -767,13 +767,13 @@ read_bandwidth_usage(void)
|
|||||||
"Successfully read bandwidth accounting info from state written at %s "
|
"Successfully read bandwidth accounting info from state written at %s "
|
||||||
"for interval starting at %s. We have been active for %lu seconds in "
|
"for interval starting at %s. We have been active for %lu seconds in "
|
||||||
"this interval. At the start of the interval, we expected to use "
|
"this interval. At the start of the interval, we expected to use "
|
||||||
"about %lu KB per second. ("U64_FORMAT" bytes read so far, "
|
"about %lu KB per second. (%"PRIu64" bytes read so far, "
|
||||||
U64_FORMAT" bytes written so far)",
|
"%"PRIu64" bytes written so far)",
|
||||||
tbuf1, tbuf2,
|
tbuf1, tbuf2,
|
||||||
(unsigned long)n_seconds_active_in_interval,
|
(unsigned long)n_seconds_active_in_interval,
|
||||||
(unsigned long)(expected_bandwidth_usage*1024/60),
|
(unsigned long)(expected_bandwidth_usage*1024/60),
|
||||||
U64_PRINTF_ARG(n_bytes_read_in_interval),
|
(n_bytes_read_in_interval),
|
||||||
U64_PRINTF_ARG(n_bytes_written_in_interval));
|
(n_bytes_written_in_interval));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -805,7 +805,7 @@ hibernate_soft_limit_reached(void)
|
|||||||
* - We have used up 95% of our bytes.
|
* - We have used up 95% of our bytes.
|
||||||
* - We have less than 500MB of bytes left.
|
* - We have less than 500MB of bytes left.
|
||||||
*/
|
*/
|
||||||
uint64_t soft_limit = DBL_TO_U64(U64_TO_DBL(acct_max) * SOFT_LIM_PCT);
|
uint64_t soft_limit = (uint64_t) (acct_max * SOFT_LIM_PCT);
|
||||||
if (acct_max > SOFT_LIM_BYTES && acct_max - SOFT_LIM_BYTES > soft_limit) {
|
if (acct_max > SOFT_LIM_BYTES && acct_max - SOFT_LIM_BYTES > soft_limit) {
|
||||||
soft_limit = acct_max - SOFT_LIM_BYTES;
|
soft_limit = acct_max - SOFT_LIM_BYTES;
|
||||||
}
|
}
|
||||||
@ -1140,9 +1140,9 @@ getinfo_helper_accounting(control_connection_t *conn,
|
|||||||
*answer = tor_strdup(hibernate_state_to_string(hibernate_state));
|
*answer = tor_strdup(hibernate_state_to_string(hibernate_state));
|
||||||
tor_strlower(*answer);
|
tor_strlower(*answer);
|
||||||
} else if (!strcmp(question, "accounting/bytes")) {
|
} else if (!strcmp(question, "accounting/bytes")) {
|
||||||
tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
|
tor_asprintf(answer, "%"PRIu64" %"PRIu64,
|
||||||
U64_PRINTF_ARG(n_bytes_read_in_interval),
|
(n_bytes_read_in_interval),
|
||||||
U64_PRINTF_ARG(n_bytes_written_in_interval));
|
(n_bytes_written_in_interval));
|
||||||
} else if (!strcmp(question, "accounting/bytes-left")) {
|
} else if (!strcmp(question, "accounting/bytes-left")) {
|
||||||
uint64_t limit = get_options()->AccountingMax;
|
uint64_t limit = get_options()->AccountingMax;
|
||||||
if (get_options()->AccountingRule == ACCT_SUM) {
|
if (get_options()->AccountingRule == ACCT_SUM) {
|
||||||
@ -1150,28 +1150,28 @@ getinfo_helper_accounting(control_connection_t *conn,
|
|||||||
uint64_t total_bytes = get_accounting_bytes();
|
uint64_t total_bytes = get_accounting_bytes();
|
||||||
if (total_bytes < limit)
|
if (total_bytes < limit)
|
||||||
total_left = limit - total_bytes;
|
total_left = limit - total_bytes;
|
||||||
tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
|
tor_asprintf(answer, "%"PRIu64" %"PRIu64,
|
||||||
U64_PRINTF_ARG(total_left), U64_PRINTF_ARG(total_left));
|
(total_left), (total_left));
|
||||||
} else if (get_options()->AccountingRule == ACCT_IN) {
|
} else if (get_options()->AccountingRule == ACCT_IN) {
|
||||||
uint64_t read_left = 0;
|
uint64_t read_left = 0;
|
||||||
if (n_bytes_read_in_interval < limit)
|
if (n_bytes_read_in_interval < limit)
|
||||||
read_left = limit - n_bytes_read_in_interval;
|
read_left = limit - n_bytes_read_in_interval;
|
||||||
tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
|
tor_asprintf(answer, "%"PRIu64" %"PRIu64,
|
||||||
U64_PRINTF_ARG(read_left), U64_PRINTF_ARG(limit));
|
(read_left), (limit));
|
||||||
} else if (get_options()->AccountingRule == ACCT_OUT) {
|
} else if (get_options()->AccountingRule == ACCT_OUT) {
|
||||||
uint64_t write_left = 0;
|
uint64_t write_left = 0;
|
||||||
if (n_bytes_written_in_interval < limit)
|
if (n_bytes_written_in_interval < limit)
|
||||||
write_left = limit - n_bytes_written_in_interval;
|
write_left = limit - n_bytes_written_in_interval;
|
||||||
tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
|
tor_asprintf(answer, "%"PRIu64" %"PRIu64,
|
||||||
U64_PRINTF_ARG(limit), U64_PRINTF_ARG(write_left));
|
(limit), (write_left));
|
||||||
} else {
|
} else {
|
||||||
uint64_t read_left = 0, write_left = 0;
|
uint64_t read_left = 0, write_left = 0;
|
||||||
if (n_bytes_read_in_interval < limit)
|
if (n_bytes_read_in_interval < limit)
|
||||||
read_left = limit - n_bytes_read_in_interval;
|
read_left = limit - n_bytes_read_in_interval;
|
||||||
if (n_bytes_written_in_interval < limit)
|
if (n_bytes_written_in_interval < limit)
|
||||||
write_left = limit - n_bytes_written_in_interval;
|
write_left = limit - n_bytes_written_in_interval;
|
||||||
tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
|
tor_asprintf(answer, "%"PRIu64" %"PRIu64,
|
||||||
U64_PRINTF_ARG(read_left), U64_PRINTF_ARG(write_left));
|
(read_left), (write_left));
|
||||||
}
|
}
|
||||||
} else if (!strcmp(question, "accounting/interval-start")) {
|
} else if (!strcmp(question, "accounting/interval-start")) {
|
||||||
*answer = tor_malloc(ISO_TIME_LEN+1);
|
*answer = tor_malloc(ISO_TIME_LEN+1);
|
||||||
|
@ -1280,9 +1280,9 @@ run_connection_housekeeping(int i, time_t now)
|
|||||||
} else if (!have_any_circuits &&
|
} else if (!have_any_circuits &&
|
||||||
now - or_conn->idle_timeout >=
|
now - or_conn->idle_timeout >=
|
||||||
chan->timestamp_last_had_circuits) {
|
chan->timestamp_last_had_circuits) {
|
||||||
log_info(LD_OR,"Expiring non-used OR connection "U64_FORMAT" to fd %d "
|
log_info(LD_OR,"Expiring non-used OR connection %"PRIu64" to fd %d "
|
||||||
"(%s:%d) [no circuits for %d; timeout %d; %scanonical].",
|
"(%s:%d) [no circuits for %d; timeout %d; %scanonical].",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
(int)conn->s, conn->address, conn->port,
|
(int)conn->s, conn->address, conn->port,
|
||||||
(int)(now - chan->timestamp_last_had_circuits),
|
(int)(now - chan->timestamp_last_had_circuits),
|
||||||
or_conn->idle_timeout,
|
or_conn->idle_timeout,
|
||||||
@ -3208,8 +3208,8 @@ static void
|
|||||||
dumpmemusage(int severity)
|
dumpmemusage(int severity)
|
||||||
{
|
{
|
||||||
connection_dump_buffer_mem_stats(severity);
|
connection_dump_buffer_mem_stats(severity);
|
||||||
tor_log(severity, LD_GENERAL, "In rephist: "U64_FORMAT" used by %d Tors.",
|
tor_log(severity, LD_GENERAL, "In rephist: %"PRIu64" used by %d Tors.",
|
||||||
U64_PRINTF_ARG(rephist_total_alloc), rephist_total_num);
|
(rephist_total_alloc), rephist_total_num);
|
||||||
dump_routerlist_mem_usage(severity);
|
dump_routerlist_mem_usage(severity);
|
||||||
dump_cell_pool_usage(severity);
|
dump_cell_pool_usage(severity);
|
||||||
dump_dns_mem_usage(severity);
|
dump_dns_mem_usage(severity);
|
||||||
@ -3272,28 +3272,28 @@ dumpstats(int severity)
|
|||||||
channel_listener_dumpstats(severity);
|
channel_listener_dumpstats(severity);
|
||||||
|
|
||||||
tor_log(severity, LD_NET,
|
tor_log(severity, LD_NET,
|
||||||
"Cells processed: "U64_FORMAT" padding\n"
|
"Cells processed: %"PRIu64" padding\n"
|
||||||
" "U64_FORMAT" create\n"
|
" %"PRIu64" create\n"
|
||||||
" "U64_FORMAT" created\n"
|
" %"PRIu64" created\n"
|
||||||
" "U64_FORMAT" relay\n"
|
" %"PRIu64" relay\n"
|
||||||
" ("U64_FORMAT" relayed)\n"
|
" (%"PRIu64" relayed)\n"
|
||||||
" ("U64_FORMAT" delivered)\n"
|
" (%"PRIu64" delivered)\n"
|
||||||
" "U64_FORMAT" destroy",
|
" %"PRIu64" destroy",
|
||||||
U64_PRINTF_ARG(stats_n_padding_cells_processed),
|
(stats_n_padding_cells_processed),
|
||||||
U64_PRINTF_ARG(stats_n_create_cells_processed),
|
(stats_n_create_cells_processed),
|
||||||
U64_PRINTF_ARG(stats_n_created_cells_processed),
|
(stats_n_created_cells_processed),
|
||||||
U64_PRINTF_ARG(stats_n_relay_cells_processed),
|
(stats_n_relay_cells_processed),
|
||||||
U64_PRINTF_ARG(stats_n_relay_cells_relayed),
|
(stats_n_relay_cells_relayed),
|
||||||
U64_PRINTF_ARG(stats_n_relay_cells_delivered),
|
(stats_n_relay_cells_delivered),
|
||||||
U64_PRINTF_ARG(stats_n_destroy_cells_processed));
|
(stats_n_destroy_cells_processed));
|
||||||
if (stats_n_data_cells_packaged)
|
if (stats_n_data_cells_packaged)
|
||||||
tor_log(severity,LD_NET,"Average packaged cell fullness: %2.3f%%",
|
tor_log(severity,LD_NET,"Average packaged cell fullness: %2.3f%%",
|
||||||
100*(U64_TO_DBL(stats_n_data_bytes_packaged) /
|
100*(((double)stats_n_data_bytes_packaged) /
|
||||||
U64_TO_DBL(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE)) );
|
((double)stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE)) );
|
||||||
if (stats_n_data_cells_received)
|
if (stats_n_data_cells_received)
|
||||||
tor_log(severity,LD_NET,"Average delivered cell fullness: %2.3f%%",
|
tor_log(severity,LD_NET,"Average delivered cell fullness: %2.3f%%",
|
||||||
100*(U64_TO_DBL(stats_n_data_bytes_received) /
|
100*(((double)stats_n_data_bytes_received) /
|
||||||
U64_TO_DBL(stats_n_data_cells_received*RELAY_PAYLOAD_SIZE)) );
|
((double)stats_n_data_cells_received*RELAY_PAYLOAD_SIZE)) );
|
||||||
|
|
||||||
cpuworker_log_onionskin_overhead(severity, ONION_HANDSHAKE_TYPE_TAP, "TAP");
|
cpuworker_log_onionskin_overhead(severity, ONION_HANDSHAKE_TYPE_TAP, "TAP");
|
||||||
cpuworker_log_onionskin_overhead(severity, ONION_HANDSHAKE_TYPE_NTOR,"ntor");
|
cpuworker_log_onionskin_overhead(severity, ONION_HANDSHAKE_TYPE_NTOR,"ntor");
|
||||||
@ -3305,13 +3305,13 @@ dumpstats(int severity)
|
|||||||
|
|
||||||
if (elapsed) {
|
if (elapsed) {
|
||||||
tor_log(severity, LD_NET,
|
tor_log(severity, LD_NET,
|
||||||
"Average bandwidth: "U64_FORMAT"/%d = %d bytes/sec reading",
|
"Average bandwidth: %"PRIu64"/%d = %d bytes/sec reading",
|
||||||
U64_PRINTF_ARG(stats_n_bytes_read),
|
(stats_n_bytes_read),
|
||||||
(int)elapsed,
|
(int)elapsed,
|
||||||
(int) (stats_n_bytes_read/elapsed));
|
(int) (stats_n_bytes_read/elapsed));
|
||||||
tor_log(severity, LD_NET,
|
tor_log(severity, LD_NET,
|
||||||
"Average bandwidth: "U64_FORMAT"/%d = %d bytes/sec writing",
|
"Average bandwidth: %"PRIu64"/%d = %d bytes/sec writing",
|
||||||
U64_PRINTF_ARG(stats_n_bytes_written),
|
(stats_n_bytes_written),
|
||||||
(int)elapsed,
|
(int)elapsed,
|
||||||
(int) (stats_n_bytes_written/elapsed));
|
(int) (stats_n_bytes_written/elapsed));
|
||||||
}
|
}
|
||||||
|
@ -721,9 +721,9 @@ microdesc_cache_rebuild(microdesc_cache_t *cache, int force)
|
|||||||
off_real = tor_fd_getpos(fd);
|
off_real = tor_fd_getpos(fd);
|
||||||
if (off_real != off) {
|
if (off_real != off) {
|
||||||
log_warn(LD_BUG, "Discontinuity in position in microdescriptor cache."
|
log_warn(LD_BUG, "Discontinuity in position in microdescriptor cache."
|
||||||
"By my count, I'm at "I64_FORMAT
|
"By my count, I'm at %"PRId64
|
||||||
", but I should be at "I64_FORMAT,
|
", but I should be at %"PRId64,
|
||||||
I64_PRINTF_ARG(off), I64_PRINTF_ARG(off_real));
|
(off), (off_real));
|
||||||
if (off_real >= 0)
|
if (off_real >= 0)
|
||||||
off = off_real;
|
off = off_real;
|
||||||
}
|
}
|
||||||
|
@ -2410,7 +2410,7 @@ policy_summary_item_split(policy_summary_item_t* old, uint16_t new_starts)
|
|||||||
#define REJECT_CUTOFF_SCALE_IPV4 (0)
|
#define REJECT_CUTOFF_SCALE_IPV4 (0)
|
||||||
/* Ports are rejected in an IPv4 summary if they are rejected in more than two
|
/* Ports are rejected in an IPv4 summary if they are rejected in more than two
|
||||||
* IPv4 /8 address blocks */
|
* IPv4 /8 address blocks */
|
||||||
#define REJECT_CUTOFF_COUNT_IPV4 (U64_LITERAL(1) << \
|
#define REJECT_CUTOFF_COUNT_IPV4 (UINT64_C(1) << \
|
||||||
(IPV4_BITS - REJECT_CUTOFF_SCALE_IPV4 - 7))
|
(IPV4_BITS - REJECT_CUTOFF_SCALE_IPV4 - 7))
|
||||||
|
|
||||||
#define IPV6_BITS (128)
|
#define IPV6_BITS (128)
|
||||||
@ -2422,7 +2422,7 @@ policy_summary_item_split(policy_summary_item_t* old, uint16_t new_starts)
|
|||||||
* some scattered smaller blocks) have been allocated to the RIRs.
|
* some scattered smaller blocks) have been allocated to the RIRs.
|
||||||
* Network providers are typically allocated one or more IPv6 /32s.
|
* Network providers are typically allocated one or more IPv6 /32s.
|
||||||
*/
|
*/
|
||||||
#define REJECT_CUTOFF_COUNT_IPV6 (U64_LITERAL(1) << \
|
#define REJECT_CUTOFF_COUNT_IPV6 (UINT64_C(1) << \
|
||||||
(IPV6_BITS - REJECT_CUTOFF_SCALE_IPV6 - 16))
|
(IPV6_BITS - REJECT_CUTOFF_SCALE_IPV6 - 16))
|
||||||
|
|
||||||
/** Split an exit policy summary so that prt_min and prt_max
|
/** Split an exit policy summary so that prt_min and prt_max
|
||||||
@ -2517,7 +2517,7 @@ policy_summary_reject(smartlist_t *summary,
|
|||||||
* in the range. */
|
* in the range. */
|
||||||
count = UINT64_MAX;
|
count = UINT64_MAX;
|
||||||
} else {
|
} else {
|
||||||
count = (U64_LITERAL(1) << (addrbits - scale - maskbits));
|
count = (UINT64_C(1) << (addrbits - scale - maskbits));
|
||||||
}
|
}
|
||||||
tor_assert_nonfatal_once(count > 0);
|
tor_assert_nonfatal_once(count > 0);
|
||||||
while (i < smartlist_len(summary) &&
|
while (i < smartlist_len(summary) &&
|
||||||
|
132
src/or/rephist.c
132
src/or/rephist.c
@ -1223,9 +1223,9 @@ rep_hist_bandwidth_assess(void)
|
|||||||
r = find_largest_max(read_array);
|
r = find_largest_max(read_array);
|
||||||
w = find_largest_max(write_array);
|
w = find_largest_max(write_array);
|
||||||
if (r>w)
|
if (r>w)
|
||||||
return (int)(U64_TO_DBL(w)/NUM_SECS_ROLLING_MEASURE);
|
return (int)(((double)w)/NUM_SECS_ROLLING_MEASURE);
|
||||||
else
|
else
|
||||||
return (int)(U64_TO_DBL(r)/NUM_SECS_ROLLING_MEASURE);
|
return (int)(((double)r)/NUM_SECS_ROLLING_MEASURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Print the bandwidth history of b (either [dir-]read_array or
|
/** Print the bandwidth history of b (either [dir-]read_array or
|
||||||
@ -1271,9 +1271,9 @@ rep_hist_fill_bandwidth_history(char *buf, size_t len, const bw_array_t *b)
|
|||||||
total = cutoff;
|
total = cutoff;
|
||||||
|
|
||||||
if (n==(b->num_maxes_set-1))
|
if (n==(b->num_maxes_set-1))
|
||||||
tor_snprintf(cp, len-(cp-buf), U64_FORMAT, U64_PRINTF_ARG(total));
|
tor_snprintf(cp, len-(cp-buf), "%"PRIu64, (total));
|
||||||
else
|
else
|
||||||
tor_snprintf(cp, len-(cp-buf), U64_FORMAT",", U64_PRINTF_ARG(total));
|
tor_snprintf(cp, len-(cp-buf), "%"PRIu64",", (total));
|
||||||
cp += strlen(cp);
|
cp += strlen(cp);
|
||||||
}
|
}
|
||||||
return cp-buf;
|
return cp-buf;
|
||||||
@ -1385,17 +1385,17 @@ rep_hist_update_bwhist_state_section(or_state_t *state,
|
|||||||
for (j=0; j < b->num_maxes_set; ++j,++i) {
|
for (j=0; j < b->num_maxes_set; ++j,++i) {
|
||||||
if (i >= NUM_TOTALS)
|
if (i >= NUM_TOTALS)
|
||||||
i = 0;
|
i = 0;
|
||||||
smartlist_add_asprintf(*s_values, U64_FORMAT,
|
smartlist_add_asprintf(*s_values, "%"PRIu64,
|
||||||
U64_PRINTF_ARG(b->totals[i] & ~0x3ff));
|
(b->totals[i] & ~0x3ff));
|
||||||
maxval = b->maxima[i] / NUM_SECS_ROLLING_MEASURE;
|
maxval = b->maxima[i] / NUM_SECS_ROLLING_MEASURE;
|
||||||
smartlist_add_asprintf(*s_maxima, U64_FORMAT,
|
smartlist_add_asprintf(*s_maxima, "%"PRIu64,
|
||||||
U64_PRINTF_ARG(maxval & ~0x3ff));
|
(maxval & ~0x3ff));
|
||||||
}
|
}
|
||||||
smartlist_add_asprintf(*s_values, U64_FORMAT,
|
smartlist_add_asprintf(*s_values, "%"PRIu64,
|
||||||
U64_PRINTF_ARG(b->total_in_period & ~0x3ff));
|
(b->total_in_period & ~0x3ff));
|
||||||
maxval = b->max_total / NUM_SECS_ROLLING_MEASURE;
|
maxval = b->max_total / NUM_SECS_ROLLING_MEASURE;
|
||||||
smartlist_add_asprintf(*s_maxima, U64_FORMAT,
|
smartlist_add_asprintf(*s_maxima, "%"PRIu64,
|
||||||
U64_PRINTF_ARG(maxval & ~0x3ff));
|
(maxval & ~0x3ff));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update <b>state</b> with the newest bandwidth history. Done before
|
/** Update <b>state</b> with the newest bandwidth history. Done before
|
||||||
@ -1969,8 +1969,8 @@ rep_hist_format_exit_stats(time_t now)
|
|||||||
exit_bytes_written[cur_port],
|
exit_bytes_written[cur_port],
|
||||||
EXIT_STATS_ROUND_UP_BYTES);
|
EXIT_STATS_ROUND_UP_BYTES);
|
||||||
num /= 1024;
|
num /= 1024;
|
||||||
smartlist_add_asprintf(written_strings, "%d="U64_FORMAT,
|
smartlist_add_asprintf(written_strings, "%d=%"PRIu64,
|
||||||
cur_port, U64_PRINTF_ARG(num));
|
cur_port, (num));
|
||||||
other_written -= exit_bytes_written[cur_port];
|
other_written -= exit_bytes_written[cur_port];
|
||||||
}
|
}
|
||||||
if (exit_bytes_read[cur_port] > 0) {
|
if (exit_bytes_read[cur_port] > 0) {
|
||||||
@ -1978,8 +1978,8 @@ rep_hist_format_exit_stats(time_t now)
|
|||||||
exit_bytes_read[cur_port],
|
exit_bytes_read[cur_port],
|
||||||
EXIT_STATS_ROUND_UP_BYTES);
|
EXIT_STATS_ROUND_UP_BYTES);
|
||||||
num /= 1024;
|
num /= 1024;
|
||||||
smartlist_add_asprintf(read_strings, "%d="U64_FORMAT,
|
smartlist_add_asprintf(read_strings, "%d=%"PRIu64,
|
||||||
cur_port, U64_PRINTF_ARG(num));
|
cur_port, (num));
|
||||||
other_read -= exit_bytes_read[cur_port];
|
other_read -= exit_bytes_read[cur_port];
|
||||||
}
|
}
|
||||||
if (exit_streams[cur_port] > 0) {
|
if (exit_streams[cur_port] > 0) {
|
||||||
@ -1995,13 +1995,13 @@ rep_hist_format_exit_stats(time_t now)
|
|||||||
other_written = round_uint64_to_next_multiple_of(other_written,
|
other_written = round_uint64_to_next_multiple_of(other_written,
|
||||||
EXIT_STATS_ROUND_UP_BYTES);
|
EXIT_STATS_ROUND_UP_BYTES);
|
||||||
other_written /= 1024;
|
other_written /= 1024;
|
||||||
smartlist_add_asprintf(written_strings, "other="U64_FORMAT,
|
smartlist_add_asprintf(written_strings, "other=%"PRIu64,
|
||||||
U64_PRINTF_ARG(other_written));
|
(other_written));
|
||||||
other_read = round_uint64_to_next_multiple_of(other_read,
|
other_read = round_uint64_to_next_multiple_of(other_read,
|
||||||
EXIT_STATS_ROUND_UP_BYTES);
|
EXIT_STATS_ROUND_UP_BYTES);
|
||||||
other_read /= 1024;
|
other_read /= 1024;
|
||||||
smartlist_add_asprintf(read_strings, "other="U64_FORMAT,
|
smartlist_add_asprintf(read_strings, "other=%"PRIu64,
|
||||||
U64_PRINTF_ARG(other_read));
|
(other_read));
|
||||||
other_streams = round_uint32_to_next_multiple_of(other_streams,
|
other_streams = round_uint32_to_next_multiple_of(other_streams,
|
||||||
EXIT_STATS_ROUND_UP_STREAMS);
|
EXIT_STATS_ROUND_UP_STREAMS);
|
||||||
smartlist_add_asprintf(streams_strings, "other=%u", other_streams);
|
smartlist_add_asprintf(streams_strings, "other=%u", other_streams);
|
||||||
@ -2261,8 +2261,8 @@ rep_hist_format_buffer_stats(time_t now)
|
|||||||
time_in_queue_strings = smartlist_new();
|
time_in_queue_strings = smartlist_new();
|
||||||
for (i = 0; i < SHARES; i++) {
|
for (i = 0; i < SHARES; i++) {
|
||||||
smartlist_add_asprintf(processed_cells_strings,
|
smartlist_add_asprintf(processed_cells_strings,
|
||||||
U64_FORMAT, !circs_in_share[i] ? 0 :
|
"%"PRIu64, !circs_in_share[i] ? 0 :
|
||||||
U64_PRINTF_ARG(processed_cells[i] /
|
(processed_cells[i] /
|
||||||
circs_in_share[i]));
|
circs_in_share[i]));
|
||||||
}
|
}
|
||||||
for (i = 0; i < SHARES; i++) {
|
for (i = 0; i < SHARES; i++) {
|
||||||
@ -2929,14 +2929,14 @@ rep_hist_format_hs_stats(time_t now)
|
|||||||
|
|
||||||
format_iso_time(t, now);
|
format_iso_time(t, now);
|
||||||
tor_asprintf(&hs_stats_string, "hidserv-stats-end %s (%d s)\n"
|
tor_asprintf(&hs_stats_string, "hidserv-stats-end %s (%d s)\n"
|
||||||
"hidserv-rend-relayed-cells "I64_FORMAT" delta_f=%d "
|
"hidserv-rend-relayed-cells %"PRId64" delta_f=%d "
|
||||||
"epsilon=%.2f bin_size=%d\n"
|
"epsilon=%.2f bin_size=%d\n"
|
||||||
"hidserv-dir-onions-seen "I64_FORMAT" delta_f=%d "
|
"hidserv-dir-onions-seen %"PRId64" delta_f=%d "
|
||||||
"epsilon=%.2f bin_size=%d\n",
|
"epsilon=%.2f bin_size=%d\n",
|
||||||
t, (unsigned) (now - start_of_hs_stats_interval),
|
t, (unsigned) (now - start_of_hs_stats_interval),
|
||||||
I64_PRINTF_ARG(obfuscated_cells_seen), REND_CELLS_DELTA_F,
|
(obfuscated_cells_seen), REND_CELLS_DELTA_F,
|
||||||
REND_CELLS_EPSILON, REND_CELLS_BIN_SIZE,
|
REND_CELLS_EPSILON, REND_CELLS_BIN_SIZE,
|
||||||
I64_PRINTF_ARG(obfuscated_onions_seen),
|
(obfuscated_onions_seen),
|
||||||
ONIONS_SEEN_DELTA_F,
|
ONIONS_SEEN_DELTA_F,
|
||||||
ONIONS_SEEN_EPSILON, ONIONS_SEEN_BIN_SIZE);
|
ONIONS_SEEN_EPSILON, ONIONS_SEEN_BIN_SIZE);
|
||||||
|
|
||||||
@ -3122,33 +3122,33 @@ rep_hist_get_padding_count_lines(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tor_asprintf(&result, "padding-counts %s (%d s)"
|
tor_asprintf(&result, "padding-counts %s (%d s)"
|
||||||
" bin-size="U64_FORMAT
|
" bin-size=%"PRIu64
|
||||||
" write-drop="U64_FORMAT
|
" write-drop=%"PRIu64
|
||||||
" write-pad="U64_FORMAT
|
" write-pad=%"PRIu64
|
||||||
" write-total="U64_FORMAT
|
" write-total=%"PRIu64
|
||||||
" read-drop="U64_FORMAT
|
" read-drop=%"PRIu64
|
||||||
" read-pad="U64_FORMAT
|
" read-pad=%"PRIu64
|
||||||
" read-total="U64_FORMAT
|
" read-total=%"PRIu64
|
||||||
" enabled-read-pad="U64_FORMAT
|
" enabled-read-pad=%"PRIu64
|
||||||
" enabled-read-total="U64_FORMAT
|
" enabled-read-total=%"PRIu64
|
||||||
" enabled-write-pad="U64_FORMAT
|
" enabled-write-pad=%"PRIu64
|
||||||
" enabled-write-total="U64_FORMAT
|
" enabled-write-total=%"PRIu64
|
||||||
" max-chanpad-timers="U64_FORMAT
|
" max-chanpad-timers=%"PRIu64
|
||||||
"\n",
|
"\n",
|
||||||
padding_published.first_published_at,
|
padding_published.first_published_at,
|
||||||
REPHIST_CELL_PADDING_COUNTS_INTERVAL,
|
REPHIST_CELL_PADDING_COUNTS_INTERVAL,
|
||||||
U64_PRINTF_ARG(ROUND_CELL_COUNTS_TO),
|
(uint64_t)ROUND_CELL_COUNTS_TO,
|
||||||
U64_PRINTF_ARG(padding_published.write_drop_cell_count),
|
(padding_published.write_drop_cell_count),
|
||||||
U64_PRINTF_ARG(padding_published.write_pad_cell_count),
|
(padding_published.write_pad_cell_count),
|
||||||
U64_PRINTF_ARG(padding_published.write_cell_count),
|
(padding_published.write_cell_count),
|
||||||
U64_PRINTF_ARG(padding_published.read_drop_cell_count),
|
(padding_published.read_drop_cell_count),
|
||||||
U64_PRINTF_ARG(padding_published.read_pad_cell_count),
|
(padding_published.read_pad_cell_count),
|
||||||
U64_PRINTF_ARG(padding_published.read_cell_count),
|
(padding_published.read_cell_count),
|
||||||
U64_PRINTF_ARG(padding_published.enabled_read_pad_cell_count),
|
(padding_published.enabled_read_pad_cell_count),
|
||||||
U64_PRINTF_ARG(padding_published.enabled_read_cell_count),
|
(padding_published.enabled_read_cell_count),
|
||||||
U64_PRINTF_ARG(padding_published.enabled_write_pad_cell_count),
|
(padding_published.enabled_write_pad_cell_count),
|
||||||
U64_PRINTF_ARG(padding_published.enabled_write_cell_count),
|
(padding_published.enabled_write_cell_count),
|
||||||
U64_PRINTF_ARG(padding_published.maximum_chanpad_timers)
|
(padding_published.maximum_chanpad_timers)
|
||||||
);
|
);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -3162,22 +3162,22 @@ rep_hist_log_link_protocol_counts(void)
|
|||||||
{
|
{
|
||||||
log_notice(LD_HEARTBEAT,
|
log_notice(LD_HEARTBEAT,
|
||||||
"Since startup, we have initiated "
|
"Since startup, we have initiated "
|
||||||
U64_FORMAT" v1 connections, "
|
"%"PRIu64" v1 connections, "
|
||||||
U64_FORMAT" v2 connections, "
|
"%"PRIu64" v2 connections, "
|
||||||
U64_FORMAT" v3 connections, and "
|
"%"PRIu64" v3 connections, and "
|
||||||
U64_FORMAT" v4 connections; and received "
|
"%"PRIu64" v4 connections; and received "
|
||||||
U64_FORMAT" v1 connections, "
|
"%"PRIu64" v1 connections, "
|
||||||
U64_FORMAT" v2 connections, "
|
"%"PRIu64" v2 connections, "
|
||||||
U64_FORMAT" v3 connections, and "
|
"%"PRIu64" v3 connections, and "
|
||||||
U64_FORMAT" v4 connections.",
|
"%"PRIu64" v4 connections.",
|
||||||
U64_PRINTF_ARG(link_proto_count[1][1]),
|
(link_proto_count[1][1]),
|
||||||
U64_PRINTF_ARG(link_proto_count[2][1]),
|
(link_proto_count[2][1]),
|
||||||
U64_PRINTF_ARG(link_proto_count[3][1]),
|
(link_proto_count[3][1]),
|
||||||
U64_PRINTF_ARG(link_proto_count[4][1]),
|
(link_proto_count[4][1]),
|
||||||
U64_PRINTF_ARG(link_proto_count[1][0]),
|
(link_proto_count[1][0]),
|
||||||
U64_PRINTF_ARG(link_proto_count[2][0]),
|
(link_proto_count[2][0]),
|
||||||
U64_PRINTF_ARG(link_proto_count[3][0]),
|
(link_proto_count[3][0]),
|
||||||
U64_PRINTF_ARG(link_proto_count[4][0]));
|
(link_proto_count[4][0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Free all storage held by the OR/link history caches, by the
|
/** Free all storage held by the OR/link history caches, by the
|
||||||
|
@ -1359,10 +1359,10 @@ router_should_be_dirserver(const or_options_t *options, int dir_port)
|
|||||||
interval_length = 1;
|
interval_length = 1;
|
||||||
}
|
}
|
||||||
log_info(LD_GENERAL, "Calculating whether to advertise %s: effective "
|
log_info(LD_GENERAL, "Calculating whether to advertise %s: effective "
|
||||||
"bwrate: %u, AccountingMax: "U64_FORMAT", "
|
"bwrate: %u, AccountingMax: %"PRIu64", "
|
||||||
"accounting interval length %d",
|
"accounting interval length %d",
|
||||||
dir_port ? "dirport" : "begindir",
|
dir_port ? "dirport" : "begindir",
|
||||||
effective_bw, U64_PRINTF_ARG(options->AccountingMax),
|
effective_bw, (options->AccountingMax),
|
||||||
interval_length);
|
interval_length);
|
||||||
|
|
||||||
acc_bytes = options->AccountingMax;
|
acc_bytes = options->AccountingMax;
|
||||||
|
@ -3353,10 +3353,10 @@ dump_routerlist_mem_usage(int severity)
|
|||||||
olddescs += sd->signed_descriptor_len);
|
olddescs += sd->signed_descriptor_len);
|
||||||
|
|
||||||
tor_log(severity, LD_DIR,
|
tor_log(severity, LD_DIR,
|
||||||
"In %d live descriptors: "U64_FORMAT" bytes. "
|
"In %d live descriptors: %"PRIu64" bytes. "
|
||||||
"In %d old descriptors: "U64_FORMAT" bytes.",
|
"In %d old descriptors: %"PRIu64" bytes.",
|
||||||
smartlist_len(routerlist->routers), U64_PRINTF_ARG(livedescs),
|
smartlist_len(routerlist->routers), (livedescs),
|
||||||
smartlist_len(routerlist->old_routers), U64_PRINTF_ARG(olddescs));
|
smartlist_len(routerlist->old_routers), (olddescs));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Debugging helper: If <b>idx</b> is nonnegative, assert that <b>ri</b> is
|
/** Debugging helper: If <b>idx</b> is nonnegative, assert that <b>ri</b> is
|
||||||
|
@ -879,8 +879,8 @@ dump_desc_populate_fifo_from_directory(const char *dirname)
|
|||||||
/* Log some stats */
|
/* Log some stats */
|
||||||
log_info(LD_DIR,
|
log_info(LD_DIR,
|
||||||
"Reloaded unparseable descriptor dump FIFO with %d dump(s) "
|
"Reloaded unparseable descriptor dump FIFO with %d dump(s) "
|
||||||
"totaling " U64_FORMAT " bytes",
|
"totaling %"PRIu64 " bytes",
|
||||||
smartlist_len(descs_dumped), U64_PRINTF_ARG(len_descs_dumped));
|
smartlist_len(descs_dumped), (len_descs_dumped));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the original list */
|
/* Free the original list */
|
||||||
@ -2729,7 +2729,7 @@ routerstatus_parse_entry_from_string(memarea_t *area,
|
|||||||
for (i=0; i < tok->n_args; ++i) {
|
for (i=0; i < tok->n_args; ++i) {
|
||||||
int p = smartlist_string_pos(vote->known_flags, tok->args[i]);
|
int p = smartlist_string_pos(vote->known_flags, tok->args[i]);
|
||||||
if (p >= 0) {
|
if (p >= 0) {
|
||||||
vote_rs->flags |= (U64_LITERAL(1)<<p);
|
vote_rs->flags |= (UINT64_C(1)<<p);
|
||||||
} else {
|
} else {
|
||||||
log_warn(LD_DIR, "Flags line had a flag %s not listed in known_flags.",
|
log_warn(LD_DIR, "Flags line had a flag %s not listed in known_flags.",
|
||||||
escaped(tok->args[i]));
|
escaped(tok->args[i]));
|
||||||
@ -2952,8 +2952,8 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
// We use > 1 as the check for these because they are computed as integers.
|
// We use > 1 as the check for these because they are computed as integers.
|
||||||
// Sometimes there are rounding errors.
|
// Sometimes there are rounding errors.
|
||||||
if (fabs(Wmm - weight_scale) > 1) {
|
if (fabs(Wmm - weight_scale) > 1) {
|
||||||
log_warn(LD_BUG, "Wmm=%f != "I64_FORMAT,
|
log_warn(LD_BUG, "Wmm=%f != %"PRId64,
|
||||||
Wmm, I64_PRINTF_ARG(weight_scale));
|
Wmm, (weight_scale));
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2973,20 +2973,20 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fabs(Wgg + Wmg - weight_scale) > 0.001*weight_scale) {
|
if (fabs(Wgg + Wmg - weight_scale) > 0.001*weight_scale) {
|
||||||
log_warn(LD_BUG, "Wgg=%f != "I64_FORMAT" - Wmg=%f", Wgg,
|
log_warn(LD_BUG, "Wgg=%f != %"PRId64" - Wmg=%f", Wgg,
|
||||||
I64_PRINTF_ARG(weight_scale), Wmg);
|
(weight_scale), Wmg);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fabs(Wee + Wme - weight_scale) > 0.001*weight_scale) {
|
if (fabs(Wee + Wme - weight_scale) > 0.001*weight_scale) {
|
||||||
log_warn(LD_BUG, "Wee=%f != "I64_FORMAT" - Wme=%f", Wee,
|
log_warn(LD_BUG, "Wee=%f != %"PRId64" - Wme=%f", Wee,
|
||||||
I64_PRINTF_ARG(weight_scale), Wme);
|
(weight_scale), Wme);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fabs(Wgd + Wmd + Wed - weight_scale) > 0.001*weight_scale) {
|
if (fabs(Wgd + Wmd + Wed - weight_scale) > 0.001*weight_scale) {
|
||||||
log_warn(LD_BUG, "Wgd=%f + Wmd=%f + Wed=%f != "I64_FORMAT,
|
log_warn(LD_BUG, "Wgd=%f + Wmd=%f + Wed=%f != %"PRId64,
|
||||||
Wgd, Wmd, Wed, I64_PRINTF_ARG(weight_scale));
|
Wgd, Wmd, Wed, (weight_scale));
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3044,36 +3044,36 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) {
|
if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: Etotal %f != Mtotal %f. "
|
"Bw Weight Failure for %s: Etotal %f != Mtotal %f. "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Etotal, Mtotal,
|
casename, Etotal, Mtotal,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
|
if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
|
"Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Etotal, Gtotal,
|
casename, Etotal, Gtotal,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) {
|
if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: Mtotal %f != Gtotal %f. "
|
"Bw Weight Failure for %s: Mtotal %f != Gtotal %f. "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Mtotal, Gtotal,
|
casename, Mtotal, Gtotal,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
@ -3100,12 +3100,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
if (Rtotal > Stotal) {
|
if (Rtotal > Stotal) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: Rtotal %f > Stotal %f. "
|
"Bw Weight Failure for %s: Rtotal %f > Stotal %f. "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Rtotal, Stotal,
|
casename, Rtotal, Stotal,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
@ -3113,12 +3113,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
if (3*Rtotal > T) {
|
if (3*Rtotal > T) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: 3*Rtotal %f > T "
|
"Bw Weight Failure for %s: 3*Rtotal %f > T "
|
||||||
I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT
|
"%"PRId64". G=%"PRId64" M=%"PRId64" E=%"PRId64
|
||||||
" D="I64_FORMAT" T="I64_FORMAT". "
|
" D=%"PRId64" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Rtotal*3, I64_PRINTF_ARG(T),
|
casename, Rtotal*3, (T),
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
@ -3126,12 +3126,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
if (3*Stotal > T) {
|
if (3*Stotal > T) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: 3*Stotal %f > T "
|
"Bw Weight Failure for %s: 3*Stotal %f > T "
|
||||||
I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT
|
"%"PRId64". G=%"PRId64" M=%"PRId64" E=%"PRId64
|
||||||
" D="I64_FORMAT" T="I64_FORMAT". "
|
" D=%"PRId64" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Stotal*3, I64_PRINTF_ARG(T),
|
casename, Stotal*3, (T),
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
@ -3139,13 +3139,13 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
if (3*Mtotal < T) {
|
if (3*Mtotal < T) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: 3*Mtotal %f < T "
|
"Bw Weight Failure for %s: 3*Mtotal %f < T "
|
||||||
I64_FORMAT". "
|
"%"PRId64". "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Mtotal*3, I64_PRINTF_ARG(T),
|
casename, Mtotal*3, (T),
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
@ -3158,36 +3158,36 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) {
|
if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: Etotal %f != Mtotal %f. "
|
"Bw Weight Failure for %s: Etotal %f != Mtotal %f. "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Etotal, Mtotal,
|
casename, Etotal, Mtotal,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
|
if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
|
"Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Etotal, Gtotal,
|
casename, Etotal, Gtotal,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) {
|
if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: Mtotal %f != Gtotal %f. "
|
"Bw Weight Failure for %s: Mtotal %f != Gtotal %f. "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Mtotal, Gtotal,
|
casename, Mtotal, Gtotal,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
@ -3195,12 +3195,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
|
if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
|
"Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Etotal, Gtotal,
|
casename, Etotal, Gtotal,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
@ -3225,12 +3225,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
if (3*Stotal > T) {
|
if (3*Stotal > T) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: 3*Stotal %f > T "
|
"Bw Weight Failure for %s: 3*Stotal %f > T "
|
||||||
I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT
|
"%"PRId64". G=%"PRId64" M=%"PRId64" E=%"PRId64
|
||||||
" D="I64_FORMAT" T="I64_FORMAT". "
|
" D=%"PRId64" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Stotal*3, I64_PRINTF_ARG(T),
|
casename, Stotal*3, (T),
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
@ -3238,12 +3238,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
if (fabs(NStotal-Mtotal) > 0.01*MAX(NStotal,Mtotal)) {
|
if (fabs(NStotal-Mtotal) > 0.01*MAX(NStotal,Mtotal)) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: NStotal %f != Mtotal %f. "
|
"Bw Weight Failure for %s: NStotal %f != Mtotal %f. "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, NStotal, Mtotal,
|
casename, NStotal, Mtotal,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
@ -3252,12 +3252,12 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
if (3*NStotal < T) {
|
if (3*NStotal < T) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: 3*NStotal %f < T "
|
"Bw Weight Failure for %s: 3*NStotal %f < T "
|
||||||
I64_FORMAT". G="I64_FORMAT" M="I64_FORMAT
|
"%"PRId64". G=%"PRId64" M=%"PRId64
|
||||||
" E="I64_FORMAT" D="I64_FORMAT" T="I64_FORMAT". "
|
" E=%"PRId64" D=%"PRId64" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, NStotal*3, I64_PRINTF_ARG(T),
|
casename, NStotal*3, (T),
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
@ -3267,36 +3267,36 @@ networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method)
|
|||||||
if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) {
|
if (fabs(Etotal-Mtotal) > 0.01*MAX(Etotal,Mtotal)) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: Etotal %f != Mtotal %f. "
|
"Bw Weight Failure for %s: Etotal %f != Mtotal %f. "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Etotal, Mtotal,
|
casename, Etotal, Mtotal,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
|
if (fabs(Etotal-Gtotal) > 0.01*MAX(Etotal,Gtotal)) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
|
"Bw Weight Failure for %s: Etotal %f != Gtotal %f. "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Etotal, Gtotal,
|
casename, Etotal, Gtotal,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) {
|
if (fabs(Gtotal-Mtotal) > 0.01*MAX(Gtotal,Mtotal)) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Bw Weight Failure for %s: Mtotal %f != Gtotal %f. "
|
"Bw Weight Failure for %s: Mtotal %f != Gtotal %f. "
|
||||||
"G="I64_FORMAT" M="I64_FORMAT" E="I64_FORMAT" D="I64_FORMAT
|
"G=%"PRId64" M=%"PRId64" E=%"PRId64" D=%"PRId64
|
||||||
" T="I64_FORMAT". "
|
" T=%"PRId64". "
|
||||||
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
"Wgg=%f Wgd=%f Wmg=%f Wme=%f Wmd=%f Wee=%f Wed=%f",
|
||||||
casename, Mtotal, Gtotal,
|
casename, Mtotal, Gtotal,
|
||||||
I64_PRINTF_ARG(G), I64_PRINTF_ARG(M), I64_PRINTF_ARG(E),
|
(G), (M), (E),
|
||||||
I64_PRINTF_ARG(D), I64_PRINTF_ARG(T),
|
(D), (T),
|
||||||
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
Wgg, Wgd, Wmg, Wme, Wmd, Wee, Wed);
|
||||||
valid = 0;
|
valid = 0;
|
||||||
}
|
}
|
||||||
|
@ -72,9 +72,9 @@ vanilla_scheduler_run(void)
|
|||||||
n_cells = channel_num_cells_writeable(chan);
|
n_cells = channel_num_cells_writeable(chan);
|
||||||
if (n_cells > 0) {
|
if (n_cells > 0) {
|
||||||
log_debug(LD_SCHED,
|
log_debug(LD_SCHED,
|
||||||
"Scheduler saw pending channel " U64_FORMAT " at %p with "
|
"Scheduler saw pending channel %"PRIu64 " at %p with "
|
||||||
"%d cells writeable",
|
"%d cells writeable",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan, n_cells);
|
(chan->global_identifier), chan, n_cells);
|
||||||
|
|
||||||
flushed = 0;
|
flushed = 0;
|
||||||
while (flushed < n_cells) {
|
while (flushed < n_cells) {
|
||||||
@ -97,9 +97,9 @@ vanilla_scheduler_run(void)
|
|||||||
if (!to_readd) to_readd = smartlist_new();
|
if (!to_readd) to_readd = smartlist_new();
|
||||||
smartlist_add(to_readd, chan);
|
smartlist_add(to_readd, chan);
|
||||||
log_debug(LD_SCHED,
|
log_debug(LD_SCHED,
|
||||||
"Channel " U64_FORMAT " at %p "
|
"Channel %"PRIu64 " at %p "
|
||||||
"is still pending",
|
"is still pending",
|
||||||
U64_PRINTF_ARG(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
chan);
|
chan);
|
||||||
} else {
|
} else {
|
||||||
/* It's waiting to be able to write more */
|
/* It's waiting to be able to write more */
|
||||||
@ -125,14 +125,14 @@ vanilla_scheduler_run(void)
|
|||||||
|
|
||||||
log_debug(LD_SCHED,
|
log_debug(LD_SCHED,
|
||||||
"Scheduler flushed %d cells onto pending channel "
|
"Scheduler flushed %d cells onto pending channel "
|
||||||
U64_FORMAT " at %p",
|
"%"PRIu64 " at %p",
|
||||||
(int)flushed, U64_PRINTF_ARG(chan->global_identifier),
|
(int)flushed, (chan->global_identifier),
|
||||||
chan);
|
chan);
|
||||||
} else {
|
} else {
|
||||||
log_info(LD_SCHED,
|
log_info(LD_SCHED,
|
||||||
"Scheduler saw pending channel " U64_FORMAT " at %p with "
|
"Scheduler saw pending channel %"PRIu64 " at %p with "
|
||||||
"no cells writeable",
|
"no cells writeable",
|
||||||
U64_PRINTF_ARG(chan->global_identifier), chan);
|
(chan->global_identifier), chan);
|
||||||
/* Put it back to WAITING_TO_WRITE */
|
/* Put it back to WAITING_TO_WRITE */
|
||||||
scheduler_set_channel_state(chan, SCHED_CHAN_WAITING_TO_WRITE);
|
scheduler_set_channel_state(chan, SCHED_CHAN_WAITING_TO_WRITE);
|
||||||
}
|
}
|
||||||
|
@ -79,12 +79,12 @@ bytes_to_usage(uint64_t bytes)
|
|||||||
char *bw_string = NULL;
|
char *bw_string = NULL;
|
||||||
|
|
||||||
if (bytes < (1<<20)) { /* Less than a megabyte. */
|
if (bytes < (1<<20)) { /* Less than a megabyte. */
|
||||||
tor_asprintf(&bw_string, U64_FORMAT" kB", U64_PRINTF_ARG(bytes>>10));
|
tor_asprintf(&bw_string, "%"PRIu64" kB", (bytes>>10));
|
||||||
} else if (bytes < (1<<30)) { /* Megabytes. Let's add some precision. */
|
} else if (bytes < (1<<30)) { /* Megabytes. Let's add some precision. */
|
||||||
double bw = U64_TO_DBL(bytes);
|
double bw = ((double)bytes);
|
||||||
tor_asprintf(&bw_string, "%.2f MB", bw/(1<<20));
|
tor_asprintf(&bw_string, "%.2f MB", bw/(1<<20));
|
||||||
} else { /* Gigabytes. */
|
} else { /* Gigabytes. */
|
||||||
double bw = U64_TO_DBL(bytes);
|
double bw = ((double)bytes);
|
||||||
tor_asprintf(&bw_string, "%.2f GB", bw/(1<<30));
|
tor_asprintf(&bw_string, "%.2f GB", bw/(1<<30));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,8 +152,8 @@ log_heartbeat(time_t now)
|
|||||||
double fullness_pct = 100;
|
double fullness_pct = 100;
|
||||||
if (stats_n_data_cells_packaged && !hibernating) {
|
if (stats_n_data_cells_packaged && !hibernating) {
|
||||||
fullness_pct =
|
fullness_pct =
|
||||||
100*(U64_TO_DBL(stats_n_data_bytes_packaged) /
|
100*(((double)stats_n_data_bytes_packaged) /
|
||||||
U64_TO_DBL(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE));
|
((double)stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE));
|
||||||
}
|
}
|
||||||
const double overhead_pct = ( r - 1.0 ) * 100.0;
|
const double overhead_pct = ( r - 1.0 ) * 100.0;
|
||||||
|
|
||||||
@ -190,12 +190,12 @@ log_heartbeat(time_t now)
|
|||||||
const uint64_t main_loop_idle_count = get_main_loop_idle_count();
|
const uint64_t main_loop_idle_count = get_main_loop_idle_count();
|
||||||
|
|
||||||
log_fn(LOG_NOTICE, LD_HEARTBEAT, "Main event loop statistics: "
|
log_fn(LOG_NOTICE, LD_HEARTBEAT, "Main event loop statistics: "
|
||||||
U64_FORMAT " successful returns, "
|
"%"PRIu64 " successful returns, "
|
||||||
U64_FORMAT " erroneous returns, and "
|
"%"PRIu64 " erroneous returns, and "
|
||||||
U64_FORMAT " idle returns.",
|
"%"PRIu64 " idle returns.",
|
||||||
U64_PRINTF_ARG(main_loop_success_count),
|
(main_loop_success_count),
|
||||||
U64_PRINTF_ARG(main_loop_error_count),
|
(main_loop_error_count),
|
||||||
U64_PRINTF_ARG(main_loop_idle_count));
|
(main_loop_idle_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Now, if we are an HS service, log some stats about our usage */
|
/** Now, if we are an HS service, log some stats about our usage */
|
||||||
|
@ -169,7 +169,7 @@ tor_cert_parse(const uint8_t *encoded, const size_t len)
|
|||||||
|
|
||||||
memcpy(cert->signed_key.pubkey, parsed->certified_key, 32);
|
memcpy(cert->signed_key.pubkey, parsed->certified_key, 32);
|
||||||
int64_t valid_until_64 = ((int64_t)parsed->exp_field) * 3600;
|
int64_t valid_until_64 = ((int64_t)parsed->exp_field) * 3600;
|
||||||
#if SIZEOF_TIME_T < SIZEOF_INT64_T
|
#if SIZEOF_TIME_T < 8
|
||||||
if (valid_until_64 > TIME_MAX)
|
if (valid_until_64 > TIME_MAX)
|
||||||
valid_until_64 = TIME_MAX - 1;
|
valid_until_64 = TIME_MAX - 1;
|
||||||
#endif
|
#endif
|
||||||
|
@ -104,8 +104,8 @@ main(int argc, char **argv)
|
|||||||
total_square_difference += diff*diff;
|
total_square_difference += diff*diff;
|
||||||
}
|
}
|
||||||
const int64_t mean_diff = total_difference / n_active_timers;
|
const int64_t mean_diff = total_difference / n_active_timers;
|
||||||
printf("mean difference: "I64_FORMAT" usec\n",
|
printf("mean difference: %"PRId64" usec\n",
|
||||||
I64_PRINTF_ARG(mean_diff));
|
(mean_diff));
|
||||||
|
|
||||||
const double mean_sq = ((double)total_square_difference)/ n_active_timers;
|
const double mean_sq = ((double)total_square_difference)/ n_active_timers;
|
||||||
const double sq_mean = mean_diff * mean_diff;
|
const double sq_mean = mean_diff * mean_diff;
|
||||||
|
@ -50,28 +50,20 @@
|
|||||||
tt_double_op((a), OP_LE, (b)); \
|
tt_double_op((a), OP_LE, (b)); \
|
||||||
STMT_END
|
STMT_END
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define U64_PRINTF_TYPE uint64_t
|
|
||||||
#define I64_PRINTF_TYPE int64_t
|
|
||||||
#else
|
|
||||||
#define U64_PRINTF_TYPE unsigned long long
|
|
||||||
#define I64_PRINTF_TYPE long long
|
|
||||||
#endif /* defined(_MSC_VER) */
|
|
||||||
|
|
||||||
#define tt_size_op(a,op,b) \
|
#define tt_size_op(a,op,b) \
|
||||||
tt_assert_test_fmt_type(a,b,#a" "#op" "#b,size_t,(val1_ op val2_), \
|
tt_assert_test_fmt_type(a,b,#a" "#op" "#b,size_t,(val1_ op val2_), \
|
||||||
U64_PRINTF_TYPE, U64_FORMAT, \
|
size_t, "%"TOR_PRIuSZ, \
|
||||||
{print_ = (U64_PRINTF_TYPE) value_;}, {}, TT_EXIT_TEST_FUNCTION)
|
{print_ = (size_t) value_;}, {}, TT_EXIT_TEST_FUNCTION)
|
||||||
|
|
||||||
#define tt_u64_op(a,op,b) \
|
#define tt_u64_op(a,op,b) \
|
||||||
tt_assert_test_fmt_type(a,b,#a" "#op" "#b,uint64_t,(val1_ op val2_), \
|
tt_assert_test_fmt_type(a,b,#a" "#op" "#b,uint64_t,(val1_ op val2_), \
|
||||||
U64_PRINTF_TYPE, U64_FORMAT, \
|
uint64_t, "%"PRIu64, \
|
||||||
{print_ = (U64_PRINTF_TYPE) value_;}, {}, TT_EXIT_TEST_FUNCTION)
|
{print_ = (uint64_t) value_;}, {}, TT_EXIT_TEST_FUNCTION)
|
||||||
|
|
||||||
#define tt_i64_op(a,op,b) \
|
#define tt_i64_op(a,op,b) \
|
||||||
tt_assert_test_fmt_type(a,b,#a" "#op" "#b,int64_t,(val1_ op val2_), \
|
tt_assert_test_fmt_type(a,b,#a" "#op" "#b,int64_t,(val1_ op val2_), \
|
||||||
I64_PRINTF_TYPE, I64_FORMAT, \
|
int64_t, "%"PRId64, \
|
||||||
{print_ = (I64_PRINTF_TYPE) value_;}, {}, TT_EXIT_TEST_FUNCTION)
|
{print_ = (int64_t) value_;}, {}, TT_EXIT_TEST_FUNCTION)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declare that the test is done, even though no tt___op() calls were made.
|
* Declare that the test is done, even though no tt___op() calls were made.
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
// an imaginary time, in timestamp units. Chosen so it will roll over.
|
// an imaginary time, in timestamp units. Chosen so it will roll over.
|
||||||
static const uint32_t START_TS = UINT32_MAX-10;
|
static const uint32_t START_TS = UINT32_MAX-10;
|
||||||
static const int32_t KB = 1024;
|
static const int32_t KB = 1024;
|
||||||
static const uint32_t GB = (U64_LITERAL(1) << 30);
|
static const uint32_t GB = (UINT64_C(1) << 30);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_bwmgt_token_buf_init(void *arg)
|
test_bwmgt_token_buf_init(void *arg)
|
||||||
|
@ -554,7 +554,7 @@ test_channel_outbound_cell(void *arg)
|
|||||||
/* Set the test time to be mocked, since this test assumes that no
|
/* Set the test time to be mocked, since this test assumes that no
|
||||||
* time will pass, ewma values will not need to be re-scaled, and so on */
|
* time will pass, ewma values will not need to be re-scaled, and so on */
|
||||||
monotime_enable_test_mocking();
|
monotime_enable_test_mocking();
|
||||||
monotime_set_mock_time_nsec(U64_LITERAL(1000000000) * 12345);
|
monotime_set_mock_time_nsec(UINT64_C(1000000000) * 12345);
|
||||||
|
|
||||||
cmux_ewma_set_options(NULL,NULL);
|
cmux_ewma_set_options(NULL,NULL);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ static void
|
|||||||
test_cmux_compute_ticks(void *arg)
|
test_cmux_compute_ticks(void *arg)
|
||||||
{
|
{
|
||||||
const int64_t NS_PER_S = 1000 * 1000 * 1000;
|
const int64_t NS_PER_S = 1000 * 1000 * 1000;
|
||||||
const int64_t START_NS = U64_LITERAL(1217709000)*NS_PER_S;
|
const int64_t START_NS = UINT64_C(1217709000)*NS_PER_S;
|
||||||
int64_t now;
|
int64_t now;
|
||||||
double rem;
|
double rem;
|
||||||
unsigned tick;
|
unsigned tick;
|
||||||
|
@ -5627,8 +5627,8 @@ test_config_include_opened_file_list(void *data)
|
|||||||
static void
|
static void
|
||||||
test_config_compute_max_mem_in_queues(void *data)
|
test_config_compute_max_mem_in_queues(void *data)
|
||||||
{
|
{
|
||||||
#define GIGABYTE(x) (U64_LITERAL(x) << 30)
|
#define GIGABYTE(x) (UINT64_C(x) << 30)
|
||||||
#define MEGABYTE(x) (U64_LITERAL(x) << 20)
|
#define MEGABYTE(x) (UINT64_C(x) << 20)
|
||||||
(void)data;
|
(void)data;
|
||||||
MOCK(get_total_system_memory, get_total_system_memory_mock);
|
MOCK(get_total_system_memory, get_total_system_memory_mock);
|
||||||
|
|
||||||
|
@ -215,10 +215,10 @@ test_crypto_rng(void *arg)
|
|||||||
j = crypto_rand_int(100);
|
j = crypto_rand_int(100);
|
||||||
if (j < 0 || j >= 100)
|
if (j < 0 || j >= 100)
|
||||||
allok = 0;
|
allok = 0;
|
||||||
big = crypto_rand_uint64(U64_LITERAL(1)<<40);
|
big = crypto_rand_uint64(UINT64_C(1)<<40);
|
||||||
if (big >= (U64_LITERAL(1)<<40))
|
if (big >= (UINT64_C(1)<<40))
|
||||||
allok = 0;
|
allok = 0;
|
||||||
big = crypto_rand_uint64(U64_LITERAL(5));
|
big = crypto_rand_uint64(UINT64_C(5));
|
||||||
if (big >= 5)
|
if (big >= 5)
|
||||||
allok = 0;
|
allok = 0;
|
||||||
d = crypto_rand_double();
|
d = crypto_rand_double();
|
||||||
@ -2826,8 +2826,8 @@ test_crypto_siphash(void *arg)
|
|||||||
{ 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, }
|
{ 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, }
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct sipkey K = { U64_LITERAL(0x0706050403020100),
|
const struct sipkey K = { UINT64_C(0x0706050403020100),
|
||||||
U64_LITERAL(0x0f0e0d0c0b0a0908) };
|
UINT64_C(0x0f0e0d0c0b0a0908) };
|
||||||
uint8_t input[64];
|
uint8_t input[64];
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
@ -2882,12 +2882,12 @@ crypto_rand_check_failure_mode_identical(void)
|
|||||||
{
|
{
|
||||||
/* just in case the buffer size isn't a multiple of sizeof(int64_t) */
|
/* just in case the buffer size isn't a multiple of sizeof(int64_t) */
|
||||||
#define FAILURE_MODE_BUFFER_SIZE_I64 \
|
#define FAILURE_MODE_BUFFER_SIZE_I64 \
|
||||||
(FAILURE_MODE_BUFFER_SIZE/SIZEOF_INT64_T)
|
(FAILURE_MODE_BUFFER_SIZE/8)
|
||||||
#define FAILURE_MODE_BUFFER_SIZE_I64_BYTES \
|
#define FAILURE_MODE_BUFFER_SIZE_I64_BYTES \
|
||||||
(FAILURE_MODE_BUFFER_SIZE_I64*SIZEOF_INT64_T)
|
(FAILURE_MODE_BUFFER_SIZE_I64*8)
|
||||||
|
|
||||||
#if FAILURE_MODE_BUFFER_SIZE_I64 < 2
|
#if FAILURE_MODE_BUFFER_SIZE_I64 < 2
|
||||||
#error FAILURE_MODE_BUFFER_SIZE needs to be at least 2*SIZEOF_INT64_T
|
#error FAILURE_MODE_BUFFER_SIZE needs to be at least 2*8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int64_t buf[FAILURE_MODE_BUFFER_SIZE_I64];
|
int64_t buf[FAILURE_MODE_BUFFER_SIZE_I64];
|
||||||
|
@ -2110,7 +2110,7 @@ test_vrs_for_v3ns(vote_routerstatus_t *vrs, int voter, time_t now)
|
|||||||
tt_int_op(rs->or_port,OP_EQ, 443);
|
tt_int_op(rs->or_port,OP_EQ, 443);
|
||||||
tt_int_op(rs->dir_port,OP_EQ, 8000);
|
tt_int_op(rs->dir_port,OP_EQ, 8000);
|
||||||
/* no flags except "running" (16) and "v2dir" (64) and "valid" (128) */
|
/* no flags except "running" (16) and "v2dir" (64) and "valid" (128) */
|
||||||
tt_u64_op(vrs->flags, OP_EQ, U64_LITERAL(0xd0));
|
tt_u64_op(vrs->flags, OP_EQ, UINT64_C(0xd0));
|
||||||
} else if (tor_memeq(rs->identity_digest,
|
} else if (tor_memeq(rs->identity_digest,
|
||||||
"\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5"
|
"\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5\x5"
|
||||||
"\x5\x5\x5\x5",
|
"\x5\x5\x5\x5",
|
||||||
@ -2136,10 +2136,10 @@ test_vrs_for_v3ns(vote_routerstatus_t *vrs, int voter, time_t now)
|
|||||||
tt_int_op(rs->ipv6_orport,OP_EQ, 4711);
|
tt_int_op(rs->ipv6_orport,OP_EQ, 4711);
|
||||||
if (voter == 1) {
|
if (voter == 1) {
|
||||||
/* all except "authority" (1) */
|
/* all except "authority" (1) */
|
||||||
tt_u64_op(vrs->flags, OP_EQ, U64_LITERAL(254));
|
tt_u64_op(vrs->flags, OP_EQ, UINT64_C(254));
|
||||||
} else {
|
} else {
|
||||||
/* 1023 - authority(1) - madeofcheese(16) - madeoftin(32) */
|
/* 1023 - authority(1) - madeofcheese(16) - madeoftin(32) */
|
||||||
tt_u64_op(vrs->flags, OP_EQ, U64_LITERAL(974));
|
tt_u64_op(vrs->flags, OP_EQ, UINT64_C(974));
|
||||||
}
|
}
|
||||||
} else if (tor_memeq(rs->identity_digest,
|
} else if (tor_memeq(rs->identity_digest,
|
||||||
"\x33\x33\x33\x33\x33\x33\x33\x33\x33\x33"
|
"\x33\x33\x33\x33\x33\x33\x33\x33\x33\x33"
|
||||||
@ -2949,8 +2949,8 @@ test_dir_scale_bw(void *testdata)
|
|||||||
for (i=0; i<8; ++i) {
|
for (i=0; i<8; ++i) {
|
||||||
total += vals_u64[i];
|
total += vals_u64[i];
|
||||||
}
|
}
|
||||||
tt_assert(total >= (U64_LITERAL(1)<<60));
|
tt_assert(total >= (UINT64_C(1)<<60));
|
||||||
tt_assert(total <= (U64_LITERAL(1)<<62));
|
tt_assert(total <= (UINT64_C(1)<<62));
|
||||||
|
|
||||||
for (i=0; i<8; ++i) {
|
for (i=0; i<8; ++i) {
|
||||||
/* vals[2].u64 is the scaled value of 1.0 */
|
/* vals[2].u64 is the scaled value of 1.0 */
|
||||||
|
@ -575,4 +575,3 @@ struct testcase_t geoip_tests[] = {
|
|||||||
|
|
||||||
END_OF_TESTCASES
|
END_OF_TESTCASES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ test_mainloop_update_time_normal(void *arg)
|
|||||||
|
|
||||||
monotime_enable_test_mocking();
|
monotime_enable_test_mocking();
|
||||||
/* This is arbitrary */
|
/* This is arbitrary */
|
||||||
uint64_t mt_now = U64_LITERAL(7493289274986);
|
uint64_t mt_now = UINT64_C(7493289274986);
|
||||||
/* This time is in the past as of when this test was written. */
|
/* This time is in the past as of when this test was written. */
|
||||||
time_t now = 1525272090;
|
time_t now = 1525272090;
|
||||||
monotime_coarse_set_mock_time_nsec(mt_now);
|
monotime_coarse_set_mock_time_nsec(mt_now);
|
||||||
@ -63,7 +63,7 @@ test_mainloop_update_time_jumps(void *arg)
|
|||||||
|
|
||||||
monotime_enable_test_mocking();
|
monotime_enable_test_mocking();
|
||||||
/* This is arbitrary */
|
/* This is arbitrary */
|
||||||
uint64_t mt_now = U64_LITERAL(7493289274986);
|
uint64_t mt_now = UINT64_C(7493289274986);
|
||||||
/* This time is in the past as of when this test was written. */
|
/* This time is in the past as of when this test was written. */
|
||||||
time_t now = 220897152;
|
time_t now = 220897152;
|
||||||
monotime_coarse_set_mock_time_nsec(mt_now);
|
monotime_coarse_set_mock_time_nsec(mt_now);
|
||||||
|
@ -276,7 +276,7 @@ test_options_validate(void *arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MEGABYTEIFY(mb) (U64_LITERAL(mb) << 20)
|
#define MEGABYTEIFY(mb) (UINT64_C(mb) << 20)
|
||||||
static void
|
static void
|
||||||
test_have_enough_mem_for_dircache(void *arg)
|
test_have_enough_mem_for_dircache(void *arg)
|
||||||
{
|
{
|
||||||
|
@ -232,7 +232,7 @@ NS(test_main)(void *arg)
|
|||||||
tor_free(actual);
|
tor_free(actual);
|
||||||
|
|
||||||
expected = "10.00 GB";
|
expected = "10.00 GB";
|
||||||
actual = bytes_to_usage((U64_LITERAL(1) << 30) * 10L);
|
actual = bytes_to_usage((UINT64_C(1) << 30) * 10L);
|
||||||
tt_str_op(actual, OP_EQ, expected);
|
tt_str_op(actual, OP_EQ, expected);
|
||||||
tor_free(actual);
|
tor_free(actual);
|
||||||
|
|
||||||
|
@ -1931,8 +1931,8 @@ test_util_strmisc(void *arg)
|
|||||||
tor_snprintf(buf, 10, "abcdef");
|
tor_snprintf(buf, 10, "abcdef");
|
||||||
tt_int_op(0,OP_EQ, buf[6]);
|
tt_int_op(0,OP_EQ, buf[6]);
|
||||||
/* uint64 */
|
/* uint64 */
|
||||||
tor_snprintf(buf, sizeof(buf), "x!"U64_FORMAT"!x",
|
tor_snprintf(buf, sizeof(buf), "x!%"PRIu64"!x",
|
||||||
U64_PRINTF_ARG(U64_LITERAL(12345678901)));
|
(UINT64_C(12345678901)));
|
||||||
tt_str_op("x!12345678901!x",OP_EQ, buf);
|
tt_str_op("x!12345678901!x",OP_EQ, buf);
|
||||||
|
|
||||||
/* Test str{,case}cmpstart */
|
/* Test str{,case}cmpstart */
|
||||||
@ -2179,17 +2179,17 @@ test_util_parse_integer(void *arg)
|
|||||||
tt_int_op(0,OP_EQ, i);
|
tt_int_op(0,OP_EQ, i);
|
||||||
|
|
||||||
/* Test parse_uint64 */
|
/* Test parse_uint64 */
|
||||||
tt_assert(U64_LITERAL(10) == tor_parse_uint64("10 x",10,0,100, &i, &cp));
|
tt_assert(UINT64_C(10) == tor_parse_uint64("10 x",10,0,100, &i, &cp));
|
||||||
tt_int_op(1,OP_EQ, i);
|
tt_int_op(1,OP_EQ, i);
|
||||||
tt_str_op(cp,OP_EQ, " x");
|
tt_str_op(cp,OP_EQ, " x");
|
||||||
tt_assert(U64_LITERAL(12345678901) ==
|
tt_assert(UINT64_C(12345678901) ==
|
||||||
tor_parse_uint64("12345678901",10,0,UINT64_MAX, &i, &cp));
|
tor_parse_uint64("12345678901",10,0,UINT64_MAX, &i, &cp));
|
||||||
tt_int_op(1,OP_EQ, i);
|
tt_int_op(1,OP_EQ, i);
|
||||||
tt_str_op(cp,OP_EQ, "");
|
tt_str_op(cp,OP_EQ, "");
|
||||||
tt_assert(U64_LITERAL(0) ==
|
tt_assert(UINT64_C(0) ==
|
||||||
tor_parse_uint64("12345678901",10,500,INT32_MAX, &i, &cp));
|
tor_parse_uint64("12345678901",10,500,INT32_MAX, &i, &cp));
|
||||||
tt_int_op(0,OP_EQ, i);
|
tt_int_op(0,OP_EQ, i);
|
||||||
tt_assert(U64_LITERAL(0) ==
|
tt_assert(UINT64_C(0) ==
|
||||||
tor_parse_uint64("123",-1,0,INT32_MAX, &i, &cp));
|
tor_parse_uint64("123",-1,0,INT32_MAX, &i, &cp));
|
||||||
tt_int_op(0,OP_EQ, i);
|
tt_int_op(0,OP_EQ, i);
|
||||||
|
|
||||||
@ -2197,10 +2197,10 @@ test_util_parse_integer(void *arg)
|
|||||||
/* Test parse_double */
|
/* Test parse_double */
|
||||||
double d = tor_parse_double("10", 0, (double)UINT64_MAX,&i,NULL);
|
double d = tor_parse_double("10", 0, (double)UINT64_MAX,&i,NULL);
|
||||||
tt_int_op(1,OP_EQ, i);
|
tt_int_op(1,OP_EQ, i);
|
||||||
tt_assert(DBL_TO_U64(d) == 10);
|
tt_assert(((uint64_t)d) == 10);
|
||||||
d = tor_parse_double("0", 0, (double)UINT64_MAX,&i,NULL);
|
d = tor_parse_double("0", 0, (double)UINT64_MAX,&i,NULL);
|
||||||
tt_int_op(1,OP_EQ, i);
|
tt_int_op(1,OP_EQ, i);
|
||||||
tt_assert(DBL_TO_U64(d) == 0);
|
tt_assert(((uint64_t)d) == 0);
|
||||||
d = tor_parse_double(" ", 0, (double)UINT64_MAX,&i,NULL);
|
d = tor_parse_double(" ", 0, (double)UINT64_MAX,&i,NULL);
|
||||||
tt_double_op(fabs(d), OP_LT, 1e-10);
|
tt_double_op(fabs(d), OP_LT, 1e-10);
|
||||||
tt_int_op(0,OP_EQ, i);
|
tt_int_op(0,OP_EQ, i);
|
||||||
@ -2212,7 +2212,7 @@ test_util_parse_integer(void *arg)
|
|||||||
tt_int_op(1,OP_EQ, i);
|
tt_int_op(1,OP_EQ, i);
|
||||||
d = tor_parse_double("-.0", 0, (double)UINT64_MAX,&i,NULL);
|
d = tor_parse_double("-.0", 0, (double)UINT64_MAX,&i,NULL);
|
||||||
tt_int_op(1,OP_EQ, i);
|
tt_int_op(1,OP_EQ, i);
|
||||||
tt_assert(DBL_TO_U64(d) == 0);
|
tt_assert(((uint64_t)d) == 0);
|
||||||
d = tor_parse_double("-10", -100.0, 100.0,&i,NULL);
|
d = tor_parse_double("-10", -100.0, 100.0,&i,NULL);
|
||||||
tt_int_op(1,OP_EQ, i);
|
tt_int_op(1,OP_EQ, i);
|
||||||
tt_double_op(fabs(d - -10.0),OP_LT, 1E-12);
|
tt_double_op(fabs(d - -10.0),OP_LT, 1E-12);
|
||||||
@ -2230,7 +2230,7 @@ test_util_parse_integer(void *arg)
|
|||||||
tt_int_op(i,OP_EQ, 0);
|
tt_int_op(i,OP_EQ, 0);
|
||||||
tt_int_op(0UL,OP_EQ, tor_parse_ulong(TOOBIG, 10, 0, ULONG_MAX, &i, NULL));
|
tt_int_op(0UL,OP_EQ, tor_parse_ulong(TOOBIG, 10, 0, ULONG_MAX, &i, NULL));
|
||||||
tt_int_op(i,OP_EQ, 0);
|
tt_int_op(i,OP_EQ, 0);
|
||||||
tt_u64_op(U64_LITERAL(0), OP_EQ, tor_parse_uint64(TOOBIG, 10,
|
tt_u64_op(UINT64_C(0), OP_EQ, tor_parse_uint64(TOOBIG, 10,
|
||||||
0, UINT64_MAX, &i, NULL));
|
0, UINT64_MAX, &i, NULL));
|
||||||
tt_int_op(i,OP_EQ, 0);
|
tt_int_op(i,OP_EQ, 0);
|
||||||
}
|
}
|
||||||
@ -2253,17 +2253,17 @@ test_util_pow2(void *arg)
|
|||||||
tt_int_op(tor_log2(3),OP_EQ, 1);
|
tt_int_op(tor_log2(3),OP_EQ, 1);
|
||||||
tt_int_op(tor_log2(4),OP_EQ, 2);
|
tt_int_op(tor_log2(4),OP_EQ, 2);
|
||||||
tt_int_op(tor_log2(5),OP_EQ, 2);
|
tt_int_op(tor_log2(5),OP_EQ, 2);
|
||||||
tt_int_op(tor_log2(U64_LITERAL(40000000000000000)),OP_EQ, 55);
|
tt_int_op(tor_log2(UINT64_C(40000000000000000)),OP_EQ, 55);
|
||||||
tt_int_op(tor_log2(UINT64_MAX),OP_EQ, 63);
|
tt_int_op(tor_log2(UINT64_MAX),OP_EQ, 63);
|
||||||
|
|
||||||
/* Test round_to_power_of_2 */
|
/* Test round_to_power_of_2 */
|
||||||
tt_u64_op(round_to_power_of_2(120), OP_EQ, 128);
|
tt_u64_op(round_to_power_of_2(120), OP_EQ, 128);
|
||||||
tt_u64_op(round_to_power_of_2(128), OP_EQ, 128);
|
tt_u64_op(round_to_power_of_2(128), OP_EQ, 128);
|
||||||
tt_u64_op(round_to_power_of_2(130), OP_EQ, 128);
|
tt_u64_op(round_to_power_of_2(130), OP_EQ, 128);
|
||||||
tt_u64_op(round_to_power_of_2(U64_LITERAL(40000000000000000)), OP_EQ,
|
tt_u64_op(round_to_power_of_2(UINT64_C(40000000000000000)), OP_EQ,
|
||||||
U64_LITERAL(1)<<55);
|
UINT64_C(1)<<55);
|
||||||
tt_u64_op(round_to_power_of_2(U64_LITERAL(0xffffffffffffffff)), OP_EQ,
|
tt_u64_op(round_to_power_of_2(UINT64_C(0xffffffffffffffff)), OP_EQ,
|
||||||
U64_LITERAL(1)<<63);
|
UINT64_C(1)<<63);
|
||||||
tt_u64_op(round_to_power_of_2(0), OP_EQ, 1);
|
tt_u64_op(round_to_power_of_2(0), OP_EQ, 1);
|
||||||
tt_u64_op(round_to_power_of_2(1), OP_EQ, 1);
|
tt_u64_op(round_to_power_of_2(1), OP_EQ, 1);
|
||||||
tt_u64_op(round_to_power_of_2(2), OP_EQ, 2);
|
tt_u64_op(round_to_power_of_2(2), OP_EQ, 2);
|
||||||
@ -5570,15 +5570,15 @@ test_util_max_mem(void *arg)
|
|||||||
tt_int_op(r, OP_EQ, r2);
|
tt_int_op(r, OP_EQ, r2);
|
||||||
tt_uint_op(memory2, OP_EQ, memory1);
|
tt_uint_op(memory2, OP_EQ, memory1);
|
||||||
|
|
||||||
TT_BLATHER(("System memory: "U64_FORMAT, U64_PRINTF_ARG(memory1)));
|
TT_BLATHER(("System memory: %"TOR_PRIuSZ, (memory1)));
|
||||||
|
|
||||||
if (r==0) {
|
if (r==0) {
|
||||||
/* You have at least a megabyte. */
|
/* You have at least a megabyte. */
|
||||||
tt_uint_op(memory1, OP_GT, (1<<20));
|
tt_uint_op(memory1, OP_GT, (1<<20));
|
||||||
} else {
|
} else {
|
||||||
/* You do not have a petabyte. */
|
/* You do not have a petabyte. */
|
||||||
#if SIZEOF_SIZE_T == SIZEOF_UINT64_T
|
#if SIZEOF_SIZE_T >= 8
|
||||||
tt_u64_op(memory1, OP_LT, (U64_LITERAL(1)<<50));
|
tt_u64_op(memory1, OP_LT, (UINT64_C(1)<<50));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ test_util_format_unaligned_accessors(void *ignored)
|
|||||||
char buf[9] = "onionsoup"; // 6f6e696f6e736f7570
|
char buf[9] = "onionsoup"; // 6f6e696f6e736f7570
|
||||||
|
|
||||||
tt_u64_op(get_uint64(buf+1), OP_EQ,
|
tt_u64_op(get_uint64(buf+1), OP_EQ,
|
||||||
tor_htonll(U64_LITERAL(0x6e696f6e736f7570)));
|
tor_htonll(UINT64_C(0x6e696f6e736f7570)));
|
||||||
tt_uint_op(get_uint32(buf+1), OP_EQ, htonl(0x6e696f6e));
|
tt_uint_op(get_uint32(buf+1), OP_EQ, htonl(0x6e696f6e));
|
||||||
tt_uint_op(get_uint16(buf+1), OP_EQ, htons(0x6e69));
|
tt_uint_op(get_uint16(buf+1), OP_EQ, htons(0x6e69));
|
||||||
tt_uint_op(get_uint8(buf+1), OP_EQ, 0x6e);
|
tt_uint_op(get_uint8(buf+1), OP_EQ, 0x6e);
|
||||||
@ -33,7 +33,7 @@ test_util_format_unaligned_accessors(void *ignored)
|
|||||||
set_uint32(buf+1, htonl(0x78696465));
|
set_uint32(buf+1, htonl(0x78696465));
|
||||||
tt_mem_op(buf, OP_EQ, "oxidestop", 9);
|
tt_mem_op(buf, OP_EQ, "oxidestop", 9);
|
||||||
|
|
||||||
set_uint64(buf+1, tor_htonll(U64_LITERAL(0x6266757363617465)));
|
set_uint64(buf+1, tor_htonll(UINT64_C(0x6266757363617465)));
|
||||||
tt_mem_op(buf, OP_EQ, "obfuscate", 9);
|
tt_mem_op(buf, OP_EQ, "obfuscate", 9);
|
||||||
done:
|
done:
|
||||||
;
|
;
|
||||||
|
Loading…
Reference in New Issue
Block a user