syslog-ng source
gprocess.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2011 Balabit
3  * Copyright (c) 1998-2011 Balázs Scheidler
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * As an additional exemption you are allowed to compile & link against the
20  * OpenSSL libraries as published by the OpenSSL project. See the file
21  * COPYING for details.
22  *
23  */
24 
25 #ifndef GPROCESS_H_INCLUDED
26 #define GPROCESS_H_INCLUDED
27 
28 #include "syslog-ng.h"
29 
30 #include <sys/types.h>
31 #include <glib.h>
32 
33 #if SYSLOG_NG_ENABLE_LINUX_CAPS
34 # include <sys/capability.h>
35 #endif
36 
37 typedef enum
38 {
42 } GProcessMode;
43 
44 #if SYSLOG_NG_ENABLE_LINUX_CAPS
45 
46 gboolean g_process_enable_cap(const gchar *cap_name);
47 gboolean g_process_is_cap_enabled(void);
50 
51 #else
52 
53 typedef gpointer cap_t;
54 
55 #define g_process_enable_cap(cap)
56 #define g_process_cap_save() NULL
57 #define g_process_cap_restore(cap) cap = cap
58 
59 #endif
60 
63 void g_process_set_name(const gchar *name);
64 void g_process_set_user(const gchar *user);
65 void g_process_set_group(const gchar *group);
66 void g_process_set_chroot(const gchar *chroot);
67 void g_process_set_pidfile(const gchar *pidfile);
68 void g_process_set_pidfile_dir(const gchar *pidfile_dir);
69 void g_process_set_working_dir(const gchar *cwd);
70 void g_process_disable_caps(void);
71 void g_process_set_caps(const gchar *caps);
72 void g_process_set_argv_space(gint argc, gchar **argv);
73 void g_process_set_use_fdlimit(gboolean use);
74 void g_process_set_check(gint check_period, gboolean (*check_fn)(void));
75 
77 
78 void g_process_start(void);
79 void g_process_startup_failed(guint ret_num, gboolean may_exit);
80 void g_process_startup_ok(void);
81 void g_process_finish(void);
82 
83 void g_process_add_option_group(GOptionContext *ctx);
84 
85 
86 #endif
const gchar * name
Definition: debugger.c:265
GProcessMode mode
Definition: gprocess.c:118
const gchar * user
Definition: gprocess.c:120
const gchar * cwd
Definition: gprocess.c:127
gint check_period
Definition: gprocess.c:137
gint argc
Definition: gprocess.c:130
const gchar * caps
Definition: gprocess.c:128
const gchar * pidfile_dir
Definition: gprocess.c:126
gchar ** argv
Definition: gprocess.c:131
const gchar * group
Definition: gprocess.c:122
const gchar * pidfile
Definition: gprocess.c:125
gboolean(* check_fn)(void)
Definition: gprocess.c:138
void g_process_startup_ok(void)
Definition: gprocess.c:1473
#define g_process_enable_cap(cap)
Definition: gprocess.h:55
gboolean g_process_check_cap_syslog(void)
void g_process_set_pidfile(const gchar *pidfile)
Definition: gprocess.c:498
GProcessMode g_process_get_mode(void)
Definition: gprocess.c:427
void g_process_set_mode(GProcessMode mode)
Definition: gprocess.c:416
void g_process_set_caps(const gchar *caps)
Definition: gprocess.c:543
void g_process_set_pidfile_dir(const gchar *pidfile_dir)
Definition: gprocess.c:512
#define g_process_cap_restore(cap)
Definition: gprocess.h:57
void g_process_start(void)
Definition: gprocess.c:1321
GProcessMode
Definition: gprocess.h:38
@ G_PM_SAFE_BACKGROUND
Definition: gprocess.h:41
@ G_PM_FOREGROUND
Definition: gprocess.h:39
@ G_PM_BACKGROUND
Definition: gprocess.h:40
void g_process_set_chroot(const gchar *chroot)
Definition: gprocess.c:482
void g_process_set_group(const gchar *group)
Definition: gprocess.c:468
void g_process_set_working_dir(const gchar *cwd)
Definition: gprocess.c:527
void g_process_add_option_group(GOptionContext *ctx)
Definition: gprocess.c:1573
void g_process_finish(void)
Definition: gprocess.c:1489
void g_process_set_argv_space(gint argc, gchar **argv)
Definition: gprocess.c:558
void g_process_set_user(const gchar *user)
Definition: gprocess.c:453
void g_process_startup_failed(guint ret_num, gboolean may_exit)
Definition: gprocess.c:1451
gpointer cap_t
Definition: gprocess.h:53
#define g_process_cap_save()
Definition: gprocess.h:56
void g_process_set_name(const gchar *name)
Definition: gprocess.c:441
void g_process_disable_caps(void)
Definition: gprocess.c:1541
void g_process_set_check(gint check_period, gboolean(*check_fn)(void))
Definition: gprocess.c:613
void g_process_set_use_fdlimit(gboolean use)