tor  0.4.1.0-alpha-dev
Functions
daemon.h File Reference
#include <stdbool.h>

Go to the source code of this file.

Functions

int start_daemon (void)
 
int finish_daemon (const char *desired_cwd)
 
bool start_daemon_has_been_called (void)
 

Detailed Description

Header for daemon.c.

Definition in file daemon.h.

Function Documentation

◆ finish_daemon()

int finish_daemon ( const char *  desired_cwd)

Finish putting the process into daemon mode: drop standard fds, and tell the parent process to exit. (Note: it's safe to call this more than once: calls after the first are ignored. Calls start_daemon first if it hasn't been called already.) Return true if we actually did a fork; false if we didn't.

Definition at line 121 of file daemon.c.

References finish_daemon_called, start_daemon(), and start_daemon_called.

◆ start_daemon()

int start_daemon ( void  )

Start putting the process into daemon mode: fork and drop all resources except standard fds. The parent process never returns, but stays around until finish_daemon is called. (Note: it's safe to call this more than once: calls after the first are ignored.) Return true if we actually forked and this is the child; false otherwise.

Definition at line 58 of file daemon.c.

References daemon_filedes, and start_daemon_called.

Referenced by finish_daemon(), and options_act_reversible().

◆ start_daemon_has_been_called()

bool start_daemon_has_been_called ( void  )

Return true iff we've called start_daemon() at least once.

Definition at line 46 of file daemon.c.

References start_daemon_called.

Referenced by options_act_reversible().