From 4b01271fa595a08e68ba8c58d6404e83623aa9c8 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Fri, 20 Mar 2020 22:48:41 +0000 Subject: debug tidying --- src/src/child.c | 2 +- src/src/daemon.c | 9 +++------ src/src/deliver.c | 8 +------- src/src/exim.c | 3 ++- src/src/log.c | 2 +- src/src/queue.c | 4 +--- src/src/smtp_in.c | 4 ++-- src/src/tls.c | 2 +- src/src/transport.c | 10 +++------- src/src/transports/pipe.c | 2 +- src/src/transports/smtp.c | 8 ++------ 11 files changed, 18 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/src/child.c b/src/src/child.c index ba7e899d2..5e4b978cd 100644 --- a/src/src/child.c +++ b/src/src/child.c @@ -145,7 +145,7 @@ if (acount > 0) argv[n] = NULL; if (exec_type == CEE_RETURN_ARGV) { - if (pcount != NULL) *pcount = n; + if (pcount) *pcount = n; return argv; } diff --git a/src/src/daemon.c b/src/src/daemon.c index 81fb69447..fa74ddb0e 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -663,7 +663,7 @@ if (pid == 0) mac_smtp_fflush(); - if ((dpid = exim_fork(US"daemon-accept delivery")) == 0) + if ((dpid = exim_fork(US"daemon-accept-delivery")) == 0) { (void)fclose(smtp_in); (void)fclose(smtp_out); @@ -981,7 +981,7 @@ if (daemon_notifier_fd >= 0) if (f.running_in_test_harness || write_pid) { - if ((pid = exim_fork(US"daemon del pidfile")) == 0) + if ((pid = exim_fork(US"daemon-del-pidfile")) == 0) { if (override_pid_file_path) (void)child_exec_exim(CEE_EXEC_PANIC, FALSE, NULL, FALSE, 3, @@ -2130,11 +2130,8 @@ for (;;) if ( queue_interval > 0 && (local_queue_run_max <= 0 || queue_run_count < local_queue_run_max)) { - if ((pid = exim_fork(US"queue runner")) == 0) + if ((pid = exim_fork(US"queue-runner")) == 0) { - DEBUG(D_any) debug_printf("Starting queue-runner: pid %d\n", - (int)getpid()); - /* Disable debugging if it's required only for the daemon process. We leave the above message, because it ties up with the "child ended" debugging messages. */ diff --git a/src/src/deliver.c b/src/src/deliver.c index 497b3c806..1748c7985 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -4646,7 +4646,6 @@ all pipes, so I do not see a reason to use non-blocking IO here search_tidyup(); - DEBUG(D_deliver) debug_printf("forking transport process\n"); if ((pid = exim_fork(US"transport")) == 0) { int fd = pfd[pipe_write]; @@ -4661,10 +4660,7 @@ all pipes, so I do not see a reason to use non-blocking IO here /* Show pids on debug output if parallelism possible */ if (parmax > 1 && (parcount > 0 || addr_remote)) - { DEBUG(D_any|D_v) debug_selector |= D_pid; - DEBUG(D_deliver) debug_printf("Remote delivery process started\n"); - } /* Reset the random number generator, so different processes don't all have the same sequence. In the test harness we want different, but @@ -4977,7 +4973,6 @@ all pipes, so I do not see a reason to use non-blocking IO here (void)close(fd); exit(EXIT_SUCCESS); } - DEBUG(D_deliver) debug_printf("forked transport process (%d)\n", pid); /* Back in the mainline: close the unwanted half of the pipe. */ @@ -8580,7 +8575,7 @@ if (cutthrough.cctx.sock >= 0 && cutthrough.callout_hold_only) where = US"fork"; testharness_pause_ms(150); - if ((pid = exim_fork(US"tls-proxy interproc")) < 0) + if ((pid = exim_fork(US"tls-proxy-interproc")) < 0) goto fail; if (pid == 0) /* child: will fork again to totally disconnect */ @@ -8590,7 +8585,6 @@ if (cutthrough.cctx.sock >= 0 && cutthrough.callout_hold_only) /* does not return */ } - DEBUG(D_transport) debug_printf("proxy-proc inter-pid %d\n", pid); close(pfd[0]); waitpid(pid, NULL, 0); (void) close(channel_fd); /* release the client socket */ diff --git a/src/src/exim.c b/src/src/exim.c index 2ac0720ca..1c0ea6b6e 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -2762,7 +2762,8 @@ for (i = 1; i < argc; i++) /* -MCd: for debug, set a process-purpose string */ - case 'd': if (++i < argc) process_purpose = argv[i]; + case 'd': if (++i < argc) + process_purpose = string_copy_taint(argv[i], TRUE); else badarg = TRUE; break; diff --git a/src/src/log.c b/src/src/log.c index 89c5dc003..2dd85c484 100644 --- a/src/src/log.c +++ b/src/src/log.c @@ -313,7 +313,7 @@ Returns: a file descriptor, or < 0 on failure (errno set) int log_create_as_exim(uschar *name) { -pid_t pid = exim_fork(US"logfile create"); +pid_t pid = exim_fork(US"logfile-create"); int status = 1; int fd = -1; diff --git a/src/src/queue.c b/src/src/queue.c index 211349047..9dbf3e717 100644 --- a/src/src/queue.c +++ b/src/src/queue.c @@ -496,10 +496,8 @@ for (int i = queue_run_in_order ? -1 : 0; } else for (i = 0; qpid[i]; ) i++; - DEBUG(D_queue_run) debug_printf("q2stage forking\n"); - if ((qpid[i] = exim_fork(US"qrun phase one"))) + if ((qpid[i] = exim_fork(US"qrun-phase-one"))) continue; /* parent loops around */ - DEBUG(D_queue_run) debug_printf("q2stage child\n"); } /* Skip this message unless it's within the ID limits */ diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index b5f44f548..268fd6956 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -5759,7 +5759,7 @@ while (done <= 0) oldsignal = signal(SIGCHLD, SIG_IGN); - if ((pid = exim_fork(US"etrn command")) == 0) + if ((pid = exim_fork(US"etrn-command")) == 0) { smtp_input = FALSE; /* This process is not associated with the */ (void)fclose(smtp_in); /* SMTP call any more. */ @@ -5771,7 +5771,7 @@ while (done <= 0) into another process. */ if ( !smtp_etrn_serialize - || (pid = exim_fork(US"etrn serialised command")) == 0) + || (pid = exim_fork(US"etrn-serialised-command")) == 0) { DEBUG(D_exec) debug_print_argv(argv); exim_nullstd(); /* Ensure std{in,out,err} exist */ diff --git a/src/src/tls.c b/src/src/tls.c index 2f9faa3c7..9732da533 100644 --- a/src/src/tls.c +++ b/src/src/tls.c @@ -441,7 +441,7 @@ else if (!nowarn && !tls_certificate) oldsignal = signal(SIGCHLD, SIG_DFL); fflush(NULL); -if ((pid = exim_fork(US"cipher validate")) < 0) +if ((pid = exim_fork(US"cipher-validate")) < 0) log_write(0, LOG_MAIN|LOG_PANIC_DIE, "fork failed for TLS check"); if (pid == 0) diff --git a/src/src/transport.c b/src/src/transport.c index 6b33a0e68..d2cb8c235 100644 --- a/src/src/transport.c +++ b/src/src/transport.c @@ -1250,7 +1250,7 @@ via a(nother) pipe. While writing to the filter, we do not do the CRLF, smtp dots, or check string processing. */ if (pipe(pfd) != 0) goto TIDY_UP; /* errno set */ -if ((write_pid = exim_fork(US"transport filter writer")) == 0) +if ((write_pid = exim_fork(US"tpt-filter-writer")) == 0) { BOOL rc; (void)close(fd_read); @@ -1958,7 +1958,7 @@ int status; DEBUG(D_transport) debug_printf("transport_pass_socket entered\n"); -if ((pid = exim_fork(US"continued-transport interproc")) == 0) +if ((pid = exim_fork(US"continued-transport-interproc")) == 0) { /* Disconnect entirely from the parent process. If we are running in the test harness, wait for a bit to allow the previous process time to finish, @@ -1966,11 +1966,8 @@ if ((pid = exim_fork(US"continued-transport interproc")) == 0) automatic comparison. */ if ((pid = exim_fork(US"continued-transport")) != 0) - { - DEBUG(D_transport) debug_printf("transport_pass_socket succeeded (final-pid %d)\n", pid); _exit(EXIT_SUCCESS); - } - testharness_pause_ms(1000); /*TTT*/ + testharness_pause_ms(1000); transport_do_pass_socket(transport_name, hostname, hostaddress, id, socket_fd); @@ -1984,7 +1981,6 @@ if (pid > 0) { int rc; while ((rc = wait(&status)) != pid && (rc >= 0 || errno != ECHILD)); - DEBUG(D_transport) debug_printf("transport_pass_socket succeeded (inter-pid %d)\n", pid); return TRUE; } else diff --git a/src/src/transports/pipe.c b/src/src/transports/pipe.c index c1e2b26c7..6a7f150ac 100644 --- a/src/src/transports/pipe.c +++ b/src/src/transports/pipe.c @@ -738,7 +738,7 @@ tctx.u.fd = fd_in; /* Now fork a process to handle the output that comes down the pipe. */ -if ((outpid = exim_fork(US"pipe-transport output")) < 0) +if ((outpid = exim_fork(US"pipe-tpt-output")) < 0) { addr->basic_errno = errno; addr->transport_return = DEFER; diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 2216ff853..0bec253c1 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -3284,11 +3284,8 @@ int max_fd = MAX(pfd[0], tls_out.active.sock) + 1; int rc, i; close(pfd[1]); -if ((rc = exim_fork(US"tls proxy"))) - { - DEBUG(D_transport) debug_printf("proxy-proc final-pid %d\n", rc); +if ((rc = exim_fork(US"tls-proxy"))) _exit(rc < 0 ? EXIT_FAILURE : EXIT_SUCCESS); - } set_process_info("proxying TLS connection for continued transport"); FD_ZERO(&rfds); @@ -4278,7 +4275,7 @@ propagate it from the initial #ifndef DISABLE_TLS if (tls_out.active.sock >= 0) { - int pid = exim_fork(US"tls proxy interproc"); + int pid = exim_fork(US"tls-proxy-interproc"); if (pid == 0) /* child; fork again to disconnect totally */ { /* does not return */ @@ -4288,7 +4285,6 @@ propagate it from the initial if (pid > 0) /* parent */ { - DEBUG(D_transport) debug_printf("proxy-proc inter-pid %d\n", pid); close(pfd[0]); /* tidy the inter-proc to disconn the proxy proc */ waitpid(pid, NULL, 0); -- cgit v1.2.3