tor  0.4.1.0-alpha-dev
Functions
main.h File Reference

Go to the source code of this file.

Functions

void handle_signals (void)
 
void activate_signal (int signal_num)
 
int try_locking (const or_options_t *options, int err_if_locked)
 
int have_lockfile (void)
 
void release_lockfile (void)
 
void tor_remove_file (const char *filename)
 
void tor_cleanup (void)
 
void tor_free_all (int postfork)
 
int tor_init (int argc, char **argv)
 
int run_tor_main_loop (void)
 

Detailed Description

Header file for main.c.

Definition in file main.h.

Function Documentation

◆ handle_signals()

void handle_signals ( void  )

Set up the signal handler events for this process, and register them with libevent if appropriate.

Definition at line 498 of file main.c.

◆ have_lockfile()

int have_lockfile ( void  )

Return true iff we've successfully acquired the lock file.

Definition at line 730 of file main.c.

References lockfile.

◆ release_lockfile()

void release_lockfile ( void  )

If we have successfully acquired the lock file, release it.

Definition at line 737 of file main.c.

References lockfile, and tor_lockfile_unlock().

◆ tor_cleanup()

void tor_cleanup ( void  )

◆ tor_free_all()

void tor_free_all ( int  postfork)

Free all memory that we might have allocated somewhere. If postfork, we are a worker process and we want to free only the parts of memory that we won't touch. If !postfork, Tor is shutting down and we should free everything.

Helps us find the real leaks with sanitizers and the like. Also valgrind should then report 0 reachable in its leak report (in an ideal world – in practice libevent, SSL, libc etc never quite free everything).

Definition at line 754 of file main.c.

◆ tor_remove_file()

void tor_remove_file ( const char *  filename)

Remove the specified file, and log a warning if the operation fails for any reason other than the file not existing. Ignores NULL filenames.

Definition at line 830 of file main.c.

Referenced by tor_cleanup().

◆ try_locking()

int try_locking ( const or_options_t options,
int  err_if_locked 
)

Try to grab the lock file described in options, if we do not already have it. If err_if_locked is true, warn if somebody else is holding the lock, and exit if we can't get it after waiting. Otherwise, return -1 if we can't get the lockfile. Return 0 on success.

Definition at line 694 of file main.c.

References lockfile.