set process title

This commit is contained in:
Nikos Mavrogiannopoulos
2013-02-08 22:37:41 +01:00
parent b70a0251ba
commit 6aae1d60d5
4 changed files with 92 additions and 1 deletions

View File

@@ -36,6 +36,7 @@
#include <gnutls/x509.h>
#include <tlslib.h>
#include "ipc.h"
#include "setproctitle.h"
#include <main.h>
#include <worker.h>
@@ -498,6 +499,9 @@ int main(int argc, char** argv)
exit(1);
}
initproctitle(argc, argv);
setproctitle(PACKAGE_NAME, "main");
if (getuid() != 0) {
fprintf(stderr, "This server requires root access to operate.\n");
exit(1);
@@ -613,6 +617,7 @@ int main(int argc, char** argv)
/* close any open descriptors before
* running the server
*/
setproctitle(PACKAGE_NAME, "worker");
close(cmd_fd[0]);
clear_lists(&s);
@@ -683,6 +688,7 @@ fork_failed:
need_maintainance = 0;
pid = fork();
if (pid == 0) { /* child */
setproctitle(PACKAGE_NAME, "maintainance");
mslog(&s, NULL, LOG_INFO, "Performing maintainance");
clear_lists(&s);