|
@@ -40,17 +40,6 @@
|
|
#include <sys/prctl.h>
|
|
#include <sys/prctl.h>
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-/*
|
|
|
|
- * Must set all three of these at once.
|
|
|
|
- * Legal combinations are unset by name by uid
|
|
|
|
- */
|
|
|
|
-static struct passwd *user_pwd; /* NULL non-NULL NULL */
|
|
|
|
-static uid_t user_uid = (uid_t)-1; /* -1 -1 >=0 */
|
|
|
|
-static gid_t user_gid = (gid_t)-1; /* -1 -1 >=0 */
|
|
|
|
-
|
|
|
|
-static const char *chroot_dir;
|
|
|
|
-static int daemonize;
|
|
|
|
-static int daemon_pipe;
|
|
|
|
|
|
|
|
void os_setup_early_signal_handling(void)
|
|
void os_setup_early_signal_handling(void)
|
|
{
|
|
{
|
|
@@ -97,6 +86,15 @@ void os_set_proc_name(const char *s)
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * Must set all three of these at once.
|
|
|
|
+ * Legal combinations are unset by name by uid
|
|
|
|
+ */
|
|
|
|
+static struct passwd *user_pwd; /* NULL non-NULL NULL */
|
|
|
|
+static uid_t user_uid = (uid_t)-1; /* -1 -1 >=0 */
|
|
|
|
+static gid_t user_gid = (gid_t)-1; /* -1 -1 >=0 */
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Prepare to change user ID. optarg can be one of 3 forms:
|
|
* Prepare to change user ID. optarg can be one of 3 forms:
|
|
* - a username, in which case user ID will be changed to its uid,
|
|
* - a username, in which case user ID will be changed to its uid,
|
|
@@ -174,6 +172,9 @@ static void change_process_uid(void)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+static const char *chroot_dir;
|
|
|
|
+
|
|
void os_set_chroot(const char *optarg)
|
|
void os_set_chroot(const char *optarg)
|
|
{
|
|
{
|
|
chroot_dir = optarg;
|
|
chroot_dir = optarg;
|
|
@@ -194,6 +195,21 @@ static void change_root(void)
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+static int daemonize;
|
|
|
|
+static int daemon_pipe;
|
|
|
|
+
|
|
|
|
+bool is_daemonized(void)
|
|
|
|
+{
|
|
|
|
+ return daemonize;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int os_set_daemonize(bool d)
|
|
|
|
+{
|
|
|
|
+ daemonize = d;
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
void os_daemonize(void)
|
|
void os_daemonize(void)
|
|
{
|
|
{
|
|
if (daemonize) {
|
|
if (daemonize) {
|
|
@@ -287,17 +303,6 @@ void os_set_line_buffering(void)
|
|
setvbuf(stdout, NULL, _IOLBF, 0);
|
|
setvbuf(stdout, NULL, _IOLBF, 0);
|
|
}
|
|
}
|
|
|
|
|
|
-bool is_daemonized(void)
|
|
|
|
-{
|
|
|
|
- return daemonize;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-int os_set_daemonize(bool d)
|
|
|
|
-{
|
|
|
|
- daemonize = d;
|
|
|
|
- return 0;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
int os_mlock(void)
|
|
int os_mlock(void)
|
|
{
|
|
{
|
|
#ifdef HAVE_MLOCKALL
|
|
#ifdef HAVE_MLOCKALL
|