tor  0.4.2.1-alpha-dev
evloop_sys.c
Go to the documentation of this file.
1 /* Copyright (c) 2001 Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
12 #include "orconfig.h"
13 #include "lib/subsys/subsys.h"
15 #include "lib/evloop/evloop_sys.h"
16 #include "lib/log/log.h"
17 
18 static int
19 subsys_evloop_initialize(void)
20 {
21  if (tor_init_libevent_rng() < 0) {
22  log_warn(LD_NET, "Problem initializing libevent RNG.");
23  return -1;
24  }
25  return 0;
26 }
27 
28 static void
29 subsys_evloop_postfork(void)
30 {
31 #ifdef TOR_UNIT_TESTS
32  tor_libevent_postfork();
33 #endif
34 }
35 
36 static void
37 subsys_evloop_shutdown(void)
38 {
40 }
41 
42 const struct subsys_fns_t sys_evloop = {
43  .name = "evloop",
44  .supported = true,
45  .level = -20,
46  .initialize = subsys_evloop_initialize,
47  .shutdown = subsys_evloop_shutdown,
48  .postfork = subsys_evloop_postfork,
49 };
Declare subsystem object for the event loop module.
void tor_libevent_free_all(void)
const char * name
Definition: subsys.h:28
#define LD_NET
Definition: log.h:64
Headers for log.c.
Header for compat_libevent.c.