Browse code

- added creator_pid variable to enable get pid of ser main process that terminates when daemonizing.

Tomas Mandys authored on 11/05/2006 11:29:31
Showing 2 changed files
... ...
@@ -49,6 +49,7 @@ extern int config_check;
49 49
 extern char *stat_file;
50 50
 extern unsigned short port_no;
51 51
 
52
+extern pid_t creator_pid;  /* pid of first process before daemonization */
52 53
 extern int uid;
53 54
 extern int gid;
54 55
 extern char* pid_file;
... ...
@@ -245,6 +245,7 @@ int sig_flag = 0;              /* last signal received */
245 245
 int debug = L_DEFAULT; /* print only msg. < L_WARN */
246 246
 int dont_fork = 0;
247 247
 int log_stderr = 0;
248
+pid_t creator_pid = (pid_t) -1;
248 249
 /* log facility (see syslog(3)) */
249 250
 int log_facility = LOG_DAEMON;
250 251
 int config_check = 0;
... ...
@@ -1211,6 +1212,7 @@ int main(int argc, char** argv)
1211 1211
 	int debug_save, debug_flag = 0;
1212 1212
 
1213 1213
 	/*init*/
1214
+	creator_pid = getpid();
1214 1215
 	ret=-1;
1215 1216
 	my_argc=argc; my_argv=argv;
1216 1217