Open Lighting Architecture
|
Functions called during program startup.
Programs using the OLA libraries should call either ServerInit() or AppInit(). There are also extra functions to help with installing signal handlers and daemonizing a process.
Files | |
file | Init.cpp |
file | Init.h |
Functions called during program startup. |
Functions | |
bool | ola::ServerInit (int argc, char *argv[], ExportMap *export_map) |
Used to initialize a server. Installs the SEGV handler, initializes the random number generator and populates the export map. | |
bool | ola::AppInit (int argc, char *argv[]) |
Used to initialize a application. Installs the SEGV handler and initializes the random number generator. | |
bool | ola::InstallSignal (int signal, void(*fp)(int signo)) |
Install a signal handler. | |
bool | ola::InstallSEGVHandler () |
Install signal handlers to deal with SIGBUS & SIGSEGV. | |
void | ola::InitExportMap (int argc, char *argv[], ExportMap *export_map) |
Populate the ExportMap with a couple of basic variables. | |
void | ola::Daemonise () |
Run as a daemon. |
bool ola::AppInit | ( | int | argc, |
char * | argv[] | ||
) |
Used to initialize a application. Installs the SEGV handler and initializes the random number generator.
argc | argument count |
argv | pointer to the argument strings |
void ola::Daemonise | ( | ) |
Run as a daemon.
Daemonize logs messages if it fails, so it's best to initialize the logging system (ola::InitLogging) before calling. However Daemonize() closes all open file descriptors so stdout/stderr will point to /dev/null in the daemon process. Therefore daemons should always use syslog logging.
If we can't daemonize the process is terminated.
See logging.
void ola::InitExportMap | ( | int | argc, |
char * | argv[], | ||
ExportMap * | export_map | ||
) |
Populate the ExportMap with a couple of basic variables.
argc | argument count |
argv | pointer to the arugment strings |
export_map | ExportMap to populate |
This is called by ServerInit(). It sets the following variables:
bool ola::InstallSEGVHandler | ( | ) |
Install signal handlers to deal with SIGBUS & SIGSEGV.
On receiving a SIGBUS or SIGSEGV a stack trace will be printed.
bool ola::InstallSignal | ( | int | signal, |
void(*)(int signo) | fp | ||
) |
Install a signal handler.
signal | the signal number to catch |
fp | is a function pointer to the handler |
bool ola::ServerInit | ( | int | argc, |
char * | argv[], | ||
ExportMap * | export_map | ||
) |
Used to initialize a server. Installs the SEGV handler, initializes the random number generator and populates the export map.
argc | argument count |
argv | pointer to argument strings |
export_map | an optional pointer to an ExportMap |