LCOV - code coverage report
Current view: top level - lib/evloop - evloop_sys.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 8 10 80.0 %
Date: 2021-11-24 03:28:48 Functions: 3 3 100.0 %

          Line data    Source code
       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"
      14             : #include "lib/evloop/compat_libevent.h"
      15             : #include "lib/evloop/evloop_sys.h"
      16             : #include "lib/log/log.h"
      17             : 
      18             : static int
      19        5553 : subsys_evloop_initialize(void)
      20             : {
      21        5553 :   if (tor_init_libevent_rng() < 0) {
      22           0 :     log_warn(LD_NET, "Problem initializing libevent RNG.");
      23           0 :     return -1;
      24             :   }
      25             :   return 0;
      26             : }
      27             : 
      28             : static void
      29        1854 : subsys_evloop_postfork(void)
      30             : {
      31             : #ifdef TOR_UNIT_TESTS
      32        1854 :   tor_libevent_postfork();
      33             : #endif
      34        1854 : }
      35             : 
      36             : static void
      37         235 : subsys_evloop_shutdown(void)
      38             : {
      39         235 :   tor_libevent_free_all();
      40         235 : }
      41             : 
      42             : const struct subsys_fns_t sys_evloop = {
      43             :   .name = "evloop",
      44             :   SUBSYS_DECLARE_LOCATION(),
      45             :   .supported = true,
      46             :   .level = -20,
      47             :   .initialize = subsys_evloop_initialize,
      48             :   .shutdown = subsys_evloop_shutdown,
      49             :   .postfork = subsys_evloop_postfork,
      50             : };

Generated by: LCOV version 1.14