summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-11-30 18:49:48 +0200
committerSergey Poznyakoff <gray@gnu.org>2020-11-30 18:49:48 +0200
commit23404fbf27b67bd1767998918548aee3235f201c (patch)
treed3557c6336910a53f9f8dc83568195e383d10b4d /include
parent42e0f735b48ab0f05e80eeec335684b25a93c4a3 (diff)
downloadmailutils-23404fbf27b67bd1767998918548aee3235f201c.tar.gz
mailutils-23404fbf27b67bd1767998918548aee3235f201c.tar.bz2
New functions for closing all fds and daemonizing
* configure.ac: Select a suitable interface for closing all file descriptors greater than or equal to a chosen one. * include/mailutils/daemon.h (mu_daemon): New proto. * include/mailutils/util.h (mu_close_fds): New proto. * lib/daemon.c: Removed. * lib/Makefile.am: Remove daemon.c * libmailutils/base/Makefile.am: Add closefds.c * libmailutils/base/closefds.c: New file. * libmailutils/base/daemon.c: Rename to libmailutils/base/pidfile.c * libmailutils/base/daemon.c: New file. * libmailutils/diag/bt.c: Use mu_close_fds. * libmailutils/server/acl.c: Likewise. * mh/mh_whatnow.c: Likewise. * libmailutils/stream/prog_stream.c: Likewise. * libmailutils/server/msrv.c: Use mu_daemon. * mh/send.c: Likewise. * mda/lib/util.c (mda_close_fds): Remove.
Diffstat (limited to 'include')
-rw-r--r--include/mailutils/daemon.h5
-rw-r--r--include/mailutils/util.h3
2 files changed, 6 insertions, 2 deletions
diff --git a/include/mailutils/daemon.h b/include/mailutils/daemon.h
index cd368e157..c9c1d2424 100644
--- a/include/mailutils/daemon.h
+++ b/include/mailutils/daemon.h
@@ -28,8 +28,9 @@ extern "C" {
#define MODE_INTERACTIVE 0
#define MODE_DAEMON 1
-extern int mu_daemon_create_pidfile (const char *);
-extern void mu_daemon_remove_pidfile (void);
+int mu_daemon_create_pidfile (const char *);
+void mu_daemon_remove_pidfile (void);
+int mu_daemon (void);
#ifdef __cplusplus
}
diff --git a/include/mailutils/util.h b/include/mailutils/util.h
index 7c12aadec..e0aa0d167 100644
--- a/include/mailutils/util.h
+++ b/include/mailutils/util.h
@@ -248,6 +248,9 @@ int mu_remove_file (const char *path);
int mu_file_name_is_safe (char const *str);
int mu_getmaxfd (void);
+void mu_close_fds (int minfd);
+int mu_daemon (void);
+
/* Get the host name, doing a gethostbyname() if possible. */
int mu_get_host_name (char **host);
int mu_spawnvp (const char *prog, char *av[], int *stat);

Return to:

Send suggestions and report system problems to the System administrator.