Tor  0.4.7.0-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-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * @file evloop_sys.c
9  * @brief Subsystem definition for the event loop module
10  **/
11 
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",
45  .supported = true,
46  .level = -20,
47  .initialize = subsys_evloop_initialize,
48  .shutdown = subsys_evloop_shutdown,
49  .postfork = subsys_evloop_postfork,
50 };
void tor_libevent_free_all(void)
Header for compat_libevent.c.
Declare subsystem object for the event loop module.
Headers for log.c.
#define LD_NET
Definition: log.h:66
const char * name
Definition: subsys.h:43
Types used to declare a subsystem.
#define SUBSYS_DECLARE_LOCATION()
Definition: subsys.h:211