return (unsigned long)GetCurrentThreadId();
}
#elif defined(USE_PTHREADS)
-/* DOCDOC attr_reentrant */
+/** A mutex attribute that we're going to use to tell pthreads that we want
+ * "reentrant" mutexes (i.e., once we can re-lock if we're already holding
+ * them.) */
static pthread_mutexattr_t attr_reentrant;
-/* DOCDOC threads_initialized */
+/** True iff we've called tor_threads_init() */
static int threads_initialized = 0;
/** Initialize <b>mutex</b> so it can be locked. Every mutex must be set
* up eith tor_mutex_init() or tor_mutex_new(); not both. */
return _crypto_new_pk_env_rsa(rsa);
}
-/* DOCDOC _crypto_pk_env_get_rsa */
+/** Helper, used by tor-checkkey.c. Return the RSA from a crypto_pk_env_t. */
RSA *
_crypto_pk_env_get_rsa(crypto_pk_env_t *env)
{
/** Linked list of logfile_t. */
static logfile_t *logfiles = NULL;
#ifdef HAVE_SYSLOG_H
-/* DOCDOC syslog_count */
+/** The number of open syslog log handlers that we have. When this reaches 0,
+ * we can close our connection to the syslog facility. */
static int syslog_count = 0;
#endif
#define UNLOCK_LOGS() STMT_NIL
#endif
-/* What's the lowest log level anybody cares about? */
-/* DOCDOC _log_global_min_severity */
+/** What's the lowest log level anybody cares about? Checking this lets us
+ * bail out early from log_debug if we aren't debugging. */
int _log_global_min_severity = LOG_NOTICE;
static void delete_log(logfile_t *victim);
memarea_chunk_t *first; /**< Top of the chunk stack: never NULL. */
};
+/** How many chunks will we put into the freelist before freeing them? */
#define MAX_FREELIST_LEN 4
-/* DOCDOC freelist_len */
-int freelist_len=0;
-/* DOCDOC freelist */
+/** The number of memarea chunks currently in our freelist. */
+static int freelist_len=0;
+/** A linked list of unused memory area chunks. Used to prevent us from
+ * spinning in malloc/free loops. */
static memarea_chunk_t *freelist = NULL;
/** Helper: allocate a new memarea chunk of around <b>chunk_size</b> bytes. */
#define PRETTY_FUNCTION ""
#endif
-/* DOCDOC have_failed */
-extern int have_failed;
-
#define test_fail_msg(msg) \
STMT_BEGIN \
have_failed = 1; \
}
/* strftime is locale-specific, so we need to replace those parts */
-/* DOCDOC WEEKDAY_NAMES */
+
+/** A c-locale array of 3-letter names of weekdays, starting with Sun. */
static const char *WEEKDAY_NAMES[] =
{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
-/* DOCDOC MONTH_NAMES */
+/** A c-locale array of 3-letter names of months, starting with Jan. */
static const char *MONTH_NAMES[] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
* have up to <b>ftime_slop</b> seconds of inaccuracy; IOW, our window of
* estimate for the current time is now + ftime_skew +/- ftime_slop.
*/
-/* DOCDOC ftime_skew */
+/** Our current estimate of our skew, such that we think the current time is
+ * closest to time(NULL)+ftime_skew. */
static int ftime_skew = 0;
-/* DOCDOC ftime_slop */
+/** Tolerance during time comparisons, in seconds. */
static int ftime_slop = 60;
/** Set the largest amount of sloppiness we'll allow in fuzzy time
* comparisons. */
#include <openssl/crypto.h>
#endif
-/* DOCDOC have_failed */
+/** Set to true if any unit test has failed. Mostly, this is set by the macros
+ * in test.h */
int have_failed = 0;
-/* DOCDOC temp_dir */
+/** Temporary directory (set up by setup_directory) under which we store all
+ * our files during testing. */
static char temp_dir[256];
/** Select and create the temporary directory we'll use to run our unit tests.