/usr/include/nih/main.h is in libnih-dev 1.0.3-6ubuntu2.
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 | /* libnih
*
* Copyright © 2009 Scott James Remnant <scott@netsplit.com>.
* Copyright © 2009 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef NIH_MAIN_H
#define NIH_MAIN_H
#include <nih/macros.h>
#include <nih/list.h>
#include <nih/signal.h>
/**
* NihMainLoopCb:
* @data: pointer given with callback,
* @loop: loop callback structure.
*
* Main loop callbacks are called each time through the main loop to
* perform any additional processing before the process is put back
* to sleep. For anything time critical, timers should be used instead.
*
* The @loop pointer can be used to remove the callback.
**/
typedef struct nih_main_loop_func NihMainLoopFunc;
typedef void (*NihMainLoopCb) (void *data, NihMainLoopFunc *loop);
/**
* NihMainLoopFunc:
* @entry: list header,
* @callback: function called,
* @data: pointer passed to @callback.
*
* This structure contains information about a function that should be
* called once in each main loop iteration.
*
* The callback can be removed by using nih_list_remove() as they are
* held in a list internally.
**/
struct nih_main_loop_func {
NihList entry;
NihMainLoopCb callback;
void *data;
};
/**
* nih_main_init_gettext:
*
* Initialises gettext using the PACKAGE_NAME and LOCALEDIR macros that should
* be set by Autoconf/Automake.
**/
#if ENABLE_NLS
# ifndef LOCALEDIR
# define LOCALEDIR NULL
# endif /* LOCALEDIR */
# define nih_main_init_gettext() \
do { \
setlocale (LC_ALL, ""); \
bindtextdomain (PACKAGE_NAME, LOCALEDIR); \
textdomain (PACKAGE_NAME); \
} while (0)
#else /* ENABLE_NLS */
# define nih_main_init_gettext()
#endif /* ENABLE_NLS */
/**
* nih_main_init:
* @argv0: program name from arguments.
*
* Should be called at the beginning of main() to initialise the various
* global variables exported from this module. Expands both
* nih_main_init_gettext() and nih_main_init_full()
* passing values set by Autoconf AC_INIT and AC_COPYRIGHT macros.
**/
#ifndef PACKAGE_COPYRIGHT
# define PACKAGE_COPYRIGHT NULL
#endif /* PACKAGE_COPYRIGHT */
#define nih_main_init(argv0) \
do { \
nih_main_init_gettext (); \
nih_main_init_full (argv0, PACKAGE_NAME, PACKAGE_VERSION, \
PACKAGE_BUGREPORT, PACKAGE_COPYRIGHT); \
} while (0);
NIH_BEGIN_EXTERN
extern const char *program_name;
extern const char *package_name;
extern const char *package_version;
extern const char *package_copyright;
extern const char *package_bugreport;
extern const char *package_string;
extern NihList *nih_main_loop_functions;
void nih_main_init_full (const char *argv0,
const char *package,
const char *version,
const char *bugreport,
const char *copyright);
void nih_main_suggest_help (void);
void nih_main_version (void);
int nih_main_daemonise (void)
__attribute__ ((warn_unused_result));
void nih_main_set_pidfile (const char *filename);
const char * nih_main_get_pidfile (void);
pid_t nih_main_read_pidfile (void);
int nih_main_write_pidfile (pid_t pid)
__attribute__ ((warn_unused_result));
void nih_main_unlink_pidfile (void);
void nih_main_loop_init (void);
int nih_main_loop (void);
void nih_main_loop_interrupt (void);
void nih_main_loop_exit (int status);
NihMainLoopFunc *nih_main_loop_add_func (const void *parent,
NihMainLoopCb callback, void *data)
__attribute__ ((warn_unused_result));
void nih_main_term_signal (void *data, NihSignal *signal);
NIH_END_EXTERN
#endif /* NIH_MAIN_H */
|