diff --git a/opal/runtime/opal_init.c b/opal/runtime/opal_init.c index 0245f577d0..920850298f 100644 --- a/opal/runtime/opal_init.c +++ b/opal/runtime/opal_init.c @@ -152,8 +152,9 @@ opal_init_util(void) opal_output_init(); /* register handler for errnum -> string converstion */ - if (OPAL_SUCCESS != (ret = opal_error_register("OPAL", - OPAL_ERR_BASE, OPAL_ERR_MAX, opal_err2str))) { + if (OPAL_SUCCESS != + (ret = opal_error_register("OPAL", + OPAL_ERR_BASE, OPAL_ERR_MAX, opal_err2str))) { error = "opal_error_register"; goto return_error; } @@ -201,7 +202,7 @@ opal_init_util(void) error = "opal_util_init_sys_limits"; goto return_error; } - + return OPAL_SUCCESS; return_error: diff --git a/opal/runtime/opal_params.c b/opal/runtime/opal_params.c index 2dbb934578..ec57bd410d 100644 --- a/opal/runtime/opal_params.c +++ b/opal/runtime/opal_params.c @@ -35,8 +35,6 @@ int opal_register_params(void) { - - /* * This string is going to be used in opal/util/stacktrace.c */ diff --git a/opal/util/net.c b/opal/util/net.c index c668210c97..f156bb9b7e 100644 --- a/opal/util/net.c +++ b/opal/util/net.c @@ -176,10 +176,6 @@ opal_net_samenetwork(const struct sockaddr *addr1, uint32_t prefixlen) { if(addr1->sa_family != addr2->sa_family) { -#if 0 - /* very annoying debug output */ - opal_output(0, "opal_samenetwork: uncomparable"); -#endif return false; /* address families must be equal */ } diff --git a/opal/util/output.c b/opal/util/output.c index 3938764b2d..dbc93c3521 100644 --- a/opal/util/output.c +++ b/opal/util/output.c @@ -634,98 +634,95 @@ static void output(int output_id, const char *format, va_list arglist) /* Setup */ if (!initialized) { - opal_output_init(); + opal_output_init(); } /* If it's valid, used, and enabled, output */ if (output_id >= 0 && output_id < OPAL_OUTPUT_MAX_STREAMS && - info[output_id].ldi_used && info[output_id].ldi_enabled) { - ldi = &info[output_id]; + info[output_id].ldi_used && info[output_id].ldi_enabled) { + ldi = &info[output_id]; - /* Make the formatted string */ + /* Make the formatted string */ - OPAL_THREAD_LOCK(&mutex); - vasprintf(&str, format, arglist); - total_len = len = strlen(str); - if ('\n' != str[len - 1]) { - want_newline = true; - ++total_len; - } - if (NULL != ldi->ldi_prefix) { - total_len += strlen(ldi->ldi_prefix); - } - if (temp_str_len < total_len + want_newline) { - if (NULL != temp_str) { - free(temp_str); - } - temp_str = (char *) malloc(total_len * 2); - temp_str_len = total_len * 2; - } - if (NULL != ldi->ldi_prefix) { - if (want_newline) { - snprintf(temp_str, temp_str_len, "%s%s\n", ldi->ldi_prefix, - str); - } else { - snprintf(temp_str, temp_str_len, "%s%s", ldi->ldi_prefix, - str); - } - } else { - if (want_newline) { - snprintf(temp_str, temp_str_len, "%s\n", str); - } else { - snprintf(temp_str, temp_str_len, "%s", str); - } - } + OPAL_THREAD_LOCK(&mutex); + vasprintf(&str, format, arglist); + total_len = len = strlen(str); + if ('\n' != str[len - 1]) { + want_newline = true; + ++total_len; + } + if (NULL != ldi->ldi_prefix) { + total_len += strlen(ldi->ldi_prefix); + } + if (temp_str_len < total_len + want_newline) { + if (NULL != temp_str) { + free(temp_str); + } + temp_str = (char *) malloc(total_len * 2); + temp_str_len = total_len * 2; + } + if (NULL != ldi->ldi_prefix) { + if (want_newline) { + snprintf(temp_str, temp_str_len, "%s%s\n", ldi->ldi_prefix, + str); + } else { + snprintf(temp_str, temp_str_len, "%s%s", ldi->ldi_prefix, + str); + } + } else { + if (want_newline) { + snprintf(temp_str, temp_str_len, "%s\n", str); + } else { + snprintf(temp_str, temp_str_len, "%s", str); + } + } - /* Syslog output */ - - if (ldi->ldi_syslog) { + /* Syslog output */ #if defined(HAVE_SYSLOG) - syslog(ldi->ldi_syslog_priority, "%s", str); + if (ldi->ldi_syslog) { + syslog(ldi->ldi_syslog_priority, "%s", str); + } #endif - } - /* stdout output */ - - if (ldi->ldi_stdout) { + /* stdout output */ + if (ldi->ldi_stdout) { write(fileno(stdout), temp_str, (int)strlen(temp_str)); fflush(stdout); - } + } - /* stderr output */ - - if (ldi->ldi_stderr) { + /* stderr output */ + if (ldi->ldi_stderr) { write(fileno(stderr),temp_str, (int)strlen(temp_str)); fflush(stderr); } - /* File output -- first check to see if the file opening was - * delayed. If so, try to open it. If we failed to open it, - * then just discard (there are big warnings in the - * opal_output.h docs about this!). */ + /* File output -- first check to see if the file opening was + * delayed. If so, try to open it. If we failed to open it, + * then just discard (there are big warnings in the + * opal_output.h docs about this!). */ - if (ldi->ldi_file) { - if (ldi->ldi_fd == -1) { - if (OPAL_SUCCESS != open_file(output_id)) { - ++ldi->ldi_file_num_lines_lost; - } else if (ldi->ldi_file_num_lines_lost > 0) { - char buffer[BUFSIZ]; - memset(buffer, 0, BUFSIZ); - snprintf(buffer, BUFSIZ - 1, - "[WARNING: %d lines lost because the Open MPI process session directory did\n not exist when opal_output() was invoked]\n", - ldi->ldi_file_num_lines_lost); - write(ldi->ldi_fd, buffer, (int)strlen(buffer)); - ldi->ldi_file_num_lines_lost = 0; - } - } - if (ldi->ldi_fd != -1) { + if (ldi->ldi_file) { + if (ldi->ldi_fd == -1) { + if (OPAL_SUCCESS != open_file(output_id)) { + ++ldi->ldi_file_num_lines_lost; + } else if (ldi->ldi_file_num_lines_lost > 0) { + char buffer[BUFSIZ]; + memset(buffer, 0, BUFSIZ); + snprintf(buffer, BUFSIZ - 1, + "[WARNING: %d lines lost because the Open MPI process session directory did\n not exist when opal_output() was invoked]\n", + ldi->ldi_file_num_lines_lost); + write(ldi->ldi_fd, buffer, (int)strlen(buffer)); + ldi->ldi_file_num_lines_lost = 0; + } + } + if (ldi->ldi_fd != -1) { write(ldi->ldi_fd, temp_str, (int)total_len); - } - } - OPAL_THREAD_UNLOCK(&mutex); + } + } + OPAL_THREAD_UNLOCK(&mutex); - free(str); + free(str); } }