blob: b639810c23226a7daa32bd02c2df58665e2477eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
* Copyright (c) 2007-2020, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
* @file evloop_sys.c
* @brief Subsystem definition for the event loop module
**/
#include "orconfig.h"
#include "lib/subsys/subsys.h"
#include "lib/evloop/compat_libevent.h"
#include "lib/evloop/evloop_sys.h"
#include "lib/log/log.h"
static int
subsys_evloop_initialize(void)
{
if (tor_init_libevent_rng() < 0) {
log_warn(LD_NET, "Problem initializing libevent RNG.");
return -1;
}
return 0;
}
static void
subsys_evloop_postfork(void)
{
#ifdef TOR_UNIT_TESTS
tor_libevent_postfork();
#endif
}
static void
subsys_evloop_shutdown(void)
{
tor_libevent_free_all();
}
const struct subsys_fns_t sys_evloop = {
.name = "evloop",
SUBSYS_DECLARE_LOCATION(),
.supported = true,
.level = -20,
.initialize = subsys_evloop_initialize,
.shutdown = subsys_evloop_shutdown,
.postfork = subsys_evloop_postfork,
};
|