[dovecot-cvs] dovecot/src/imap main.c,1.12,1.13 rawlog.c,1.4,1.5

cras at procontrol.fi cras at procontrol.fi
Tue Dec 3 02:27:35 EET 2002


Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv6407

Modified Files:
	main.c rawlog.c 
Log Message:
Set process title for rawlog process.



Index: main.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/main.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- main.c	1 Dec 2002 18:18:49 -0000	1.12
+++ main.c	3 Dec 2002 00:27:32 -0000	1.13
@@ -6,6 +6,7 @@
 #include "rawlog.h"
 #include "restrict-access.h"
 #include "fd-close-on-exec.h"
+#include "process-title.h"
 
 #include <stdlib.h>
 #include <syslog.h>
@@ -103,7 +104,7 @@
 	closelog();
 }
 
-int main(int argc, char *argv[])
+int main(int argc, char *argv[], char *envp[])
 {
 #ifdef DEBUG
 	if (getenv("LOGIN_TAG") != NULL)
@@ -112,6 +113,7 @@
 	/* NOTE: we start rooted, so keep the code minimal until
 	   restrict_access_by_env() is called */
 	lib_init();
+        process_title_init(argv, envp);
 	ioloop = io_loop_create(system_pool);
 
 	main_init(argc >= 2 && strcmp(argv[1], "-s") == 0);

Index: rawlog.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/rawlog.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- rawlog.c	26 Nov 2002 19:49:16 -0000	1.4
+++ rawlog.c	3 Dec 2002 00:27:32 -0000	1.5
@@ -8,6 +8,7 @@
 #include "ioloop.h"
 #include "network.h"
 #include "write-full.h"
+#include "process-title.h"
 
 #include <stdlib.h>
 #include <unistd.h>
@@ -92,7 +93,7 @@
 	struct tm *tm;
 	struct stat st;
 	int sfd[2];
-	pid_t pid;
+	pid_t pid, parent_pid;
 
 	home = getenv("HOME");
 	if (home == NULL)
@@ -132,6 +133,8 @@
 	if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0)
 		i_fatal("socketpair() failed: %m");
 
+	parent_pid = getpid();
+
 	pid = fork();
 	if (pid < 0)
 		i_fatal("fork() failed: %m");
@@ -145,6 +148,9 @@
 		return;
 	}
 	close(sfd[1]);
+
+	process_title_set(t_strdup_printf("[%s:%d rawlog]", getenv("USER"),
+					  (int)parent_pid));
 
 	/* child */
 	client_in = *hin;




More information about the dovecot-cvs mailing list