This file is indexed.

/usr/include/ola/base/Init.h is in libola-dev 0.10.5.nojsmin-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * Init.h
 * A grab bag of functions useful for programs.
 * Copyright (C) 2012 Simon Newton
 */

/**
 * @defgroup init Initialization
 * @brief 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.
 *
 * @examplepara
 *   @code
 *   // For client applications
 *   AppInit(argc, argv);
 *   // For server applications
 *   ServerInit(argc, argv, &export_map);
 *   @endcode
 *
 * @addtogroup init
 * @{
 * @file Init.h
 * @brief Functions called during program startup.
 * @}
 */

#ifndef INCLUDE_OLA_BASE_INIT_H_
#define INCLUDE_OLA_BASE_INIT_H_

#include <ola/ExportMap.h>
#include <ola/Callback.h>
#include <string>

namespace ola {
/**
 * @addtogroup init
 * @{
 */

/**
 * @brief Used to initialize a server.
 * @param argc argument count
 * @param argv pointer to argument strings
 * @param export_map an optional pointer to an ExportMap
 * @return true on success and false otherwise
 * @note If you are a client/application then call AppInit() instead.
 *
 * This does the following:
 *  - installs the SEGV handler
 *  - initializes the random number generator
 *  - sets the thread scheduling options
 *  - populates the export map
 *  - initializes the network stack (Windows only).
 */
bool ServerInit(int argc, char *argv[], ExportMap *export_map);

/**
 * @brief Used to initialize a server. Installs the SEGV handler, initializes
 * the random number generator and populates the export map. Also sets the help
 * string for the program, parses flags and initialises logging from flags.
 * @param argc argument count
 * @param argv pointer to argument strings
 * @param export_map an optional pointer to an ExportMap
 * @param first_line the inital line that is displayed in the help section.
 * This is displayed after argv[0].
 * @param description a multiline description of the program
 * @return true on success and false otherwise
 * @note If you are a client/application then call AppInit() instead.
 * @sa ola::SetHelpString ola::ParseFlags ola::InitLoggingFromFlags
 */
bool ServerInit(int *argc,
                char *argv[],
                ExportMap *export_map,
                const std::string &first_line,
                const std::string &description);

/**
 * @brief Used to initialize a application. Installs the SEGV handler and
 * initializes the random number generator, sets the help string for the
 * program, parses flags and initialises logging from flags.
 * @param argc argument count
 * @param argv pointer to the argument strings
 * @param first_line the inital line that is displayed in the help section.
 * This is displayed after argv[0].
 * @param description a multiline description of the program
 * @return true on success and false otherwise
 * @note If you are a server then call ServerInit() instead.
 * @sa ola::SetHelpString ola::ParseFlags ola::InitLoggingFromFlags
 */
bool AppInit(int *argc,
             char *argv[],
             const std::string &first_line,
             const std::string &description);

/**
 * @brief Perform platform-specific initialization of the networking subsystem.
 *
 * This method is called by ServerInit() and AppInit(), so you only need to
 * call this yourself if you're not using those.
 * @return true on success and false otherwise
 */
bool NetworkInit();

/**
 * @brief Install a signal handler.
 * @param signal the signal number to catch
 * @param fp is a function pointer to the handler
 * @return true on success and false otherwise
 */
bool InstallSignal(int signal, void(*fp)(int signo));

/**
 * @brief Install signal handlers to deal with SIGBUS & SIGSEGV.
 * @return true on success and false otherwise
 *
 * On receiving a SIGBUS or SIGSEGV a stack trace will be printed.
 */
bool InstallSEGVHandler();

/**
 * @brief Populate the ExportMap with a couple of basic variables.
 * @param argc argument count
 * @param argv pointer to the arugment strings
 * @param export_map ExportMap to populate
 *
 * This is called by ServerInit(). It sets the following variables:
 *  - binary: name of the binary.
 *  - cmd-line: command line used to start the binary
 *  - fd-limit: the max number of file descriptors
 */
void InitExportMap(int argc, char* argv[], ExportMap *export_map);

/**
 * @brief 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.
 * @sa @ref logging
 */
void Daemonise();
/**@}*/
}  // namespace ola
#endif  // INCLUDE_OLA_BASE_INIT_H_