aboutsummaryrefslogtreecommitdiff
path: root/pies/pies.h
diff options
context:
space:
mode:
Diffstat (limited to 'pies/pies.h')
-rw-r--r--pies/pies.h119
1 files changed, 119 insertions, 0 deletions
diff --git a/pies/pies.h b/pies/pies.h
new file mode 100644
index 0000000..8145f51
--- /dev/null
+++ b/pies/pies.h
@@ -0,0 +1,119 @@
+/* This file is part of Mailfromd.
+ Copyright (C) 2008 Sergey Poznyakoff
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ 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, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <syslog.h>
+#include <getopt.h>
+#include <errno.h>
+#include <string.h>
+#include <pwd.h>
+#include <grp.h>
+#include <signal.h>
+#include <sysexits.h>
+#include <mailutils/mailutils.h>
+#include <mailutils/daemon.h>
+#include <mailutils/libargp.h>
+#include <mailutils/syslog.h>
+
+#include "xalloc.h"
+#include "libmf.h"
+
+#define RETR_OUT 0
+#define RETR_ERR 1
+
+#define TESTTIME 2*60
+#define SLEEPTIME 5*60
+#define MAXSPAWN 10
+
+struct pies_privs_data
+{
+ char *user;
+ mu_list_t groups;
+};
+
+#define MAX_RETURN_CODE 127
+
+enum return_action
+{
+ action_restart,
+ action_disable,
+};
+
+struct action
+{
+ enum return_action act; /* Action to take when the component terminates */
+ mu_address_t addr; /* Addresses to notify about it. */
+ char *message; /* Notification mail. */
+};
+
+struct component
+{
+ char *tag; /* Entry tag (for diagnostics purposes) */
+ char **argv; /* Program command line */
+ char **env; /* Program environment */
+ char *dir; /* Working directory */
+ char **depend; /* Dependencies */
+ int disabled;
+ char *rmfile;
+ int retr[2];
+ struct pies_privs_data privs;
+ mode_t umask;
+ struct action *act[MAX_RETURN_CODE+1];
+};
+
+void register_prog (struct component *comp);
+size_t progman_running_count (void);
+void progman_start (void);
+void progman_wake_sleeping (void);
+void progman_stop (void);
+void progman_cleanup (int expect_term);
+void progman_stop_component (const char *name);
+void progman_dump_stats (const char *filename);
+
+void log_setup (int want_stderr);
+void signal_setup (RETSIGTYPE (*sf)(int));
+void priv_setup (struct pies_privs_data *pr);
+
+typedef struct pies_depmap *pies_depmap_t;
+typedef struct pies_depmap_pos *pies_depmap_pos_t;
+enum pies_depmap_direction
+ {
+ depmap_row = 0,
+ depmap_col = !depmap_row
+ };
+
+pies_depmap_t depmap_alloc (unsigned count);
+pies_depmap_t depmap_copy (pies_depmap_t dpm);
+void depmap_set (pies_depmap_t dmap, unsigned row, unsigned col);
+int depmap_isset (pies_depmap_t dmap, unsigned row, unsigned col);
+void depmap_tc (pies_depmap_t dmap);
+unsigned depmap_first (pies_depmap_t dmap, enum pies_depmap_direction dir,
+ unsigned coord, pies_depmap_pos_t *ppos);
+unsigned depmap_next (pies_depmap_t dmap, pies_depmap_pos_t pos);
+
+extern char *syslog_tag;
+extern unsigned long shutdown_timeout;
+extern struct component default_component;

Return to:

Send suggestions and report system problems to the System administrator.